Package javax.portlet

Examples of javax.portlet.Portlet


                PortletWindow portletWindow = getPortletWindowAccessor().getPortletWindow( fragment );
                PortletDefinition pd = portletWindow.getPortletEntity().getPortletDefinition();
                if ( pd != null && getPortletFactory().isPortletApplicationRegistered((PortletApplication)pd.getPortletApplicationDefinition() ) )
                {
                    String portletApplicationContextPath = pd.getPortletApplicationDefinition().getWebApplicationDefinition().getContextRoot();
                    Portlet portlet = getPortletFactory().getPortletInstance( context.getConfig().getServletContext().getContext( portletApplicationContextPath ), pd ).getRealPortlet();           
                    if ( portlet != null && portlet instanceof SupportsHeaderPhase )
                    {
                        log.debug( "renderHeaderFragment: " + pd.getName() + " supports header phase" );
                       
                        HeaderResource hr = getHeaderResourceFactory().getHeaderResource( context, this.baseUrlAccess, isDesktop(), getHeaderConfiguration() );
View Full Code Here


      try
      {
//         log.debug("Loading portlet class " + className);
         Class portletClass = application.getContext().getClassLoader().loadClass(className);
//         log.debug("Creating portlet object " + className);
         Portlet portlet = (Portlet)portletClass.newInstance();
//         log.debug("Created portlet object " + className);
         initPortlet(portlet, config);
//         log.debug("Initialized portlet object " + className);

         // We are safe, update state
View Full Code Here

      try
      {
//         log.debug("Loading portlet class " + className);
         Class portletClass = application.getContext().getClassLoader().loadClass(className);
//         log.debug("Creating portlet object " + className);
         Portlet portlet = (Portlet)portletClass.newInstance();
//         log.debug("Created portlet object " + className);
         initPortlet(portlet, config);
//         log.debug("Initialized portlet object " + className);

         // We are safe, update state
View Full Code Here

      try
      {
         log.debug("Loading portlet class " + className);
         Class portletClass = application.getContext().getClassLoader().loadClass(className);
         log.debug("Creating portlet object " + className);
         Portlet portlet = (Portlet)portletClass.newInstance();
         log.debug("Created portlet object " + className);
         initPortlet(portlet, config);
         log.debug("Initialized portlet object " + className);

         // We are safe, update state
View Full Code Here

            log.error(message);
            throw new PortletException();
        }

       
        Portlet portlet = null;
       
        try
        {
            ClassLoader loader = (ClassLoader)classLoaders.get(portletApplicationName);           
            if (null == loader)
            {
                StringBuffer localPath = new StringBuffer("file:");
                localPath.append(jetspeedContext.getRealPath(JetspeedPortletContext.LOCAL_PA_ROOT));
                localPath.append(portletApplicationName);
                String localAppPath = localPath.toString();
                URL[] urls = {new URL(localAppPath + LOCAL_CLASSES),
                              new URL(localAppPath + LOCAL_JARS)};
                loader = new URLClassLoader(urls, oldLoader);
                classLoaders.put(portletApplicationName, loader);
            }
            Thread.currentThread().setContextClassLoader(loader);                
            portlet = JetspeedPortletFactoryProxy.getPortlet(jetspeedConfig, portletDefinition);           
        }
        catch (Exception e)
        {
            e.printStackTrace();
            return;
        }

        if (method == ContainerConstants.METHOD_NOOP)
        {
            return;
        }

        //res.getWriter().print("Rendering: Portlet Class = " + entity.getPortletClass() + "<BR/>");

        if (method == ContainerConstants.METHOD_ACTION)
        {
            ActionRequest actionRequest = (ActionRequest)portletRequest;           
            ActionResponse actionResponse = (ActionResponse)portletResponse;

            portlet.processAction(actionRequest, actionResponse);
        }
        else if (method == ContainerConstants.METHOD_RENDER)
        {
            RenderRequest renderRequest = (RenderRequest)portletRequest;           
            RenderResponse renderResponse = (RenderResponse)portletResponse;
           
            renderResponse.setContentType("text/html");           
            renderResponse.getWriter().print(portletDefinition.getName());

            portlet.render(renderRequest, renderResponse);
        }

        Thread.currentThread().setContextClassLoader(oldLoader);                

    }
View Full Code Here

        while (portletDefItr.hasNext())
        {
            PortletDefinition def = (PortletDefinition) portletDefItr.next();
            try
            {
                Portlet portlet = JetspeedPortletFactoryProxy.loadPortletClass(def.getClassName());
                assertNotNull("Could not load portlet class: "+def.getClassName(), portlet);
            }
            catch (Exception e)
            {
                assertNull("Unable to load registered portlet class, " + def.getClassName(), e);
View Full Code Here

     * @throws InstantiationException
     * @throws IllegalAccessException
     */
    public Portlet loadPortletClass( String className ) throws InstantiationException, IllegalAccessException
    {
        Portlet portlet = null;
        try
        {
            portlet = (Portlet)Thread.currentThread().getContextClassLoader().loadClass(className).newInstance();
        }
        catch (ClassCastException cce)
View Full Code Here

     * @return Portlet
     * @throws PortletException
     */
    public Portlet getPortlet( ServletConfig servletConfig, PortletDefinition portletDefinition ) throws PortletException
    {
        Portlet portlet = null;
        Class portletClass = null;
        String handle = null;
        String portletName = portletDefinition.getId().toString();
        //String portletName = portletDefinition.getName();
        String className = portletDefinition.getClassName();
        String paId = portletDefinition.getPortletApplicationDefinition().getWebApplicationDefinition().getId().toString();

        try
        {                       
            portlet = portletCache.get(portletName);
            if (null != portlet)
            {
               // ((PortletDefinitionCtrl) portletDefinition).setPortletClassLoader(portlet.getClass().getClassLoader());
                return portlet;
            }
           
            portlet = loadPortletClass(className);
           
            if(portlet == null)
            {
                throw new FileNotFoundException("Could not located portlet "+className+" in any classloader.");
            }
           
            ClassLoader cl = (ClassLoader) classLoaderMap.get(paId);
            if (cl != null)
            {
                ((PortletDefinitionCtrl) portletDefinition).setPortletClassLoader(cl);
            }
            else
            {
            ((PortletDefinitionCtrl) portletDefinition).setPortletClassLoader(portlet.getClass().getClassLoader());
            }
     
            ServletContext servletContext = servletConfig.getServletContext();
            PortletContext portletContext =
                        PortalAccessor.createPortletContext(servletContext,
                                                            portletDefinition.getPortletApplicationDefinition());           
            PortletConfig portletConfig = PortalAccessor.createPortletConfig(servletConfig, portletContext, portletDefinition);
           
            portlet.init(portletConfig);           
            portletCache.add(portletName, portlet);
           
        }
        catch (Throwable e)
        {
View Full Code Here

      try
      {
//         log.debug("Loading portlet class " + className);
         Class portletClass = application.getContext().getClassLoader().loadClass(className);
//         log.debug("Creating portlet object " + className);
         Portlet portlet = (Portlet)portletClass.newInstance();
//         log.debug("Created portlet object " + className);

         //
         this.portlet = portlet;
         this.config = config;
View Full Code Here

      try
      {
         log.debug("Loading portlet class " + className);
         Class portletClass = application.getContext().getClassLoader().loadClass(className);
         log.debug("Creating portlet object " + className);
         Portlet portlet = (Portlet)portletClass.newInstance();
         log.debug("Created portlet object " + className);
         initPortlet(portlet, config);
         log.debug("Initialized portlet object " + className);

         // We are safe, update state
View Full Code Here

TOP

Related Classes of javax.portlet.Portlet

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.