Package org.apache.jetspeed.capability

Examples of org.apache.jetspeed.capability.CapabilityMap


     * @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

    /**
    */
    public ConcreteElement getContent( RunData rundata )
    {

        CapabilityMap map = ((JetspeedRunData)rundata).getCapability();
        ConcreteElement content = null;

        if ( MimeType.WML.equals( map.getPreferredType() ) )
        {
            content = getWMLContent( portlets, rundata );
        }
        else if ( MimeType.HTML.equals( map.getPreferredType() ) )
        {
            content = getHTMLContent( portlets, rundata );
        }
        else
        {
View Full Code Here

    */
    protected void setContent( ConcreteElement content,
                               CapabilityMap map )
                          throws IllegalArgumentException
    {
        CapabilityMap mymap = map;
        if ( mymap == null ) {
            mymap = CapabilityMapFactory.getDefaultCapabilityMap();
        }

        ConcreteElement buffer = new JetspeedClearElement( content.toString( ) );
        this.content.put( mymap.toString(), buffer );
    }
View Full Code Here

        return getContent( rundata, null , true );
    }

    public ConcreteElement getContent( RunData rundata, CapabilityMap map ) {
        CapabilityMap mymap = map;
        if ( mymap == null ) mymap = CapabilityMapFactory.getCapabilityMap( rundata );

        return (ConcreteElement)content.get( mymap.toString() );
    }
View Full Code Here

     */
    public ConcreteElement getContent( RunData rundata,
                                       CapabilityMap map,
                                       boolean allowRecurse ) {

        CapabilityMap mymap = map;
        if ( mymap == null ) mymap = CapabilityMapFactory.getCapabilityMap( rundata );

        ConcreteElement element = (ConcreteElement)content.get( mymap.toString() );

        if ( element == null ) {
            if ( allowRecurse ) {
                try {
                    // init will put content under default cmap
                    init( );
                    element = getContent( rundata, mymap, false );
                    if( element != null ) {
                        // now we put it under our cmap
                        this.setContent( element, mymap );
                    }
                } catch (Exception e) {
                    element = new JetspeedClearElement("Error when retrieving Portlet contents");
                    if( logger.isDebugEnabled() ) {
                        logger.debug( "Error when retrieving Portlet contents", e );
                    }
                }
            } else {
                if( element == null ) {
                    //FIXME: Let's asume that the contents under "default" map are good
                    mymap = CapabilityMapFactory.getDefaultCapabilityMap();
                    element = (ConcreteElement)content.get( mymap.toString() );
                    if( element == null ) {
                        element = new JetspeedClearElement("Unknown Problem getting Contents");
                    }
                }
            }
View Full Code Here

       @param rundata  RunData object from Turbine.
       @return ConcreteElement object, including the complete ECS code for rendering
       the page.
    */             
    public ConcreteElement getContent( RunData rundata ) {
        CapabilityMap cm = CapabilityMapFactory.getCapabilityMap( rundata );
        if ( cm.getPreferredType().equals( MimeType.HTML ) ) {
            return getHTMLContent( rundata );
        }
        if ( cm.getPreferredType().equals( MimeType.WML ) ) {
            return getWMLContent( rundata );
        }
        logger.error("The Given MIME-Type is not supportet for this control");
        return null;
    }
View Full Code Here

    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

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.