Package net.sf.jportlet.portlet.descriptor

Examples of net.sf.jportlet.portlet.descriptor.PortletDescriptor


                                PortletRequestImpl  portletRequest,
                                HttpServletResponse httpResponse )
    {
        super( httpResponse );

        PortletDescriptor descriptor = proxy.getDescriptor(  );
        _proxy           = proxy;
        _portletRequest  = portletRequest;
        _httpResponse    = httpResponse;
        _pathPrefix      = descriptor.getContextPath(  );
        _namespacePrefix = "_" + descriptor.getName(  ) + "_";
    }
View Full Code Here


        String  id = getId( proxy, request, response );

        if ( id != null )
        {
            PortletResponseImpl resp = ( PortletResponseImpl ) response;
            PortletDescriptor   descr = proxy.getDescriptor(  );
            CacheDescriptor     cache = descr.getCacheDescriptor( request.getMode(  ) );
            CacheRegion         region = getCacheService( proxy ).getRegion( descr.getName(  ), true );
            CacheableImpl       cacheable = new CacheableImpl( id, resp.getBuffer(  ).toString(  ), 1000 * cache.getExpires(  ) );

            if ( debug )
            {
                __log.debug( "Caching portlet content:" + id );
View Full Code Here

                         PortletRequest  request,
                         PortletResponse response )
    {
        /* No caching */
        StringBuffer      id = new StringBuffer(  );
        PortletDescriptor descr = proxy.getDescriptor(  );
        Portlet.Mode      mode = request.getMode(  );
        CacheDescriptor   cache = descr.getCacheDescriptor( mode );
        if ( ( cache == null ) || ( cache.getExpires(  ) == 0 ) )
        {
            return null;
        }

View Full Code Here

        assertNotNull( "app", app );
        assertEquals( "app.name", "Portlet Application", app.getName(  ) );
        assertEquals( "app.contextParameter[param1]", "value1", app.getContextParameter( "param1" ) );

        PortletDescriptor portlet = app.getPortletDescriptor( "portlet1" );
        assertNotNull( "portlet1 not found", portlet );
        assertEquals( "portlet.name", "portlet1", portlet.getName(  ) );
        assertEquals( "portlet.portletClass", PortletAdapter.class, portlet.getPortletClass(  ) );
        assertEquals( "portlet.actionListenerClass", ApplicationDescriptorLoaderTest.class, portlet.getActionListenerClass(  ) );
        assertEquals( "portlet.messageListenerClass", ApplicationDescriptorLoaderTest.class, portlet.getMessageListenerClass(  ) );
        assertEquals( "portlet.defaultLocale", Locale.ENGLISH.toString(  ), portlet.getDefaultLocale(  ) );
        assertEquals( "portlet.initParameter[param1]", "value1", portlet.getInitParameter( "param1" ) );

        /* Markup support */
        assertTrue( "portlet.supports(html,view)", portlet.supports( Portlet.Mode.VIEW, Portlet.Markup.HTML ) );
        assertTrue( "portlet.supports(html,edit)", portlet.supports( Portlet.Mode.EDIT, Portlet.Markup.HTML ) );
        assertTrue( "portlet.supports(html,help)", portlet.supports( Portlet.Mode.HELP, Portlet.Markup.HTML ) );
        assertTrue( "portlet.supports(html,configure)", portlet.supports( Portlet.Mode.CONFIGURE, Portlet.Markup.HTML ) );

        assertTrue( "portlet.supports(html,view)", portlet.supports( Portlet.Mode.VIEW, Portlet.Markup.WML ) );
        assertFalse( "portlet.supports(wml,edit)", portlet.supports( Portlet.Mode.EDIT, Portlet.Markup.WML ) );
        assertFalse( "portlet.supports(wml,help)", portlet.supports( Portlet.Mode.HELP, Portlet.Markup.WML ) );
        assertFalse( "portlet.supports(wml,configure)", portlet.supports( Portlet.Mode.CONFIGURE, Portlet.Markup.WML ) );

        /* Language */
        LanguageDescriptor lang = portlet.getLanguageDescriptor( Locale.ENGLISH );
        assertNotNull( "lang[en]", lang );
        assertEquals( "lang[en].title", "Portlet #1", lang.getTitle(  ) );
        assertEquals( "lang[en].titleShort", "P #1", lang.getTitleShort(  ) );
        assertEquals( "lang[en].description", "Description of Portlet #1", lang.getDescription(  ) );
        assertEquals( "lang[en].keywords", "test,portlet", lang.getKeywords(  ) );

        LanguageDescriptor lang2 = portlet.getLanguageDescriptor( new Locale( "en", "US" ) );
        assertNotNull( "lang[en_US]", lang );
        assertEquals( "lang[en] != lang[en_US]", lang, lang2 );

        lang = portlet.getLanguageDescriptor( Locale.FRENCH );
        assertNotNull( "lang[fr]", lang );
        assertEquals( "lang[fr].title", "Portlet No1", lang.getTitle(  ) );

        /* Cache */
        CacheDescriptor cache = portlet.getCacheDescriptor( Portlet.Mode.VIEW );
        assertNotNull( "cache[view]", cache );
        assertEquals( "cache[view].expires", 300, cache.getExpires(  ) );
        assertFalse( "cache[view].shared", cache.isShared(  ) );

        cache = portlet.getCacheDescriptor( Portlet.Mode.HELP );
        assertNotNull( "cache[help]", cache );
        assertEquals( "cache[help].expires", -1, cache.getExpires(  ) );
        assertTrue( "cache[help].shared", cache.isShared(  ) );

        /* auth */
        AuthConstraintDescriptor auth = portlet.getAuthConstraintDescriptor( Portlet.Mode.VIEW );
        assertNotNull( "auth[view]", auth );
        assertTrue( "auth[view].allowAnonymous", auth.isAllowAnonymous(  ) );
        assertTrue( "auth[view].role[author]", auth.containsRole( "author" ) );
        assertTrue( "auth[view].role[admin]", auth.containsRole( "admin" ) );

        auth = portlet.getAuthConstraintDescriptor( Portlet.Mode.CONFIGURE );
        assertNotNull( "auth[configure]", auth );
        assertFalse( "auth[configure].allowAnonymous", auth.isAllowAnonymous(  ) );
        assertFalse( "auth[configure].role[author]", auth.containsRole( "author" ) );
        assertTrue( "auth[configure].role[admin]", auth.containsRole( "admin" ) );
       
        WebflowActionDescriptor wf = portlet.getWebflowAction( "view" );
        assertNotNull( "webflow[view]", wf );
        assertEquals( "webflow[view].success", "/success.jsp", wf.getReturnURI("success"));
        assertEquals( "webflow[view].input", "/portlet/capital/mode/view/state/maximized", wf.getReturnURI("input"));
        assertNull( "webflow[view].???", wf.getReturnURI("???"));
       
        wf = portlet.getWebflowAction( "???" );
        assertNull( "webflow[???]", wf );
    }
View Full Code Here

        Iterator it = _descriptor.getPortletDescriptors(  ).iterator(  );

        while ( it.hasNext(  ) )
        {
            PortletDescriptor descr = ( PortletDescriptor ) it.next(  );
            PortletProxy      proxy = new PortletProxy( descr );
            String            name = descr.getName(  );

            if ( info )
            {
                __log.info( "Initializing Portlet: " + name );
            }
View Full Code Here

TOP

Related Classes of net.sf.jportlet.portlet.descriptor.PortletDescriptor

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.