portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r463809 - in /portals/jetspeed-2/trunk: applications/demo/src/webapp/WEB-INF/ applications/gems/src/java/org/apache/portals/gems/dojo/ applications/gems/src/java/org/apache/portals/gems/googlemaps/ components/portal/src/java/org/apache/jets...
Date Fri, 13 Oct 2006 20:04:55 GMT
Author: taylor
Date: Fri Oct 13 13:04:54 2006
New Revision: 463809

URL: http://svn.apache.org/viewvc?view=rev&rev=463809
Log:
Refactoring of header component to use a Header phase, PortletHeaderRequest, PortletHeaderResponse
Establishes a header phase in processing of script-portlet frameworks 
the full refactoring out of the Header component string buffers is not completed

Added:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/HeaderAggregatorValve.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/HeaderAggregatorImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletHeaderRequestImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletHeaderResponseImpl.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/PortletHeaderRequest.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/PortletHeaderResponse.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/SupportsHeaderPhase.java
Modified:
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/jetspeed-portlet.xml
    portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/dojo/AbstractDojoVelocityPortlet.java
    portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/dojo/DojoSpringMVCPortlet.java
    portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/googlemaps/GoogleMapsPortlet.java
    portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/AbstractPortalContainerTestCase.java
    portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/aggregator/TestWorkerMonitor.java
    portals/jetspeed-2/trunk/components/portlet-factory/src/java/org/apache/jetspeed/factory/JetspeedPortletInstance.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletContent.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/factory/PortletInstance.java
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/aggregation.xml
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml

Modified: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/jetspeed-portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/jetspeed-portlet.xml?view=diff&rev=463809&r1=463808&r2=463809
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/jetspeed-portlet.xml (original)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/jetspeed-portlet.xml Fri Oct 13 13:04:54 2006
@@ -222,7 +222,6 @@
 
 	<js:services>
 	    <js:service name='SSO'/>
-        <js:service name='HeaderResource'/>           
 	</js:services>
 	
 </portlet-app>

Modified: portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/dojo/AbstractDojoVelocityPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/dojo/AbstractDojoVelocityPortlet.java?view=diff&rev=463809&r1=463808&r2=463809
==============================================================================
--- portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/dojo/AbstractDojoVelocityPortlet.java (original)
+++ portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/dojo/AbstractDojoVelocityPortlet.java Fri Oct 13 13:04:54 2006
@@ -15,23 +15,18 @@
  */
 package org.apache.portals.gems.dojo;
 
-import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
 import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.CommonPortletServices;
-import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.headerresource.HeaderResource;
-import org.apache.jetspeed.headerresource.HeaderResourceFactory;
-import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.portlet.PortletHeaderRequest;
+import org.apache.jetspeed.portlet.PortletHeaderResponse;
+import org.apache.jetspeed.portlet.SupportsHeaderPhase;
 import org.apache.portals.bridges.velocity.GenericVelocityPortlet;
-import org.apache.velocity.context.Context;
 
 /**
  * Abstract DOJO portlet for inserting in cross context dojo widget includes
@@ -39,7 +34,7 @@
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  * @version $Id: $
  */
