Package org.apache.jetspeed.capability

Examples of org.apache.jetspeed.capability.CapabilityMap


    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

        StringBuffer templatePath = new StringBuffer();

        // retrieve all the possible media types
        String type = data.getParameters().getString(Profiler.PARAM_MEDIA_TYPE, null);
        List types = new ArrayList();
        CapabilityMap cm = ((JetspeedRunData) data).getCapability();

        // Grab the Locale from the temporary storage in the User object
        Locale locale = (Locale) data.getUser().getTemp("locale");
        String language = locale.getLanguage();
        String country = locale.getCountry();

        if (null != type)
        {
            types.add(type);
        }
        else
        {
            Iterator i = cm.listMediaTypes();
            while (i.hasNext())
            {
                types.add(i.next());
            }
        }
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

     *
     */       
    public void doBuild( RunData data ) throws Exception
    {

        CapabilityMap cm = ((JetspeedRunData)data).getCapability();

        MimeType mt = cm.getPreferredType();
        data.setContentType( mt.getContentType() );
        data.setCharSet( mt.getCharSet() );

        if ( logger.isDebugEnabled() )
        {
View Full Code Here

                data.getResponse().setDateHeader("Last-Modified", System.currentTimeMillis());
                break;
        }

        //Set the ContentType of the page
        CapabilityMap cm = ((JetspeedRunData)data).getCapability();
        MimeType mime = cm.getPreferredType();
        String characterSet = JetspeedResources.getString(JetspeedResources.CONTENT_ENCODING_KEY,"utf-8");
        data.setContentType( mime.getContentType());
        if ( mime != null )
        {
            MediaTypeEntry media = (MediaTypeEntry)Registry.getEntry(Registry.MEDIA_TYPE, mime.getCode());
            if ( media != null && media.getCharacterSet() != null)
            {
                characterSet = media.getCharacterSet();
            }
        }
        data.setCharSet( characterSet );

        if (logger.isDebugEnabled())
        {
            logger.debug( "JetspeedTemplatePage: Setting type to: " + cm.getPreferredType().getContentType()
                        + "; charset=" + JetspeedResources.getString(JetspeedResources.CONTENT_ENCODING_KEY,"utf-8")
                     );
        }

    }
View Full Code Here

            parser = docfactory.newDocumentBuilder();
            parser.setEntityResolver(new JetspeedXMLEntityResolver());
            url = portlet.getPortletConfig().getURL();

            String content = JetspeedDiskCache.getInstance().getEntry(url).getData();
            CapabilityMap xmap = CapabilityMapFactory.getCapabilityMap(CapabilityMapFactory.AGENT_XML);

            // no cache yet // portlet.setContent( new JetspeedClearElement(content), xmap );
            InputSource isrc = new InputSource(this.cleanse(content));
            isrc.setSystemId(url);
            isrc.setEncoding("UTF-8");
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.