Package org.apache.jetspeed.capability

Examples of org.apache.jetspeed.capability.CapabilityMap


    public void testDefaultMap() throws Exception
    {
        try
        {
            // first test default capailitymap
            CapabilityMap cm = CapabilityMapFactory.getDefaultCapabilityMap();
            assertNotNull(cm);
            assertTrue(cm.toString().startsWith("ns4"));
        }
        catch (Exception e)
        {
            String errmsg = "Error in test: " + e.toString();
           // e.printStackTrace();
View Full Code Here


    public void testCapabilityCheck() throws Exception
    {
        try
        {
            // test simple capabilities
            CapabilityMap cm = CapabilityMapFactory.getCapabilityMap("Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0rc1) Gecko/20020417");
            assertTrue(cm.hasCapability("HTML_DOM_1"));
            assertTrue(cm.hasCapability("HTML_IFRAME"));
            assertTrue(cm.supportsMimeType(MimeType.XML));
            assertTrue(cm.supportsMediaType("html"));
        }
        catch (Exception e)
        {
            String errmsg = "Error in test: " + e.toString();
           // e.printStackTrace();
View Full Code Here

        }
    }

    private void getUserAgent(String name, String ua)
    {
        CapabilityMap cm = CapabilityMapFactory.getCapabilityMap(ua);
        assertNotNull(cm);
        assertNotNull(name);
        assertTrue(cm.toString().startsWith(name));
    }
View Full Code Here

     */
    public Profile createProfile(RunData data, Profile profile)
            throws ProfileException
    {
        Profile current = null;
        CapabilityMap map;

        if (data == null)
        {
            map = CapabilityMapFactory.getDefaultCapabilityMap();
        }
View Full Code Here

     * @return a new Profile object
     */
    public Profile getProfile(RunData rundata)
        throws ProfileException
    {
        CapabilityMap cm = null;

        if (rundata instanceof JetspeedRunData)
        {
            cm = ((JetspeedRunData)rundata).getCapability();
        }
View Full Code Here

     * @return a new Profile object
     */
    public Profile getProfile(RunData data, MimeType mt)
        throws ProfileException
    {
        CapabilityMap cm = CapabilityMapFactory.getCapabilityMap(mt.toString());
        return getProfile(data, cm);
    }
View Full Code Here

     * @return The newly created profile.
     */
    public Profile createProfile( RunData data, Profile profile, MimeType mt )
        throws ProfileException
    {
        CapabilityMap cm = CapabilityMapFactory.getCapabilityMap(mt.getContentType());
        profile.setMediaType( getMediaType(data, cm) );
        return createProfile(data, profile);
    }
View Full Code Here

            parser= docfactory.newDocumentBuilder();
            parser.setEntityResolver(new JetspeedXMLEntityResolver() );

            url = getPortletConfig().getURL();
            String content = JetspeedDiskCache.getInstance().getEntry( url ).getData();
           CapabilityMap xmap =
               CapabilityMapFactory.getCapabilityMap(CapabilityMapFactory.AGENT_XML);
            setContent( new JetspeedClearElement(content), xmap );
            InputSource isrc = new InputSource( this.cleanse( content ) );
            isrc.setSystemId( url );
            isrc.setEncoding("UTF-8");
View Full Code Here

            catch (PortletException pe)
            {
                logger.error("Exception",  pe);
            }
        }
        CapabilityMap map = ((JetspeedRunData)data).getCapability();
        String type = map.getPreferredType().toString();
        ConcreteElement content = new JetspeedClearElement(INVALID_TYPE);
        String stylesheet = (String)stylesheets.get(type);

        if (stylesheet != null) {
            content = getContent( data, map );
            if ( content == null ) {
                try {
                    content = new JetspeedClearElement(
                        SimpleTransform.transform( this.document,
                                                   stylesheet,
                                                   this.params ) );
                    setContent( content, map );
                } catch ( SAXException e ) {
                    logger.error("Exception",  e);
                    content = new JetspeedClearElement(e.getMessage());
                }
            }
        }
        else
        {
            if (map.getPreferredType().equals(MimeType.XML))
            {
                return getContent( data, map );
            }
        }
View Full Code Here

    public void setRequest(HttpServletRequest req)
    {
        super.setRequest(req);

        String enc = JetspeedResources.getString(JetspeedResources.CONTENT_ENCODING_KEY,"US-ASCII");
        CapabilityMap cm = CapabilityMapFactory.getCapabilityMap( req.getHeader("User-Agent") );
        String mimeCode = cm.getPreferredType().getCode();
        if ( mimeCode != null )
        {
            MediaTypeEntry media = (MediaTypeEntry)Registry.getEntry(Registry.MEDIA_TYPE, mimeCode);
            if ( media != null && media.getCharacterSet() != null)
            {
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.capability.CapabilityMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.