-public abstract class AbstractDojoVelocityPortlet extends GenericVelocityPortlet 
+public abstract class AbstractDojoVelocityPortlet extends GenericVelocityPortlet implements SupportsHeaderPhase 
 {
     protected void includeDojoRequires(StringBuffer headerInfoText)
     {
@@ -60,11 +55,6 @@
     private final static Log log = LogFactory.getLog(AbstractDojoVelocityPortlet.class);
 
     /*
-     * Jetspeed header resource component
-     */
-    protected HeaderResourceFactory headerResourceFactoryComponent;
-
-    /*
      * Portlet constructor.
      */
     public AbstractDojoVelocityPortlet() 
@@ -73,65 +63,23 @@
     }
 
     /*
-     * Portlet lifecycle method.
-     */
-    public void init() throws PortletException 
-    {
-        super.init();
-
-        // access jetspeed heaader resource component
-        synchronized (this) 
-        {
-            if (headerResourceFactoryComponent == null) 
-            {
-                headerResourceFactoryComponent = (HeaderResourceFactory) 
-                    getPortletContext().getAttribute(CommonPortletServices.CPS_HEADER_RESOURCE_FACTORY);
-            }
-            if (headerResourceFactoryComponent == null) 
-            {
-                throw new PortletException("Failed to find the HeaderResourceFactoryComponent instance.");
-            }
-        }
-    }
-
-    /* (non-Javadoc)
-     * @see javax.portlet.GenericPortlet#doDispatch(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
-     */
-    protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, IOException 
-    {
-        // include header content
-        includeHeaderContent(request,response);
-
-        // dispatch normally
-        super.doDispatch(request, response);
-    }
-
-    /*
      * Include Dojo and Turbo header content using header resource component.
      *
      * @param request render request
      * @param response render response
-     */
-    protected void includeHeaderContent(RenderRequest request, RenderResponse response) 
+     */    
+    public void doHeader(PortletHeaderRequest request, PortletHeaderResponse response)
+    throws PortletException
     {
-        // get portal context path
-        RequestContext requestContext = (RequestContext) request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
-        String portalContextPath = requestContext.getRequest().getContextPath();
+        String portalContextPath = request.getPortalContextPath();
 
         // use header resource component to ensure header logic is included only once
-        HeaderResource headerResource = headerResourceFactoryComponent.getHeaderResouce(request);
+        HeaderResource headerResource = response.getHeaderResource();
         StringBuffer headerInfoText = new StringBuffer();
         Map headerInfoMap = null;
 
-        // detect jetspeed-desktop
-        String requestEncoder = (String)requestContext.getRequest().getParameter("encoder");
-
-        boolean isJetspeedDesktop = ((requestEncoder == null) || !requestEncoder.equals("desktop")) ? false : true;
-        Context velocityContext = getContext(request);
-        velocityContext.put("isJetspeedDesktop", new Boolean( isJetspeedDesktop ) );
-
         // add dojo if not already in use as desktop
-        if (!isJetspeedDesktop) 
+        if (!request.isDesktopEncoder()) 
         {
             // dojo configuration
             headerInfoText.setLength(0);
@@ -165,7 +113,7 @@
         }
         
         // close DOJO if not already in use as desktop
-        if (!isJetspeedDesktop) 
+        if (!request.isDesktopEncoder()) 
         {
             // complete DoJo includes
             headerInfoText.setLength(0);
@@ -178,7 +126,7 @@
         }
 
         // add jetspeed widget package if not already in use as desktop
-        if (!isJetspeedDesktop) 
+        if (!request.isDesktopEncoder()) 
         {
             headerInfoText.setLength(0);
             headerInfoText.append("\r\n");
@@ -189,7 +137,7 @@
             headerResource.addHeaderInfo("script", headerInfoMap, headerInfoText.toString());
         }
         
-        if (!isJetspeedDesktop)
+        if (!request.isDesktopEncoder()) 
         {
             headerInfoText.setLength(0);
             headerInfoText.append("\r\n");

Modified: portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/dojo/DojoSpringMVCPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/dojo/DojoSpringMVCPortlet.java?view=diff&rev=463809&r1=463808&r2=463809
==============================================================================
--- portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/dojo/DojoSpringMVCPortlet.java (original)
+++ portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/dojo/DojoSpringMVCPortlet.java Fri Oct 13 13:04:54 2006
@@ -16,7 +16,6 @@
 package org.apache.portals.gems.dojo;
 
 import java.io.BufferedReader;
-import java.io.IOException;
 import java.io.StringReader;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -34,11 +33,10 @@
 import org.apache.commons.lang.ObjectUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.CommonPortletServices;
-import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.headerresource.HeaderResource;
-import org.apache.jetspeed.headerresource.HeaderResourceFactory;
-import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.portlet.PortletHeaderRequest;
+import org.apache.jetspeed.portlet.PortletHeaderResponse;
+import org.apache.jetspeed.portlet.SupportsHeaderPhase;
 import org.apache.pluto.core.impl.RenderRequestImpl;
 import org.apache.pluto.core.impl.RenderResponseImpl;
 import org.apache.portals.gems.util.HttpBufferedResponse;
@@ -54,12 +52,27 @@
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a> 
  * @version $Id: $
  */
-public class DojoSpringMVCPortlet extends DispatcherPortlet
+public class DojoSpringMVCPortlet extends DispatcherPortlet implements SupportsHeaderPhase
 {
 	protected static final String CRLF = "\r\n";
-	
-    protected void includeDojoConfig(RenderRequest request, RenderResponse response, String portalContextPath, StringBuffer headerInfoText)
-		throws PortletException, java.io.IOException
+
+    /*
+     * Class specific logger.
+     */
+    private final static Log log = LogFactory.getLog(DojoSpringMVCPortlet.class);
+
+    protected String headerPage;
+    
+    /*
+     * Portlet constructor.
+     */
+    public DojoSpringMVCPortlet() 
+    {
+        super();
+    }
+    
+    protected void includeDojoConfig(PortletHeaderRequest request, PortletHeaderResponse response, String portalContextPath, StringBuffer headerInfoText)
+		throws PortletException
 	{	
     	headerInfoText.append( "var djConfig = { " );
     	headerInfoText.append( "isDebug: true, debugAtAllCosts: false" );
@@ -74,32 +87,32 @@
     	return portalContextPath + "/javascript/dojo/dojo.js";
     }
 	
-    protected void includeDojoRequires(RenderRequest request, RenderResponse response, StringBuffer headerInfoText)
-    	throws PortletException, java.io.IOException
+    protected void includeDojoRequires(PortletHeaderRequest request, PortletHeaderResponse response, StringBuffer headerInfoText)
+    	throws PortletException
     {
     	if ( this.headerPage != null )
     	{
     		include( request, response, this.headerPage, headerInfoText );
     	}
     }
-    protected void includeDojoWidgetRequires(RenderRequest request, RenderResponse response, StringBuffer headerInfoText)
-        throws PortletException, java.io.IOException
+    protected void includeDojoWidgetRequires(PortletHeaderRequest request, PortletHeaderResponse response, StringBuffer headerInfoText)
+        throws PortletException
     {
 
     }
-    protected void includeDojoCustomWidgetRequires(RenderRequest request, RenderResponse response, StringBuffer headerInfoText)
-        throws PortletException, java.io.IOException
+    protected void includeDojoCustomWidgetRequires(PortletHeaderRequest request, PortletHeaderResponse response, StringBuffer headerInfoText)
+        throws PortletException
     {
         
     }
     
-    protected void includeDojoWriteIncludes(RenderRequest request, RenderResponse response, StringBuffer headerInfoText)
-        throws PortletException, java.io.IOException
+    protected void includeDojoWriteIncludes(PortletHeaderRequest request, PortletHeaderResponse response, StringBuffer headerInfoText)
+        throws PortletException
     {
     	headerInfoText.append( "dojo.hostenv.writeIncludes();" ).append( CRLF );
     }
-    protected void includeDojoRegisterWidgetPackage(RenderRequest request, RenderResponse response, StringBuffer headerInfoText)
-        throws PortletException, java.io.IOException
+    protected void includeDojoRegisterWidgetPackage(PortletHeaderRequest request, PortletHeaderResponse response, StringBuffer headerInfoText)
+        throws PortletException
     {
         headerInfoText.append( "dojo.widget.manager.registerWidgetPackage('jetspeed.ui.widget');" ).append( CRLF );
     }
@@ -134,25 +147,6 @@
     }
     
     
-    /*
-     * Class specific logger.
-     */
-    private final static Log log = LogFactory.getLog(DojoSpringMVCPortlet.class);
-
-    /*
-     * Jetspeed header resource component
-     */
-    protected HeaderResourceFactory headerResourceFactoryComponent;
-
-    protected String headerPage;
-    
-    /*
-     * Portlet constructor.
-     */
-    public DojoSpringMVCPortlet() 
-    {
-        super();
-    }
 
     /*
      * Portlet lifecycle method.
@@ -164,15 +158,6 @@
         // access jetspeed heaader resource component
         synchronized (this) 
         {
-            if (headerResourceFactoryComponent == null) 
-            {
-                headerResourceFactoryComponent = (HeaderResourceFactory) 
-                    getPortletContext().getAttribute(CommonPortletServices.CPS_HEADER_RESOURCE_FACTORY);
-            }
-            if (headerResourceFactoryComponent == null) 
-            {
-                throw new PortletException("Failed to find the HeaderResourceFactoryComponent instance.");
-            }
             this.headerPage = this.getInitParameter("HeaderPage");
         }
     }
@@ -182,9 +167,6 @@
      */
     protected void doRenderService(RenderRequest request, RenderResponse response) throws Exception
     {
-        // include header content
-        doHeader(request,response);
-
         // dispatch normally
         super.doRenderService(request, response);
     }
@@ -195,24 +177,19 @@
      * @param request render request
      * @param response render response
      */    
-    protected void doHeader(RenderRequest request, RenderResponse response)
-    throws PortletException, java.io.IOException
+    public void doHeader(PortletHeaderRequest request, PortletHeaderResponse response)    
+    throws PortletException
     {
-        // get portal context path
-        RequestContext requestContext = (RequestContext) request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
-        String portalContextPath = requestContext.getRequest().getContextPath();
+        String portalContextPath = request.getPortalContextPath();
 
         // use header resource component to ensure header logic is included only once
-        HeaderResource headerResource = headerResourceFactoryComponent.getHeaderResouce(request);
+        HeaderResource headerResource = response.getHeaderResource();
         StringBuffer headerInfoText = new StringBuffer();
         Map headerInfoMap = null;
-
-        // detect jetspeed-desktop
-        String requestEncoder = (String)requestContext.getRequest().getParameter("encoder");
-
-        boolean isJetspeedDesktop = ((requestEncoder == null) || !requestEncoder.equals("desktop")) ? false : true;
-
+        boolean isJetspeedDesktop = request.isDesktopEncoder();
         boolean addedDojoRequires = false;
+        
+        
         // add dojo if not already in use as desktop
         if (!isJetspeedDesktop) 
         {
@@ -279,55 +256,10 @@
     }
     
     
-    public void include(RenderRequest request, RenderResponse response, String headerPagePath, StringBuffer headerText) throws PortletException, java.io.IOException
+    public void include(PortletHeaderRequest request, PortletHeaderResponse response, String headerPagePath, StringBuffer headerText) throws PortletException
     {
-        HttpServletRequest servletRequest = null;
-        HttpServletResponse servletResponse = null;
-        try
-        {
-            servletRequest = (HttpServletRequest) ((RenderRequestImpl) request).getRequest();
-            servletResponse = (HttpServletResponse) ((RenderResponseImpl) response).getResponse();
-
-            PortletContentImpl content = new PortletContentImpl();
-            content.init();
-            HttpBufferedResponse bufferedResponse = 
-                new HttpBufferedResponse(servletResponse, content.getWriter());
-            
-            RequestDispatcher dispatcher = servletRequest.getRequestDispatcher(headerPagePath);
-            System.out.println("dispatcher:" + dispatcher);
-            if (dispatcher != null)
-                dispatcher.include(servletRequest, bufferedResponse);
-            
-            bufferedResponse.flushBuffer();
-            BufferedReader reader = new BufferedReader(new StringReader(content.getContent()));
-            String buffer;
-            while ((buffer = reader.readLine()) != null)
-            {
-            	headerText.append( buffer ).append( "\r\n" );
-            }
-            //System.out.println("dispatched:" + content.getContent());
-        }
-        catch (RuntimeException re)
-        {
-            throw re;
-        }
-        catch (IOException ioe)
-        {
-            throw ioe;
-        }
-        catch (Exception e)
-        {
-            Throwable rootCause = null;
-            if ( e instanceof ServletException)
-            {
-                rootCause = ((ServletException)e).getRootCause();
-            }
-            else
-            {
-                rootCause = e.getCause();
-            }
-            throw new PortletException(rootCause != null ? rootCause : e);
-        }
+        response.include(request, response, headerPagePath);
+        headerText.append(response.getContent());
     }
 
 

Modified: portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/googlemaps/GoogleMapsPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/googlemaps/GoogleMapsPortlet.java?view=diff&rev=463809&r1=463808&r2=463809
==============================================================================
--- portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/googlemaps/GoogleMapsPortlet.java (original)
+++ portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/googlemaps/GoogleMapsPortlet.java Fri Oct 13 13:04:54 2006
@@ -24,16 +24,10 @@
 import javax.portlet.ActionResponse;
 import javax.portlet.PortletException;
 import javax.portlet.PortletPreferences;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
 
-import org.apache.jetspeed.CommonPortletServices;
-import org.apache.jetspeed.PortalReservedParameters;
-import org.apache.jetspeed.headerresource.HeaderResource;
-import org.apache.jetspeed.headerresource.HeaderResourceFactory;
-import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.portlet.PortletHeaderRequest;
+import org.apache.jetspeed.portlet.PortletHeaderResponse;
 import org.apache.portals.gems.dojo.AbstractDojoVelocityPortlet;
-import org.apache.velocity.context.Context;
 /**
  * This is a simple class used to override processAction
  * to save location form submission value to location preference
@@ -66,52 +60,31 @@
 	preferences.store();
     }
     
-    protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, IOException 
+    public void doHeader(PortletHeaderRequest request, PortletHeaderResponse response)
+    throws PortletException
     {
-        // include header content
-        includeHeaderContent(request,response);
-
-        // dispatch normally
-        super.doDispatch(request, response);
-    }
-
-    protected void includeHeaderContent(RenderRequest request, RenderResponse response) 
-    {
-        // get portal context path
-        RequestContext requestContext = (RequestContext) request.getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
-        String portalContextPath = requestContext.getRequest().getContextPath();
-
-        // use header resource component to ensure header logic is included only once
-        HeaderResource headerResource = headerResourceFactoryComponent.getHeaderResouce(request);
         StringBuffer headerInfoText = new StringBuffer();
         Map headerInfoMap = null;
-
-        // detect jetspeed-desktop
-        String requestEncoder = (String)requestContext.getRequest().getParameter("encoder");
-
-        boolean isJetspeedDesktop = ((requestEncoder == null) || !requestEncoder.equals("desktop")) ? false : true;
-        Context velocityContext = getContext(request);
-        velocityContext.put("isJetspeedDesktop", new Boolean( isJetspeedDesktop ) );
         
         // close DOJO if not already in use as desktop
-        if (!isJetspeedDesktop) 
+        if (!request.isDesktopEncoder()) 
         {
             // complete DoJo includes
             headerInfoText.setLength(0);
             headerInfoMap = new HashMap(8);
-            headerInfoMap.put("language", "JavaScript");
+            headerInfoMap.put("language", "JavaScript");            
             headerInfoMap.put("src", "http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAisHr-hr7f_yfo_m3teTC5RQXGaCFRGWXJQavRKQcb1Ew_fwkKRQ26QnpXVIkxSMwwTECWDV23ZDaLQ");
             headerInfoMap.put("type", "text/javascript");
-            headerResource.addHeaderInfo("script", headerInfoMap, headerInfoText.toString());
+            response.getHeaderResource().addHeaderInfo("script", headerInfoMap, headerInfoText.toString());
         }
-        super.includeHeaderContent(request, response);
+        super.doHeader(request, response);
     }
     
     protected void includeDojoRequires(StringBuffer headerInfoText)
     {
         appendHeaderText(headerInfoText, "dojo.lang.*");
         appendHeaderText(headerInfoText, "dojo.event.*");
-        appendHeaderText(headerInfoText, "dojo.io");             
+        appendHeaderText(headerInfoText, "dojo.io.*");             
     }    
         
 }

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/HeaderAggregatorValve.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/HeaderAggregatorValve.java?view=auto&rev=463809
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/HeaderAggregatorValve.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/HeaderAggregatorValve.java Fri Oct 13 13:04:54 2006
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jetspeed.aggregator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.pipeline.PipelineException;
+import org.apache.jetspeed.pipeline.valve.AbstractValve;
+import org.apache.jetspeed.pipeline.valve.ValveContext;
+import org.apache.jetspeed.request.RequestContext;
+
+/**
+ * Invokes the header aggregator service in the request pipeline
+ *
+ * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class HeaderAggregatorValve
+       extends AbstractValve
+{
+    private static final Log log = LogFactory.getLog(HeaderAggregatorValve.class);
+    private Aggregator aggregator;
+    
+    public HeaderAggregatorValve(Aggregator aggregator)
+    {
+        this.aggregator = aggregator;
+    }
+        
+    public void invoke( RequestContext request, ValveContext context )
+        throws PipelineException
+    {
+        try
+        {
+            aggregator.build(request);
+        }
+        catch (Exception e)
+        {
+            throw new PipelineException(e.toString(), e);
+        }
+        // Pass control to the next Valve in the Pipeline
+        context.invokeNext( request );
+    }
+
+    public String toString()
+    {
+        return "HeaderAggregatorValve";
+    }
+}
\ No newline at end of file

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/HeaderAggregatorImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/HeaderAggregatorImpl.java?view=auto&rev=463809
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/HeaderAggregatorImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/HeaderAggregatorImpl.java Fri Oct 13 13:04:54 2006
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.aggregator.impl;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.portlet.Portlet;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.aggregator.FailedToRenderFragmentException;
+import org.apache.jetspeed.aggregator.PageAggregator;
+import org.apache.jetspeed.container.state.NavigationalState;
+import org.apache.jetspeed.container.window.PortletWindowAccessor;
+import org.apache.jetspeed.exception.JetspeedException;
+import org.apache.jetspeed.factory.PortletFactory;
+import org.apache.jetspeed.headerresource.HeaderResource;
+import org.apache.jetspeed.headerresource.HeaderResourceFactory;
+import org.apache.jetspeed.om.page.ContentFragment;
+import org.apache.jetspeed.om.page.ContentPage;
+import org.apache.jetspeed.portlet.PortletHeaderRequest;
+import org.apache.jetspeed.portlet.PortletHeaderResponse;
+import org.apache.jetspeed.portlet.SupportsHeaderPhase;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.om.portlet.PortletDefinition;
+import org.apache.pluto.om.window.PortletWindow;
+
+/**
+ * HeaderAggregator builds the content required to render a page of portlets.
+ * 
+ * @author <a href="mailto:raphael@apache.org">Rapha�l Luta </a>
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
+ * @version $Id: PageAggregatorImpl.java 359125 2005-12-26 23:16:39Z rwatler $
+ */
+public class HeaderAggregatorImpl implements PageAggregator
+{
+    private final static Log log = LogFactory.getLog(HeaderAggregatorImpl.class);
+
+    private PortletFactory factory;
+    private PortletWindowAccessor windowAccessor;
+    private HeaderResourceFactory headerResourceFactory;
+    
+    public HeaderAggregatorImpl(PortletFactory factory, PortletWindowAccessor windowAccessor, HeaderResourceFactory headerResourceFactory)
+    {
+        this.factory = factory;
+        this.windowAccessor = windowAccessor;
+        this.headerResourceFactory = headerResourceFactory;
+    }
+
+    /**
+     * Builds the portlet set defined in the context into a portlet tree.
+     * 
+     * @return Unique Portlet Entity ID
+     */
+    public void build( RequestContext context ) throws JetspeedException, IOException
+    {
+        ContentPage page = context.getPage();
+        if (null == page)
+        {
+            throw new JetspeedException("Failed to find PSML Pin ContentPageAggregator.build");
+        }
+
+        ContentFragment root = page.getRootContentFragment();
+
+        if (root == null)
+        {
+            throw new JetspeedException("No root ContentFragment found in ContentPage");
+        }
+
+        // handle maximized state
+        NavigationalState nav = context.getPortalURL().getNavigationalState();
+        PortletWindow window = nav.getMaximizedWindow();
+        if (null != window)
+        {
+            ContentFragment maxedContentFragment = page.getContentFragmentById(window.getId().toString());
+            if (maxedContentFragment != null)
+            {
+                renderHeaderFragment(context, maxedContentFragment);
+            }
+        }
+        else
+        {
+            aggregateAndRender(root, context, page);
+        }
+        
+    }
+
+    protected void aggregateAndRender( ContentFragment fragment, RequestContext context, ContentPage page )
+            throws FailedToRenderFragmentException
+    {
+
+        if (fragment.getContentFragments() != null && fragment.getContentFragments().size() > 0)
+        {
+            Iterator children = fragment.getContentFragments().iterator();
+            while (children.hasNext())
+            {
+                ContentFragment child = (ContentFragment) children.next();
+                if (!"hidden".equals(fragment.getState()))
+                {
+                    aggregateAndRender(child, context, page);
+                }
+            }
+        }
+        renderHeaderFragment(context, fragment);
+    }
+    
+    protected void renderHeaderFragment(RequestContext context, ContentFragment fragment)
+    {
+        try
+        {
+            PortletWindow portletWindow = windowAccessor.getPortletWindow(fragment);
+            PortletDefinition pd = portletWindow.getPortletEntity().getPortletDefinition();
+            //portletWindow.getPortletEntity().getPreferenceSet().get
+            String portletApplicationContextPath = pd.getPortletApplicationDefinition().getWebApplicationDefinition().getContextRoot();
+            Portlet portlet = factory.getPortletInstance(context.getConfig().getServletContext().getContext(portletApplicationContextPath), pd).getRealPortlet();            
+            if (portlet instanceof SupportsHeaderPhase)
+            {
+                System.out.println("HEADER AGGREGATOR: supports header phase: " + pd.getName());
+                
+                HeaderResource hr = headerResourceFactory.getHeaderResouce(context);
+                PortletHeaderRequest headerRequest = new PortletHeaderRequestImpl(context, portletWindow, portletApplicationContextPath);                
+                PortletHeaderResponse headerResponse = new PortletHeaderResponseImpl(context, hr);
+                ((SupportsHeaderPhase)portlet).doHeader(headerRequest, headerResponse);                
+            }
+        }
+        catch (Exception e)
+        {
+            log.equals(e);
+        }
+        
+    }
+    
+    
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletHeaderRequestImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletHeaderRequestImpl.java?view=auto&rev=463809
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletHeaderRequestImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletHeaderRequestImpl.java Fri Oct 13 13:04:54 2006
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.aggregator.impl;
+
+import javax.portlet.PortletPreferences;
+
+import org.apache.jetspeed.portlet.PortletHeaderRequest;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.core.impl.PortletPreferencesImpl;
+import org.apache.pluto.om.window.PortletWindow;
+
+
+public class PortletHeaderRequestImpl implements PortletHeaderRequest
+{
+    private RequestContext requestContext;
+    private String portletApplicationContextPath;
+    private PortletWindow portletWindow;
+    
+    public PortletHeaderRequestImpl(RequestContext requestContext, PortletWindow portletWindow, String portletApplicationContextPath)
+    {
+        this.requestContext = requestContext;
+        this.portletApplicationContextPath = portletApplicationContextPath;
+        this.portletWindow = portletWindow;
+    }
+    
+    public String getPortalContextPath()
+    {
+        return requestContext.getRequest().getContextPath();
+    }
+    
+    public boolean isDesktopEncoder()
+    {
+        String requestEncoder = (String)requestContext.getRequest().getParameter("encoder");
+        return((requestEncoder == null) || !requestEncoder.equals("desktop")) ? false : true;
+    }
+    
+    
+    public PortletPreferences getPreferences()
+    {
+        return new PortletPreferencesImpl(org.apache.pluto.Constants.METHOD_NOOP, this.portletWindow.getPortletEntity());
+    }
+
+    
+    /**
+     * @return Returns the portletApplicationContextPath.
+     */
+    public String getPortletApplicationContextPath()
+    {
+        return portletApplicationContextPath;
+    }
+    
+}

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletHeaderResponseImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletHeaderResponseImpl.java?view=auto&rev=463809
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletHeaderResponseImpl.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletHeaderResponseImpl.java Fri Oct 13 13:04:54 2006
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2000-2001,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.aggregator.impl;
+
+import java.io.BufferedReader;
+import java.io.StringReader;
+
+import javax.portlet.PortletException;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.jetspeed.aggregator.PortletContent;
+import org.apache.jetspeed.headerresource.HeaderResource;
+import org.apache.jetspeed.portlet.PortletHeaderRequest;
+import org.apache.jetspeed.portlet.PortletHeaderResponse;
+import org.apache.jetspeed.request.RequestContext;
+
+
+public class PortletHeaderResponseImpl implements PortletHeaderResponse
+{
+    private RequestContext requestContext;
+    private HeaderResource hr;
+    private String tempContent;
+    
+    public PortletHeaderResponseImpl(RequestContext requestContext, HeaderResource hr)
+    {
+        this.requestContext = requestContext;
+        this.hr = hr;
+    }
+
+    public HeaderResource getHeaderResource()
+    {
+        return this.hr;
+    }
+    
+    public String getContent()
+    {
+        return tempContent; 
+    }
+    
+    public void include(PortletHeaderRequest request, PortletHeaderResponse response, String headerResource)
+    throws PortletException
+    {
+        try
+        {
+            HttpServletRequest servletRequest = requestContext.getRequest();
+            HttpServletResponse servletResponse = requestContext.getResponse();
+            PortletContent content = new PortletContentImpl();
+            HttpBufferedResponse bufferedResponse = 
+                new HttpBufferedResponse(servletResponse, content.getWriter());
+            ServletContext crossContext = requestContext.getConfig().getServletContext().getContext(request.getPortletApplicationContextPath());            
+            RequestDispatcher dispatcher = crossContext.getRequestDispatcher(headerResource);
+            if (dispatcher != null)
+                dispatcher.include(servletRequest, bufferedResponse);            
+            bufferedResponse.flushBuffer();
+            BufferedReader reader = new BufferedReader(new StringReader(content.getContent()));
+            String buffer;
+            StringBuffer headerText = new StringBuffer();
+            while ((buffer = reader.readLine()) != null)
+            {
+                headerText.append( buffer ).append( "\r\n" );
+            }
+            tempContent = headerText.toString();            
+        }
+        catch (Exception e)
+        {
+            throw new PortletException(e);
+        }
+    }
+}

Modified: portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/AbstractPortalContainerTestCase.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/AbstractPortalContainerTestCase.java?view=diff&rev=463809&r1=463808&r2=463809
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/AbstractPortalContainerTestCase.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/AbstractPortalContainerTestCase.java Fri Oct 13 13:04:54 2006
@@ -16,7 +16,6 @@
 package org.apache.jetspeed;
 
 
-import org.apache.jetspeed.components.util.RegistrySupportedTestCase;
 import org.apache.jetspeed.container.window.PortletWindowAccessor;
 import org.apache.jetspeed.container.window.impl.PortletWindowAccessorImpl;
 import org.apache.pluto.PortletContainer;

Modified: portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/aggregator/TestWorkerMonitor.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/aggregator/TestWorkerMonitor.java?view=diff&rev=463809&r1=463808&r2=463809
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/aggregator/TestWorkerMonitor.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/test/org/apache/jetspeed/aggregator/TestWorkerMonitor.java Fri Oct 13 13:04:54 2006
@@ -22,12 +22,7 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
-import org.apache.jetspeed.aggregator.impl.ContentServerAdapterImpl;
-import org.apache.jetspeed.aggregator.impl.PageAggregatorImpl;
-import org.apache.jetspeed.aggregator.impl.PortletAggregatorImpl;
 import org.apache.jetspeed.aggregator.impl.WorkerMonitorImpl;
-import org.apache.jetspeed.headerresource.HeaderResourceFactory;
-import org.apache.jetspeed.headerresource.impl.HeaderResourceFactoryImpl;
 import org.apache.jetspeed.om.window.impl.PortletWindowImpl;
 import org.apache.pluto.om.window.PortletWindow;
 

Modified: portals/jetspeed-2/trunk/components/portlet-factory/src/java/org/apache/jetspeed/factory/JetspeedPortletInstance.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portlet-factory/src/java/org/apache/jetspeed/factory/JetspeedPortletInstance.java?view=diff&rev=463809&r1=463808&r2=463809
==============================================================================
--- portals/jetspeed-2/trunk/components/portlet-factory/src/java/org/apache/jetspeed/factory/JetspeedPortletInstance.java (original)
+++ portals/jetspeed-2/trunk/components/portlet-factory/src/java/org/apache/jetspeed/factory/JetspeedPortletInstance.java Fri Oct 13 13:04:54 2006
@@ -106,4 +106,13 @@
   {
       return portlet.toString();
   }
+
+
+/**
+ * @return Returns the portlet.
+ */
+public Portlet getRealPortlet()
+{
+    return portlet;
+}
 }

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletContent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletContent.java?view=diff&rev=463809&r1=463808&r2=463809
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletContent.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/aggregator/PortletContent.java Fri Oct 13 13:04:54 2006
@@ -6,6 +6,8 @@
  */
 package org.apache.jetspeed.aggregator;
 
+import java.io.PrintWriter;
+
 /**
  * <p>
  * PortletContent
@@ -24,4 +26,6 @@
     boolean isComplete();
     
     void complete();
+    
+    PrintWriter getWriter();
 }

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/factory/PortletInstance.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/factory/PortletInstance.java?view=diff&rev=463809&r1=463808&r2=463809
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/factory/PortletInstance.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/factory/PortletInstance.java Fri Oct 13 13:04:54 2006
@@ -28,4 +28,5 @@
 public interface PortletInstance extends Portlet
 {
     PortletConfig getConfig();
+    Portlet getRealPortlet();
 }

Added: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/PortletHeaderRequest.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/PortletHeaderRequest.java?view=auto&rev=463809
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/PortletHeaderRequest.java (added)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/PortletHeaderRequest.java Fri Oct 13 13:04:54 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlet;
+
+import javax.portlet.PortletPreferences;
+
+public interface PortletHeaderRequest
+{    
+    /**
+     * Returns the web context path for the portal  
+     * @return the portal context path, for example "/jetspeed"
+     */
+    String getPortalContextPath();
+    
+    /**
+     * Returns the portlet applicatoin context path 
+     * 
+     * @return
+     */
+    String getPortletApplicationContextPath();
+    
+    /**
+     * Get the portlet preferences
+     */
+    PortletPreferences getPreferences();
+    
+    /**
+     * Determine if its a /desktop encoder
+     * @return true if its a /desktop encoder, false if /portal encoder
+     */
+    boolean isDesktopEncoder();
+    
+}

Added: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/PortletHeaderResponse.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/PortletHeaderResponse.java?view=auto&rev=463809
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/PortletHeaderResponse.java (added)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/PortletHeaderResponse.java Fri Oct 13 13:04:54 2006
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlet;
+
+import java.io.Writer;
+
+import javax.portlet.PortletException;
+
+import org.apache.jetspeed.headerresource.HeaderResource;
+
+
+public interface PortletHeaderResponse
+{    
+    /**
+     * Retrieves the header resource for this request
+     * @return a per request HeaderResource
+     */
+    HeaderResource getHeaderResource();
+    
+    /**
+     * Temporary solution: get the content after calling include
+     * this will be deprecated
+     * 
+     */
+    String getContent();
+    
+    /**
+     * Dispatch to a servlet or resource to generate and include the header content
+     * 
+     * @param request
+     * @param response
+     * @param headerResource
+     * @return
+     * @throws PortletException
+     */
+    void include(PortletHeaderRequest request, PortletHeaderResponse response, String headerResource) 
+        throws PortletException;
+}

Added: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/SupportsHeaderPhase.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/SupportsHeaderPhase.java?view=auto&rev=463809
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/SupportsHeaderPhase.java (added)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/portlet/SupportsHeaderPhase.java Fri Oct 13 13:04:54 2006
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlet;
+
+import javax.portlet.PortletException;
+
+/**
+ * Indicates that a portlet supports the pre-286 header phase  
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ */
+public interface SupportsHeaderPhase
+{
+    void doHeader(PortletHeaderRequest request, PortletHeaderResponse response) throws PortletException;    
+}

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/aggregation.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/aggregation.xml?view=diff&rev=463809&r1=463808&r2=463809
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/aggregation.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/aggregation.xml Fri Oct 13 13:04:54 2006
@@ -71,11 +71,6 @@
         </constructor-arg>        
     </bean>
 
-    <!-- Header Resource Factory TODO: do we really need the factory? -->
-    <bean id="org.apache.jetspeed.headerresource.HeaderResourceFactory" 
-          class="org.apache.jetspeed.headerresource.impl.HeaderResourceFactoryImpl">
-    </bean>
-    
     <bean id="org.apache.jetspeed.aggregator.ContentServerAdapter" 
           class="org.apache.jetspeed.aggregator.impl.ContentServerAdapterImpl">
         <constructor-arg index="0">
@@ -113,5 +108,17 @@
         </constructor-arg>          
           
     </bean>
-        
+
+    <bean id="org.apache.jetspeed.aggregator.HeaderAggregator" class="org.apache.jetspeed.aggregator.impl.HeaderAggregatorImpl">
+        <constructor-arg index="0">
+            <ref bean="portletFactory" />
+        </constructor-arg>
+        <constructor-arg index='1'>
+            <ref bean="PortletWindowAccessor"/>
+        </constructor-arg>
+        <constructor-arg index="2">
+            <ref bean="org.apache.jetspeed.headerresource.HeaderResourceFactory" />
+        </constructor-arg>                  
+    </bean>
+            
 </beans>

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml?view=diff&rev=463809&r1=463808&r2=463809
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/pipelines.xml Fri Oct 13 13:04:54 2006
@@ -178,7 +178,16 @@
        <ref bean="org.apache.jetspeed.aggregator.PageAggregator"/>
    </constructor-arg>
   </bean> 
-  
+
+  <bean id="headerAggregatorValve"
+        class="org.apache.jetspeed.aggregator.HeaderAggregatorValve"
+        init-method="initialize"
+  >
+   <constructor-arg>
+       <ref bean="org.apache.jetspeed.aggregator.HeaderAggregator"/>
+   </constructor-arg>
+  </bean> 
+      
   <bean id="cleanUpValve"
         class="org.apache.jetspeed.pipeline.valve.impl.CleanupValveImpl"
         init-method="initialize"
@@ -241,6 +250,7 @@
       <ref bean="containerValve"/>
       <ref bean="actionValve"/>
       <ref bean="DecorationValve" />
+      <ref bean="headerAggregatorValve"/>  
       <ref bean="aggregatorValve"/>
       <ref bean="cleanUpValve"/>
     </list>
@@ -376,6 +386,7 @@
         <ref bean="securityValve"/>                
         <ref bean="localizationValve"/>
         <ref bean="profilerValve"/>                        
+        <ref bean="headerAggregatorValve"/>          
         <ref bean="desktopValve"/>
     </list>
     </constructor-arg>



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


Mime
View raw message