portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raph...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager PortletApplicationManager.java
Date Sat, 06 Dec 2003 23:24:04 GMT
raphael     2003/12/06 15:24:04

  Modified:    portal/src/java/org/apache/jetspeed/aggregator Tag:
                        aggregation_1-branch ContentDispatcher.java
                        PageAggregator.java
               portal/src/java/org/apache/jetspeed/aggregator/impl Tag:
                        aggregation_1-branch ContentDispatcherImpl.java
                        PortletRendererImpl.java
               portal/src/java/org/apache/jetspeed/container/invoker Tag:
                        aggregation_1-branch ServletPortletInvoker.java
               portal/src/java/org/apache/jetspeed/request Tag:
                        aggregation_1-branch JetspeedRequestContext.java
                        RequestContext.java
               portal/src/java/org/apache/jetspeed/tools/pamanager Tag:
                        aggregation_1-branch PortletApplicationManager.java
  Added:       portal/src/java/org/apache/jetspeed/layout Tag:
                        aggregation_1-branch MultiColumnPortlet.java
  Log:
  - add a layout portlet application to jetspeed webapp
  - fix ContentDispatcher so that it can be used within a Portlet JSP template
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.4   +9 -1      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/Attic/ContentDispatcher.java
  
  Index: ContentDispatcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/Attic/ContentDispatcher.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- ContentDispatcher.java	1 Dec 2003 22:57:14 -0000	1.1.2.3
  +++ ContentDispatcher.java	6 Dec 2003 23:24:03 -0000	1.1.2.4
  @@ -78,4 +78,12 @@
        * hold until it's completely rendered.
        */
       public void include(Fragment fragment, HttpServletRequest req, HttpServletResponse
rsp);
  +
  +    /**
  +     * Include in the provided PortletResponse output stream the rendered content
  +     * of the request fragment.
  +     * If the fragment rendered content is not yet available, the method will
  +     * hold until it's completely rendered.
  +     */
  +    public void include(Fragment fragment, javax.portlet.RenderRequest req, javax.portlet.RenderResponse
rsp);
   }
  
  
  
  1.1.2.4   +5 -3      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/Attic/PageAggregator.java
  
  Index: PageAggregator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/Attic/PageAggregator.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- PageAggregator.java	4 Dec 2003 20:34:11 -0000	1.1.2.3
  +++ PageAggregator.java	6 Dec 2003 23:24:03 -0000	1.1.2.4
  @@ -222,11 +222,12 @@
   
               ContentDispatcher dispatcher = renderer.getDispatcher(context,(strategy==STRATEGY_PARALLEL));
   
  -/*
               // Now synchronously trigger the rendering of the whole page
  +            log.debug("Triggering synchronous rendering..." + page.getRootFragment());
  +
               renderer.renderNow(page.getRootFragment(),context);
  -*/
   
  +/*
               // DEBUG Testing: Use ContentDispatcher to display all children
               // of root fragment
   
  @@ -239,6 +240,7 @@
                       dispatcher.include(f,context.getRequest(),context.getResponse());
                   }
               }
  +*/
           }
           else
           {
  
  
  
  No                   revision
  No                   revision
  1.1.2.5   +115 -10   jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/Attic/ContentDispatcherImpl.java
  
  Index: ContentDispatcherImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/Attic/ContentDispatcherImpl.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- ContentDispatcherImpl.java	4 Dec 2003 20:34:11 -0000	1.1.2.4
  +++ ContentDispatcherImpl.java	6 Dec 2003 23:24:03 -0000	1.1.2.5
  @@ -61,6 +61,8 @@
   import javax.servlet.ServletOutputStream;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
  +import javax.servlet.http.HttpServletRequestWrapper;
  +import javax.servlet.http.HttpServletResponseWrapper;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -90,7 +92,7 @@
   
       private boolean isParallel = true;
   
  -    private static boolean DEBUG = true;
  +    private static int debugLevel = 1;
   
       public ContentDispatcherImpl()
       {
  @@ -111,7 +113,7 @@
       {
           ObjectID oid = JetspeedObjectID.createFromString(fragment.getId());
   
  -        if (DEBUG && log.isDebugEnabled())
  +        if ((debugLevel > 1) && log.isDebugEnabled())
           {
               log.debug("Including content for OID "+ oid);
           }
  @@ -119,7 +121,7 @@
           // If we work synchronously, call Renderer.renderNow
           if (!isParallel)
           {
  -            if (DEBUG && log.isDebugEnabled())
  +            if ((debugLevel > 0) && log.isDebugEnabled())
               {
                   log.debug("Synchronous rendering for OID "+ oid);
               }
  @@ -136,7 +138,7 @@
               {
                   if (!content.isComplete())
                   {
  -                    if (DEBUG && log.isDebugEnabled())
  +                    if ((debugLevel > 0) && log.isDebugEnabled())
                       {
                           log.debug("Waiting for content OID "+oid);
                       }
  @@ -149,13 +151,13 @@
                       {
                       }
   
  -                    if (DEBUG && log.isDebugEnabled())
  +                    if ((debugLevel > 0) && log.isDebugEnabled())
                       {
                           log.debug("Been notified that OID "+oid+" is complete");
                       }
                   }
   
  -                if (DEBUG && log.isDebugEnabled())
  +                if ((debugLevel > 1) && log.isDebugEnabled())
                   {
                       log.debug("Content OID "+oid+": "+content.toString());
                   }
  @@ -165,7 +167,7 @@
               {
                   try
                   {
  -                    content.writeTo(rsp.getWriter());
  +                    rsp.getWriter().write(content.toString());
                   }
                   catch (IllegalStateException e)
                   {
  @@ -180,7 +182,7 @@
               {
                   synchronized(contents)
                   {
  -                    if (DEBUG && log.isDebugEnabled())
  +                    if ((debugLevel > 1) && log.isDebugEnabled())
                       {
                           log.debug("Removing content OID "+oid);
                       }
  @@ -190,10 +192,113 @@
           }
           else
           {
  -            if (DEBUG && log.isDebugEnabled())
  +            // should only happen when a layout tries to render an inner layout
  +            // trigger a synchronous rendering of this fragment
  +
  +            if ((debugLevel > 1) && log.isDebugEnabled())
               {
                   log.debug("Content is null for OID "+oid);
               }
  +
  +            PortletRenderer renderer = (PortletRenderer)CommonPortletServices.getPortalService(PortletRenderer.SERVICE_NAME);
  +            renderer.renderNow(fragment,req,rsp);
  +            return;
  +        }
  +    }
  +
  +    /**
  +     * Include in the provided PortletResponse output stream the rendered content
  +     * of the request fragment.
  +     * If the fragment rendered content is not yet available, the method will
  +     * hold until it's completely rendered.
  +     */
  +    public void include(Fragment fragment, javax.portlet.RenderRequest req, javax.portlet.RenderResponse
rsp)
  +    {
  +        ObjectID oid = JetspeedObjectID.createFromString(fragment.getId());
  +
  +        if ((debugLevel > 1) && log.isDebugEnabled())
  +        {
  +            log.debug("Including content for OID "+ oid);
  +        }
  +
  +        PortletContent content = (PortletContent)contents.get(oid);
  +
  +        if (content!=null)
  +        {
  +            synchronized (content)
  +            {
  +                if (!content.isComplete())
  +                {
  +                    if ((debugLevel > 0) && log.isDebugEnabled())
  +                    {
  +                        log.debug("Waiting for content OID "+oid);
  +                    }
  +
  +                    try
  +                    {
  +                        content.wait();
  +                    }
  +                    catch (InterruptedException e)
  +                    {
  +                    }
  +
  +                    if ((debugLevel > 0) && log.isDebugEnabled())
  +                    {
  +                        log.debug("Been notified that OID "+oid+" is complete");
  +                    }
  +                }
  +
  +                if ((debugLevel > 1) && log.isDebugEnabled())
  +                {
  +                    log.debug("Content OID "+oid+": "+content.toString());
  +                }
  +            }
  +
  +            try
  +            {
  +                try
  +                {
  +                    rsp.getWriter().write(content.toString());
  +                }
  +                catch (IllegalStateException e)
  +                {
  +                    //rsp.getPortletOutputStream().print(content.toString());
  +                }
  +            }
  +            catch (Exception e)
  +            {
  +                log.error("Unable to include content OID "+oid+" in response object", e);
  +            }
  +            finally
  +            {
  +                synchronized(contents)
  +                {
  +                    if ((debugLevel > 1) && log.isDebugEnabled())
  +                    {
  +                        log.debug("Removing content OID "+oid);
  +                    }
  +                    ((PortletContent)contents.remove(oid)).release();
  +                }
  +            }
  +        }
  +        else
  +        {
  +            // should only happen when a layout tries to render an inner layout
  +            // trigger a synchronous rendering of this fragment
  +
  +            if ((debugLevel > 1) && log.isDebugEnabled())
  +            {
  +                log.debug("Content is null for OID "+oid);
  +            }
  +
  +            PortletRenderer renderer = (PortletRenderer)CommonPortletServices.getPortalService(PortletRenderer.SERVICE_NAME);
  +
  +            //unwrap the RenderRequest and RenderResponse to avoid having to cascade several
  +            // portlet requests/responses
  +            HttpServletRequest request = (HttpServletRequest)((HttpServletRequestWrapper)req).getRequest();
  +            HttpServletResponse response = (HttpServletResponse)((HttpServletResponseWrapper)rsp).getResponse();
  +            renderer.renderNow(fragment,request,response);
  +            return;
           }
       }
   
  @@ -205,7 +310,7 @@
           {
               synchronized (content)
               {
  -                if (DEBUG && log.isDebugEnabled())
  +                if ((debugLevel > 0) && log.isDebugEnabled())
                   {
                       log.debug("Notifying complete OID "+oid);
                   }
  
  
  
  1.1.2.5   +11 -8     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/Attic/PortletRendererImpl.java
  
  Index: PortletRendererImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/aggregator/impl/Attic/PortletRendererImpl.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- PortletRendererImpl.java	1 Dec 2003 22:57:14 -0000	1.1.2.4
  +++ PortletRendererImpl.java	6 Dec 2003 23:24:03 -0000	1.1.2.5
  @@ -161,8 +161,10 @@
               servletRequest = request.getRequestForWindow(portletWindow);
               HttpServletResponse servletResponse = request.getResponseForWindow(portletWindow);
   
  -            servletRequest.setAttribute("page.fragment",fragment);
  +            servletRequest.setAttribute("org.apache.jetspeed.ContentDispatcher",getDispatcher(request,true));
  +            servletRequest.setAttribute("org.apache.jetspeed.Fragment",fragment);
   
  +            // should we decorate here instead of rendering Portlet ?
               container.renderPortlet(portletWindow, servletRequest, servletResponse);
           }
           catch (Throwable t)
  @@ -174,7 +176,8 @@
           {
               if (servletRequest!=null)
               {
  -                servletRequest.removeAttribute("page.fragment");
  +                servletRequest.removeAttribute("org.apache.jetspeed.ContentDispatcher");
  +                servletRequest.removeAttribute("org.apache.jetspeed.Fragment");
               }
           }
       }
  @@ -256,7 +259,8 @@
           HttpServletRequest servletRequest = request.getRequestForWindow(portletWindow);
           HttpServletResponse servletResponse = dispatcher.getResponseForWindow(portletWindow,
request);
   
  -        servletRequest.setAttribute("page.fragment",fragment);
  +        servletRequest.setAttribute("org.apache.jetspeed.ContentDispatcher",dispatcher);
  +        servletRequest.setAttribute("org.apache.jetspeed.Fragment",fragment);
   
           rJob.setWindow(portletWindow);
           rJob.setContainer(this.container);
  @@ -280,13 +284,12 @@
        */
       protected ContentDispatcherCtrl getDispatcherCtrl(RequestContext request, boolean isParallel)
       {
  -        if (request.getRequest().getAttribute("dispatcher")==null)
  +        if (request.getContentDispatcher()==null)
           {
  -            log.debug("Creating a new dispatcher and binding to request "+request.getRequest());
  -            request.getRequest().setAttribute("dispatcher",new ContentDispatcherImpl(isParallel));
  +            request.setContentDispatcher(new ContentDispatcherImpl(isParallel));
           }
   
  -        return (ContentDispatcherCtrl)request.getRequest().getAttribute("dispatcher");
  +        return (ContentDispatcherCtrl)request.getContentDispatcher();
       }
   
   }
  
  
  
  No                   revision
  No                   revision
  1.5.2.1   +10 -10    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvoker.java
  
  Index: ServletPortletInvoker.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/container/invoker/ServletPortletInvoker.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- ServletPortletInvoker.java	20 Oct 2003 03:47:06 -0000	1.5
  +++ ServletPortletInvoker.java	6 Dec 2003 23:24:03 -0000	1.5.2.1
  @@ -107,7 +107,7 @@
       }
   
       /**
  -     * 
  +     *
        * @param request
        * @param response
        * @throws PortletException
  @@ -118,7 +118,7 @@
       }
   
       /**
  -     * 
  +     *
        */
       public void action(ActionRequest request, ActionResponse response) throws PortletException,
IOException
       {
  @@ -126,7 +126,7 @@
       }
   
       /**
  -     * 
  +     *
        */
       public void load(PortletRequest request, RenderResponse response) throws PortletException
       {
  @@ -142,7 +142,7 @@
       }
   
       /**
  -     * 
  +     *
        * @param portletRequest
        * @param portletResponse
        * @param methodID
  @@ -205,11 +205,11 @@
           }
           finally
           {
  -            servletRequest.removeAttribute(ContainerConstants.METHOD_ID);
  -            servletRequest.removeAttribute(ContainerConstants.PORTLET_REQUEST);
  -            servletRequest.removeAttribute(ContainerConstants.PORTLET_RESPONSE);
  -            servletRequest.removeAttribute(ContainerConstants.PORTLET_CONFIG);
  -            servletRequest.removeAttribute(ContainerConstants.PORTLET_ENTITY);
  +            //servletRequest.removeAttribute(ContainerConstants.METHOD_ID);
  +            //servletRequest.removeAttribute(ContainerConstants.PORTLET_REQUEST);
  +            //servletRequest.removeAttribute(ContainerConstants.PORTLET_RESPONSE);
  +            //servletRequest.removeAttribute(ContainerConstants.PORTLET_CONFIG);
  +            //servletRequest.removeAttribute(ContainerConstants.PORTLET_ENTITY);
           }
       }
   
  
  
  
  No                   revision
  No                   revision
  1.1.2.1   +325 -0    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/layout/Attic/MultiColumnPortlet.java
  
  
  
  
  No                   revision
  No                   revision
  1.4.2.2   +13 -1     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java
  
  Index: JetspeedRequestContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContext.java,v
  retrieving revision 1.4.2.1
  retrieving revision 1.4.2.2
  diff -u -r1.4.2.1 -r1.4.2.2
  --- JetspeedRequestContext.java	1 Dec 2003 22:57:14 -0000	1.4.2.1
  +++ JetspeedRequestContext.java	6 Dec 2003 23:24:04 -0000	1.4.2.2
  @@ -58,6 +58,7 @@
   import javax.servlet.ServletConfig;
   
   import org.apache.jetspeed.PortalContext;
  +import org.apache.jetspeed.aggregator.ContentDispatcher;
   import org.apache.jetspeed.om.profile.Profile;
   import org.apache.jetspeed.om.page.Page;
   import org.apache.jetspeed.services.factory.FactoryManager;
  @@ -88,6 +89,7 @@
       private Profile profile;
       private Page page;
       private PortletDefinition portletDefinition;
  +    private ContentDispatcher dispatcher;
   
       private CapabilityMap capabilityMap;
       private String mimeType;
  @@ -185,6 +187,16 @@
       public void setPortletDefinition(PortletDefinition portletDefinition)
       {
           this.portletDefinition = portletDefinition;
  +    }
  +
  +    public ContentDispatcher getContentDispatcher()
  +    {
  +        return dispatcher;
  +    }
  +
  +    public void setContentDispatcher(ContentDispatcher dispatcher)
  +    {
  +        this.dispatcher = dispatcher;
       }
   
       /** Set the capabilityMap. Used by the CapabilityValve
  
  
  
  1.3.2.3   +16 -1     jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/RequestContext.java
  
  Index: RequestContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/request/RequestContext.java,v
  retrieving revision 1.3.2.2
  retrieving revision 1.3.2.3
  diff -u -r1.3.2.2 -r1.3.2.3
  --- RequestContext.java	1 Dec 2003 22:57:14 -0000	1.3.2.2
  +++ RequestContext.java	6 Dec 2003 23:24:04 -0000	1.3.2.3
  @@ -58,6 +58,7 @@
   import javax.servlet.http.HttpServletResponse;
   
   import org.apache.jetspeed.PortalContext;
  +import org.apache.jetspeed.aggregator.ContentDispatcher;
   import org.apache.jetspeed.capability.CapabilityMap;
   import org.apache.jetspeed.engine.core.PortalControlParameter;
   import org.apache.jetspeed.engine.core.PortalURL;
  @@ -133,6 +134,20 @@
        * @param page The target page
        */
       public void setPage(Page page);
  +
  +    /**
  +     * Gets the content dispatcher for this request
  +     *
  +     * @return ContentDispatcher
  +     */
  +    public ContentDispatcher getContentDispatcher();
  +
  +    /**
  +     * Sets the content dispatcher for this request
  +     *
  +     * @param dispatcher The ContentDispatcher to use for this request
  +     */
  +    public void setContentDispatcher(ContentDispatcher dispatcher);
   
       /**
        * Set the capabilityMap. Used by the CapabilityValve
  
  
  
  No                   revision
  No                   revision
  1.1.1.1.2.2 +2 -2      jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java
  
  Index: PortletApplicationManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/tools/pamanager/PortletApplicationManager.java,v
  retrieving revision 1.1.1.1.2.1
  retrieving revision 1.1.1.1.2.2
  diff -u -r1.1.1.1.2.1 -r1.1.1.1.2.2
  --- PortletApplicationManager.java	4 Dec 2003 23:06:20 -0000	1.1.1.1.2.1
  +++ PortletApplicationManager.java	6 Dec 2003 23:24:04 -0000	1.1.1.1.2.2
  @@ -324,7 +324,7 @@
           {
               System.out.println("Calling FileSystemPAM...");
   
  -            fs.deploy(webAppsDir, warFile, strPortletAppName, 1);
  +            fs.deploy(webAppsDir, warFile, strPortletAppName, 2);
           }
           catch (PortletApplicationException e)
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message