You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2005/03/19 00:43:20 UTC

cvs commit: jakarta-tapestry/framework/src/java/org/apache/tapestry/request ResponseOutputStream.java

hlship      2005/03/18 15:43:20

  Modified:    framework/src/java/org/apache/tapestry/engine
                        HomeService.java ExternalService.java
                        ActionService.java DirectService.java
                        ResetService.java PageService.java
                        RestartService.java AbstractEngine.java
                        IEngineService.java
               framework/src/scripts TestLocalization.xml
               portlet/src/java/org/apache/tapestry/portlet
                        PortletMessages.java PortletResponseRenderer.java
                        PortletStrings.properties
                        RenderRequestServicerToWebRequestServicerBridge.java
                        ApplicationPortlet.java RenderService.java
                        PortletWebRequest.java
                        PortletRequestGlobalsImpl.java
                        PortletRequestGlobals.java
               portlet/src/descriptor/META-INF
                        tapestry.portlet.services.xml hivemodule.xml
               framework/src/test/org/apache/tapestry/junit/mock/c21
                        NameMismatchService.java PrivateService.java
               framework/src/java/org/apache/tapestry/services/impl
                        ResponseRendererImpl.java
                        RequestLocaleManagerImpl.java
               framework/src/test/org/apache/tapestry/services/impl
                        TestRequestLocaleManager.java
               portlet/src/test/org/apache/tapestry/portlet
                        TestPortletServicerBridges.java
               framework/src/java/org/apache/tapestry/services
                        ResponseRenderer.java ApplicationGlobals.java
               framework/src/java/org/apache/tapestry/asset
                        AssetService.java
               framework/src/java/org/apache/tapestry/web WebRequest.java
                        ServletWebRequest.java
               framework/src/descriptor/META-INF tapestry.request.xml
                        tapestry.globals.xml
               examples/Workbench/src/java/org/apache/tapestry/workbench/chart
                        ChartService.java
               .        .classpath
               examples/Workbench/src/java/org/apache/tapestry/workbench
                        WorkbenchHomeService.java
               framework/src/java/org/apache/tapestry/request
                        ResponseOutputStream.java
  Added:       portlet/src/java/org/apache/tapestry/portlet
                        PortletRendererImpl.java PortletHomeService.java
                        PortletRenderer.java
               portlet/src/test/org/apache/tapestry/portlet
                        TestPortletRenderer.java
                        TestPortletHomeService.java
  Log:
  Continue extending out the Portlet pipelines.
  
  Revision  Changes    Path
  1.10      +8 -7      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/HomeService.java
  
  Index: HomeService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/HomeService.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- HomeService.java	10 Mar 2005 13:23:27 -0000	1.9
  +++ HomeService.java	18 Mar 2005 23:43:18 -0000	1.10
  @@ -18,12 +18,8 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -import javax.servlet.ServletException;
  -
  -import org.apache.tapestry.IEngine;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
  -import org.apache.tapestry.TapestryConstants;
   import org.apache.tapestry.request.ResponseOutputStream;
   import org.apache.tapestry.services.LinkFactory;
   import org.apache.tapestry.services.ResponseRenderer;
  @@ -63,8 +59,7 @@
           return _linkFactory.constructLink(cycle, parameters, true);
       }
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
           cycle.activate(_pageName);
   
  @@ -87,10 +82,16 @@
       {
           _linkFactory = linkFactory;
       }
  -    
  +
       /** @since 3.1 */
       public void setPageName(String pageName)
       {
           _pageName = pageName;
       }
  +
  +    /** @since 3.1 */
  +    public String getPageName()
  +    {
  +        return _pageName;
  +    }
   }
  \ No newline at end of file
  
  
  
  1.9       +1 -4      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ExternalService.java
  
  Index: ExternalService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ExternalService.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ExternalService.java	6 Jan 2005 02:17:12 -0000	1.8
  +++ ExternalService.java	18 Mar 2005 23:43:18 -0000	1.9
  @@ -18,8 +18,6 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -import javax.servlet.ServletException;
  -
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.util.Defense;
   import org.apache.tapestry.IExternalPage;
  @@ -136,8 +134,7 @@
           return _linkFactory.constructLink(cycle, parameters, true);
       }
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
           String pageName = cycle.getParameter(ServiceConstants.PAGE);
           IPage rawPage = cycle.getPage(pageName);
  
  
  
  1.10      +1 -4      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ActionService.java
  
  Index: ActionService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ActionService.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ActionService.java	25 Feb 2005 15:01:53 -0000	1.9
  +++ ActionService.java	18 Mar 2005 23:43:18 -0000	1.10
  @@ -18,8 +18,6 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -import javax.servlet.ServletException;
  -
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.util.Defense;
   import org.apache.tapestry.IAction;
  @@ -83,8 +81,7 @@
           return _linkFactory.constructLink(cycle, parameters, true);
       }
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
           String componentId = cycle.getParameter(ServiceConstants.COMPONENT);
           String componentPageName = cycle.getParameter(ServiceConstants.CONTAINER);
  
  
  
  1.10      +1 -6      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/DirectService.java
  
  Index: DirectService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/DirectService.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- DirectService.java	25 Feb 2005 15:01:53 -0000	1.9
  +++ DirectService.java	18 Mar 2005 23:43:18 -0000	1.10
  @@ -18,10 +18,6 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -import javax.servlet.ServletException;
  -import javax.servlet.http.HttpServletRequest;
  -import javax.servlet.http.HttpSession;
  -
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.util.Defense;
   import org.apache.tapestry.IComponent;
  @@ -90,8 +86,7 @@
           return _linkFactory.constructLink(cycle, parameters, true);
       }
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
           String componentId = cycle.getParameter(ServiceConstants.COMPONENT);
           String componentPageName = cycle.getParameter(ServiceConstants.CONTAINER);
  
  
  
  1.8       +1 -4      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ResetService.java
  
  Index: ResetService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/ResetService.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ResetService.java	6 Jan 2005 02:17:12 -0000	1.7
  +++ ResetService.java	18 Mar 2005 23:43:18 -0000	1.8
  @@ -18,8 +18,6 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -import javax.servlet.ServletException;
  -
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
   import org.apache.tapestry.request.ResponseOutputStream;
  @@ -73,8 +71,7 @@
           return Tapestry.RESET_SERVICE;
       }
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
           String pageName = cycle.getParameter(ServiceConstants.PAGE);
   
  
  
  
  1.8       +1 -4      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/PageService.java
  
  Index: PageService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/PageService.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PageService.java	6 Jan 2005 02:17:12 -0000	1.7
  +++ PageService.java	18 Mar 2005 23:43:18 -0000	1.8
  @@ -18,8 +18,6 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -import javax.servlet.ServletException;
  -
   import org.apache.hivemind.util.Defense;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
  @@ -56,8 +54,7 @@
   
       }
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
           String pageName = cycle.getParameter(ServiceConstants.PAGE);
   
  
  
  
  1.10      +4 -6      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/RestartService.java
  
  Index: RestartService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/RestartService.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RestartService.java	25 Feb 2005 15:01:53 -0000	1.9
  +++ RestartService.java	18 Mar 2005 23:43:18 -0000	1.10
  @@ -18,7 +18,6 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -import javax.servlet.ServletException;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import javax.servlet.http.HttpSession;
  @@ -56,8 +55,8 @@
   
       /** @since 3.1 */
       private LinkFactory _linkFactory;
  -    
  -    /** @since 3.1 */    
  +
  +    /** @since 3.1 */
       private String _servletPath;
   
       public ILink getLink(IRequestCycle cycle, Object parameter)
  @@ -72,8 +71,7 @@
           return _linkFactory.constructLink(cycle, parameters, true);
       }
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
           HttpSession session = _request.getSession();
   
  @@ -130,7 +128,7 @@
       {
           _linkFactory = linkFactory;
       }
  -    
  +
       /** @since 3.1 */
       public void setServletPath(String servletPath)
       {
  
  
  
  1.25      +3 -3      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/AbstractEngine.java
  
  Index: AbstractEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/AbstractEngine.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- AbstractEngine.java	10 Mar 2005 18:49:15 -0000	1.24
  +++ AbstractEngine.java	18 Mar 2005 23:43:18 -0000	1.25
  @@ -241,7 +241,6 @@
        */
   
       public void renderResponse(IRequestCycle cycle, ResponseOutputStream output)
  -            throws ServletException, IOException
       {
           _infrastructure.getResponseRenderer().renderResponse(cycle, output);
       }
  @@ -262,6 +261,8 @@
   
           try
           {
  +            // TODO: this would work better if it was obtained from the WebResponse object.
  +            
               output = new ResponseOutputStream(response);
           }
           catch (Exception ex)
  @@ -342,8 +343,7 @@
                   cycle.cleanup();
                   _infrastructure.getApplicationStateManager().flush();
   
  -                // Closing the buffered output closes the underlying stream as
  -                // well.
  +                // Ensure any buffered output is posted.
   
                   if (output != null)
                       output.forceFlush();
  
  
  
  1.6       +1 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/IEngineService.java
  
  Index: IEngineService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/IEngineService.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- IEngineService.java	6 Jan 2005 02:17:12 -0000	1.5
  +++ IEngineService.java	18 Mar 2005 23:43:18 -0000	1.6
  @@ -65,8 +65,7 @@
        * @see org.apache.tapestry.IEngine#service(org.apache.tapestry.request.RequestContext)
        */
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException;
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException;
   
       /**
        * Returns the name of the service.
  
  
  
  1.7       +1 -21     jakarta-tapestry/framework/src/scripts/TestLocalization.xml
  
  Index: TestLocalization.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/scripts/TestLocalization.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestLocalization.xml	12 Mar 2005 23:10:22 -0000	1.6
  +++ TestLocalization.xml	18 Mar 2005 23:43:19 -0000	1.7
  @@ -116,32 +116,12 @@
   Zees ees nawt cheeze!
   		</assert-output>
   		
  -		<assert-cookie name="org.apache.tapestry.locale" value="fr"/>
  -
   		<assert-output name="DirectLink switch URL still stateless">
   <![CDATA[		
   href="/mock/app?component=link&amp;page=Home&amp;service=direct&amp;sp=2&amp;sp=d3.5&amp;sp=SHello"
   ]]>
   		</assert-output>			
  -	</request>
  -		
  -	<!-- With the cookie in place, going back to the Assets page should
  -		 provide the French version. -->
  -		 		
  -	<request>
  -	  	<parameter name="service" value="page"/>
  -      <parameter name="page" value="Assets"/>
  -		
  -		<assert-output name="French Home image">
  -<![CDATA[		
  -/mock/app?digest=64c0a48177b614031fcd8039550334ed&amp;path=%2Forg%2Fapache%2Ftapestry%2Fjunit%2Fmock%2Fapp%2Fhome_fr.png&amp;service=asset
  -]]>
  -		</assert-output>
  -		
  -		<assert-output name="French Back image">
  -/mock/images/back_fr.png
  -		</assert-output>		
  -	</request>		
  +	</request>			
   			 	 	 
   </mock-test>
       	
  
  
  
  1.3       +10 -0     jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletMessages.java
  
  Index: PortletMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletMessages.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PortletMessages.java	12 Mar 2005 20:49:15 -0000	1.2
  +++ PortletMessages.java	18 Mar 2005 23:43:19 -0000	1.3
  @@ -36,4 +36,14 @@
       {
           return _formatter.format("error-getting-resource", path, cause);
       }
  +
  +    public static String errorProcessingAction(Throwable cause)
  +    {
  +        return _formatter.format("error-processing-action", cause);
  +    }
  +
  +    public static String errorProcessingRender(Throwable cause)
  +    {
  +        return _formatter.format("error-processing-render", cause);
  +    }
   }
  \ No newline at end of file
  
  
  
  1.2       +4 -5      jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletResponseRenderer.java
  
  Index: PortletResponseRenderer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletResponseRenderer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PortletResponseRenderer.java	17 Mar 2005 21:53:33 -0000	1.1
  +++ PortletResponseRenderer.java	18 Mar 2005 23:43:19 -0000	1.2
  @@ -14,10 +14,7 @@
   
   package org.apache.tapestry.portlet;
   
  -import java.io.IOException;
  -
   import javax.portlet.ActionResponse;
  -import javax.servlet.ServletException;
   
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.request.ResponseOutputStream;
  @@ -26,7 +23,10 @@
   
   /**
    * Sets render parameters on the current {@link javax.portlet.ActionResponse}&nbsp;that will invoke
  - * the {@link org.apache.tapestry.portlet.RenderService}to render the (currently) active page.
  + * the {@link org.apache.tapestry.portlet.RenderService}to render the (currently) active page. This
  + * reflects the Portlet APIs very clear division between processing an action and rendering a
  + * response; we need to record into the implicit render URL the render service and the name of the
  + * active page.
    * 
    * @author Howard M. Lewis Ship
    * @since 3.1
  @@ -36,7 +36,6 @@
       private ActionResponse _response;
   
       public void renderResponse(IRequestCycle cycle, ResponseOutputStream output)
  -            throws ServletException, IOException
       {
           String pageName = cycle.getPage().getPageName();
   
  
  
  
  1.3       +2 -0      jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletStrings.properties
  
  Index: PortletStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletStrings.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PortletStrings.properties	12 Mar 2005 20:49:15 -0000	1.2
  +++ PortletStrings.properties	18 Mar 2005 23:43:19 -0000	1.3
  @@ -14,3 +14,5 @@
   
   unsupported-method=Method {0}() is not supported for portlet requests.
   error-getting-resource=Error getting portlet context resource ''{0}'': {1}
  +error-processing-action=Error processing action request: {0}
  +error-processing-render=Error processing render request: {0}
  \ No newline at end of file
  
  
  
  1.2       +1 -1      jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/RenderRequestServicerToWebRequestServicerBridge.java
  
  Index: RenderRequestServicerToWebRequestServicerBridge.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/RenderRequestServicerToWebRequestServicerBridge.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RenderRequestServicerToWebRequestServicerBridge.java	17 Mar 2005 21:53:33 -0000	1.1
  +++ RenderRequestServicerToWebRequestServicerBridge.java	18 Mar 2005 23:43:19 -0000	1.2
  @@ -42,7 +42,7 @@
           _portletRequestGlobals.store(request, response);
   
           PortletWebRequest webRequest = new PortletWebRequest(request);
  -        PortletWebResponse webResponse = new PortletWebResponse(response);
  +        PortletWebResponse webResponse = new RenderWebResponse(response);
   
           try
           {
  
  
  
  1.3       +2 -2      jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/ApplicationPortlet.java
  
  Index: ApplicationPortlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/ApplicationPortlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ApplicationPortlet.java	17 Mar 2005 21:53:33 -0000	1.2
  +++ ApplicationPortlet.java	18 Mar 2005 23:43:19 -0000	1.3
  @@ -141,7 +141,7 @@
           }
           catch (RuntimeException ex)
           {
  -            throw new PortletException(ex);
  +            throw new PortletException(PortletMessages.errorProcessingAction(ex), ex);
           }
           finally
           {
  @@ -158,7 +158,7 @@
           }
           catch (RuntimeException ex)
           {
  -            throw new PortletException(ex);
  +            throw new PortletException(PortletMessages.errorProcessingRender(ex), ex);
           }
           finally
           {
  
  
  
  1.2       +7 -42     jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/RenderService.java
  
  Index: RenderService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/RenderService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RenderService.java	17 Mar 2005 21:53:33 -0000	1.1
  +++ RenderService.java	18 Mar 2005 23:43:19 -0000	1.2
  @@ -16,10 +16,6 @@
   
   import java.io.IOException;
   
  -import javax.servlet.ServletException;
  -
  -import org.apache.tapestry.IMarkupWriter;
  -import org.apache.tapestry.IPage;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.engine.IEngineService;
   import org.apache.tapestry.engine.ILink;
  @@ -36,53 +32,18 @@
    */
   public class RenderService implements IEngineService
   {
  +    private PortletRenderer _portletRenderer;
   
       public ILink getLink(IRequestCycle cycle, Object parameter)
       {
           throw new UnsupportedOperationException(PortletMessages.unsupportedMethod("getLink"));
       }
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
           String pageName = cycle.getParameter(ServiceConstants.PAGE);
   
  -        IPage page = cycle.getPage(pageName);
  -
  -        IMarkupWriter writer = page.getResponseWriter(output);
  -
  -        // TODO: Ensure that content type matches?
  -        // output.setContentType(writer.getContentType());
  -
  -        boolean discard = true;
  -
  -        try
  -        {
  -            cycle.renderPage(writer);
  -
  -            discard = false;
  -        }
  -        finally
  -        {
  -            // Closing the writer closes its PrintWriter and a whole stack of
  -            // java.io objects,
  -            // which tend to stream a lot of output that eventually hits the
  -            // ResponseOutputStream. If we are discarding output anyway (due to
  -            // an exception
  -            // getting thrown during the render), we can save ourselves some
  -            // trouble
  -            // by ignoring it.
  -
  -            if (discard)
  -                output.setDiscard(true);
  -
  -            writer.close();
  -
  -            if (discard)
  -                output.setDiscard(false);
  -        }
  -
  -        // TODO: Trap errors and do some error reporting here?
  +        _portletRenderer.renderPage(cycle, pageName, output);
       }
   
       public String getName()
  @@ -90,4 +51,8 @@
           return PortletConstants.RENDER_SERVICE;
       }
   
  +    public void setPortletRenderer(PortletRenderer portletRenderer)
  +    {
  +        _portletRenderer = portletRenderer;
  +    }
   }
  \ No newline at end of file
  
  
  
  1.3       +6 -0      jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletWebRequest.java
  
  Index: PortletWebRequest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletWebRequest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PortletWebRequest.java	14 Mar 2005 22:29:47 -0000	1.2
  +++ PortletWebRequest.java	18 Mar 2005 23:43:19 -0000	1.3
  @@ -15,6 +15,7 @@
   package org.apache.tapestry.portlet;
   
   import java.util.List;
  +import java.util.Locale;
   
   import javax.portlet.PortletRequest;
   import javax.portlet.PortletSession;
  @@ -139,4 +140,9 @@
       {
           receiver.describeAlternate(_portletRequest);
       }
  +
  +    public Locale getLocale()
  +    {
  +        return _portletRequest.getLocale();
  +    }
   }
  \ No newline at end of file
  
  
  
  1.3       +5 -0      jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletRequestGlobalsImpl.java
  
  Index: PortletRequestGlobalsImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletRequestGlobalsImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PortletRequestGlobalsImpl.java	17 Mar 2005 21:53:33 -0000	1.2
  +++ PortletRequestGlobalsImpl.java	18 Mar 2005 23:43:19 -0000	1.3
  @@ -67,4 +67,9 @@
       {
           return _renderResponse;
       }
  +
  +    public boolean isRenderRequest()
  +    {
  +        return _renderRequest != null;
  +    }
   }
  \ No newline at end of file
  
  
  
  1.3       +6 -0      jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletRequestGlobals.java
  
  Index: PortletRequestGlobals.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletRequestGlobals.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PortletRequestGlobals.java	17 Mar 2005 21:53:33 -0000	1.2
  +++ PortletRequestGlobals.java	18 Mar 2005 23:43:19 -0000	1.3
  @@ -38,4 +38,10 @@
       public RenderRequest getRenderRequest();
   
       public RenderResponse getRenderResponse();
  +
  +    /**
  +     * Returns true if {@link #store(RenderRequest, RenderResponse)}has been invoked, false
  +     * otherwise.
  +     */
  +    public boolean isRenderRequest();
   }
  \ No newline at end of file
  
  
  
  1.1                  jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletRendererImpl.java
  
  Index: PortletRendererImpl.java
  ===================================================================
  // Copyright 2005 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.tapestry.portlet;
  
  import java.io.IOException;
  
  import org.apache.tapestry.IMarkupWriter;
  import org.apache.tapestry.IPage;
  import org.apache.tapestry.IRequestCycle;
  import org.apache.tapestry.request.ResponseOutputStream;
  
  /**
   * The guts of rendering a page as a portlet response; used by
   * {@link org.apache.tapestry.portlet.RenderService}&nbsp;and
   * {@link org.apache.tapestry.portlet.PortletHomeService}.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public class PortletRendererImpl implements PortletRenderer
  {
  
      public void renderPage(IRequestCycle cycle, String pageName, ResponseOutputStream output)
      {
          cycle.activate(pageName);
          
          IPage page = cycle.getPage();
  
          IMarkupWriter writer = page.getResponseWriter(output);
  
          String contentType = writer.getContentType();
          output.setContentType(contentType);
          
          boolean discard = true;
  
          try
          {
              cycle.renderPage(writer);
  
              discard = false;
          }
          finally
          {
              // Closing the writer closes its PrintWriter and a whole stack of
              // java.io objects,
              // which tend to stream a lot of output that eventually hits the
              // ResponseOutputStream. If we are discarding output anyway (due to
              // an exception
              // getting thrown during the render), we can save ourselves some
              // trouble
              // by ignoring it.
  
              if (discard)
                  output.setDiscard(true);
  
              writer.close();
  
              if (discard)
                  output.setDiscard(false);
          }
  
          // TODO: Trap errors and do some error reporting here?
      }
  
  }
  
  
  1.1                  jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletHomeService.java
  
  Index: PortletHomeService.java
  ===================================================================
  // Copyright 2005 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.tapestry.portlet;
  
  import java.io.IOException;
  
  import org.apache.tapestry.IRequestCycle;
  import org.apache.tapestry.engine.HomeService;
  import org.apache.tapestry.request.ResponseOutputStream;
  
  /**
   * Replacement for the standard home service, used by Portlets. This exists to handle the special
   * case where a Portlet render request arrives when there is not a Portlet action request prior ...
   * this can happen when a Portlet is first added to a Portal page.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public class PortletHomeService extends HomeService
  {
      private PortletRenderer _portletRenderer;
  
      private PortletRequestGlobals _requestGlobals;
  
      public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
      {
          if (_requestGlobals.isRenderRequest())
          {
              String pageName = getPageName();
  
              _portletRenderer.renderPage(cycle, pageName, output);
  
              return;
          }
  
          super.service(cycle, output);
      }
  
      public void setPortletRenderer(PortletRenderer portletRenderer)
      {
          _portletRenderer = portletRenderer;
      }
  
      public void setRequestGlobals(PortletRequestGlobals requestGlobals)
      {
          _requestGlobals = requestGlobals;
      }
  }
  
  
  1.1                  jakarta-tapestry/portlet/src/java/org/apache/tapestry/portlet/PortletRenderer.java
  
  Index: PortletRenderer.java
  ===================================================================
  // Copyright 2005 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.tapestry.portlet;
  
  import org.apache.tapestry.IRequestCycle;
  import org.apache.tapestry.request.ResponseOutputStream;
  
  /**
   * Service used to render a page within a portlet.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public interface PortletRenderer
  {
      public void renderPage(IRequestCycle cycle, String pageName, ResponseOutputStream output);
  }
  
  
  1.2       +28 -3     jakarta-tapestry/portlet/src/descriptor/META-INF/tapestry.portlet.services.xml
  
  Index: tapestry.portlet.services.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/src/descriptor/META-INF/tapestry.portlet.services.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- tapestry.portlet.services.xml	17 Mar 2005 21:53:33 -0000	1.1
  +++ tapestry.portlet.services.xml	18 Mar 2005 23:43:19 -0000	1.2
  @@ -27,7 +27,7 @@
     </configuration-point>
       
     <contribution configuration-id="FactoryServices">
  -    <service object="service:tapestry.services.Home"/>
  +    <service object="service:Home"/>
       <service object="service:tapestry.services.Action"/>
       <service object="service:tapestry.services.Direct"/>
       <service object="service:tapestry.services.Page"/>
  @@ -38,14 +38,36 @@
       <service object="service:Render"/>
     </contribution>    
     
  +  <service-point id="PortletRenderer" interface="PortletRenderer">
  +    
  +    Service used to render a named page.
  +    
  +    <create-instance class="PortletRendererImpl" model="primitive"/>
  +  </service-point>
  +  
    <service-point id="Render" interface="org.apache.tapestry.engine.IEngineService">
     
     The single service that should be referenced by a Portlet render request.
     
  -  <create-instance class="RenderService" model="primitive"/>
  -  
  +  <invoke-factory model="primitive">
  +    <construct class="RenderService">
  +      <set-service property="portletRenderer" service-id="PortletRenderer"/>
  +    </construct>
  +  </invoke-factory>  
    </service-point>
    
  +  <service-point id="Home" interface="org.apache.tapestry.engine.IEngineService">
  +    <invoke-factory model="primitive">
  +      <construct class="PortletHomeService">
  +        <set-object property="responseRenderer" value="infrastructure:responseRenderer"/>
  +        <set-object property="linkFactory" value="infrastructure:linkFactory"/>
  +        <set-service property="requestGlobals" service-id="tapestry.portlet.PortletRequestGlobals"/>
  +        <set-service property="portletRenderer" service-id="PortletRenderer"/>
  +        <set-object property="pageName" value="app-property:org.apache.tapestry.portlet.home-page"/>
  +      </construct>
  +    </invoke-factory>
  +  </service-point> 
  + 
    <service-point id="ResponseRenderer" interface="org.apache.tapestry.services.ResponseRenderer">
     
     Portal specific implementation of ResponseRender that builds a 
  @@ -77,4 +99,7 @@
     <command id="SetupPortletEngineServices" object="service:SetupPortletEngineServices"/>
    </contribution>
     
  +  <contribution configuration-id="hivemind.FactoryDefaults">
  +    <default symbol="org.apache.tapestry.portlet.home-page" value="View"/>
  +  </contribution>
   </module>
  \ No newline at end of file
  
  
  
  1.5       +10 -1     jakarta-tapestry/portlet/src/descriptor/META-INF/hivemodule.xml
  
  Index: hivemodule.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/src/descriptor/META-INF/hivemodule.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- hivemodule.xml	17 Mar 2005 22:22:19 -0000	1.4
  +++ hivemodule.xml	18 Mar 2005 23:43:19 -0000	1.5
  @@ -20,6 +20,7 @@
     Add on for Tapestry that adds native Portlet support.
     
     <dependency module-id="tapestry" version="3.1.0"/>
  +  <dependency module-id="hivemind.lib" version="1.1.0"/>
     
     <sub-module descriptor="tapestry.portlet.services.xml"/>
     
  @@ -145,7 +146,7 @@
       
       Stores the current request and response objects.
       
  -    <create-instance class="PortletRequestGlobals" model="threaded"/>
  +    <create-instance class="PortletRequestGlobalsImpl" model="threaded"/>
       
     </service-point>
     
  @@ -168,4 +169,12 @@
       </invoke-factory>
     </service-point>
     
  +  <!-- There's nothing in the Portlet API to support cookies, so override
  +       the default (servlet) implementation with an empty placeholder. 
  +       This may break some tests when running JUnit inside Eclipse. -->
  +       
  +  <implementation service-id="tapestry.request.CookieSource">
  +    <invoke-factory service-id="hivemind.lib.PlaceholderFactory" model="primitive"/>
  +  </implementation>
  +  
   </module>
  \ No newline at end of file
  
  
  
  1.4       +1 -4      jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/mock/c21/NameMismatchService.java
  
  Index: NameMismatchService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/mock/c21/NameMismatchService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NameMismatchService.java	6 Jan 2005 02:17:30 -0000	1.3
  +++ NameMismatchService.java	18 Mar 2005 23:43:19 -0000	1.4
  @@ -16,8 +16,6 @@
   
   import java.io.IOException;
   
  -import javax.servlet.ServletException;
  -
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.engine.IEngineService;
   import org.apache.tapestry.engine.ILink;
  @@ -31,8 +29,7 @@
           return null;
       }
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
       }
   
  
  
  
  1.4       +1 -4      jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/mock/c21/PrivateService.java
  
  Index: PrivateService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/junit/mock/c21/PrivateService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PrivateService.java	6 Jan 2005 02:17:30 -0000	1.3
  +++ PrivateService.java	18 Mar 2005 23:43:19 -0000	1.4
  @@ -16,8 +16,6 @@
   
   import java.io.IOException;
   
  -import javax.servlet.ServletException;
  -
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.engine.IEngineService;
   import org.apache.tapestry.engine.ILink;
  @@ -41,8 +39,7 @@
           return null;
       }
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
       }
   
  
  
  
  1.5       +0 -5      jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/ResponseRendererImpl.java
  
  Index: ResponseRendererImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/ResponseRendererImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ResponseRendererImpl.java	28 Feb 2005 16:25:38 -0000	1.4
  +++ ResponseRendererImpl.java	18 Mar 2005 23:43:19 -0000	1.5
  @@ -14,10 +14,6 @@
   
   package org.apache.tapestry.services.impl;
   
  -import java.io.IOException;
  -
  -import javax.servlet.ServletException;
  -
   import org.apache.tapestry.IMarkupWriter;
   import org.apache.tapestry.IPage;
   import org.apache.tapestry.IRequestCycle;
  @@ -36,7 +32,6 @@
       private RequestLocaleManager _localeManager;
   
       public void renderResponse(IRequestCycle cycle, ResponseOutputStream output)
  -            throws ServletException, IOException
       {
           _localeManager.persistLocale();
   
  
  
  
  1.7       +3 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/RequestLocaleManagerImpl.java
  
  Index: RequestLocaleManagerImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/RequestLocaleManagerImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RequestLocaleManagerImpl.java	28 Feb 2005 16:25:38 -0000	1.6
  +++ RequestLocaleManagerImpl.java	18 Mar 2005 23:43:19 -0000	1.7
  @@ -23,6 +23,7 @@
   import org.apache.tapestry.services.CookieSource;
   import org.apache.tapestry.services.RequestLocaleManager;
   import org.apache.tapestry.util.StringSplitter;
  +import org.apache.tapestry.web.WebRequest;
   
   /**
    * Identifies the Locale provided by the client (either in a Tapestry-specific cookie, or
  @@ -34,7 +35,7 @@
    */
   public class RequestLocaleManagerImpl implements RequestLocaleManager
   {
  -    private HttpServletRequest _request;
  +    private WebRequest _request;
   
       /**
        * Extracted at start of request, and used at end of request to see if locale has changed.
  @@ -107,7 +108,7 @@
           _cookieSource = source;
       }
   
  -    public void setRequest(HttpServletRequest request)
  +    public void setRequest(WebRequest request)
       {
           _request = request;
       }
  
  
  
  1.5       +5 -7      jakarta-tapestry/framework/src/test/org/apache/tapestry/services/impl/TestRequestLocaleManager.java
  
  Index: TestRequestLocaleManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/test/org/apache/tapestry/services/impl/TestRequestLocaleManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestRequestLocaleManager.java	28 Feb 2005 16:25:38 -0000	1.4
  +++ TestRequestLocaleManager.java	18 Mar 2005 23:43:19 -0000	1.5
  @@ -16,13 +16,11 @@
   
   import java.util.Locale;
   
  -import javax.servlet.http.HttpServletRequest;
  -
   import org.apache.hivemind.service.ThreadLocale;
   import org.apache.hivemind.test.HiveMindTestCase;
  -import org.apache.tapestry.ApplicationServlet;
   import org.apache.tapestry.TapestryConstants;
   import org.apache.tapestry.services.CookieSource;
  +import org.apache.tapestry.web.WebRequest;
   import org.easymock.MockControl;
   
   /**
  @@ -54,8 +52,8 @@
           MockControl sourceControl = newControl(CookieSource.class);
           CookieSource source = (CookieSource) sourceControl.getMock();
   
  -        MockControl requestControl = newControl(HttpServletRequest.class);
  -        HttpServletRequest request = (HttpServletRequest) requestControl.getMock();
  +        MockControl requestControl = newControl(WebRequest.class);
  +        WebRequest request = (WebRequest) requestControl.getMock();
   
           ThreadLocale tl = newThreadLocale();
   
  @@ -152,8 +150,8 @@
           MockControl sourceControl = newControl(CookieSource.class);
           CookieSource source = (CookieSource) sourceControl.getMock();
   
  -        MockControl requestControl = newControl(HttpServletRequest.class);
  -        HttpServletRequest request = (HttpServletRequest) requestControl.getMock();
  +        MockControl requestControl = newControl(WebRequest.class);
  +        WebRequest request = (WebRequest) requestControl.getMock();
   
           MockControl tlc = newControl(ThreadLocale.class);
           ThreadLocale tl = (ThreadLocale) tlc.getMock();
  
  
  
  1.2       +6 -4      jakarta-tapestry/portlet/src/test/org/apache/tapestry/portlet/TestPortletServicerBridges.java
  
  Index: TestPortletServicerBridges.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/portlet/src/test/org/apache/tapestry/portlet/TestPortletServicerBridges.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestPortletServicerBridges.java	17 Mar 2005 21:53:33 -0000	1.1
  +++ TestPortletServicerBridges.java	18 Mar 2005 23:43:19 -0000	1.2
  @@ -100,8 +100,7 @@
           prg.store(request, response);
   
           request.removeAttribute("FOO");
  -        response.encodeURL("FOO");
  -        responsec.setReturnValue(null);
  +        response.setContentType("foo/bar");
   
           replayControls();
   
  @@ -115,7 +114,10 @@
           // encapsulate the RenderRequest and RenderResponse
   
           wrs._request.setAttribute("FOO", null);
  -        wrs._response.encodeURL("FOO");
  +
  +        // Prove that the *correct* wrapper type, RenderWebResponse, has been used.
  +
  +        wrs._response.setContentType("foo/bar");
   
           verifyControls();
       }
  @@ -174,7 +176,7 @@
           Throwable t = new RuntimeException("Failure.");
   
           prg.store(request, response);
  -        servicer.service(new PortletWebRequest(request), new PortletWebResponse(response));
  +        servicer.service(new PortletWebRequest(request), new RenderWebResponse(response));
           control.setMatcher(new AggregateArgumentsMatcher(new ArgumentMatcher[]
           { new TypeMatcher(), new TypeMatcher() }));
           control.setThrowable(t);
  
  
  
  1.1                  jakarta-tapestry/portlet/src/test/org/apache/tapestry/portlet/TestPortletRenderer.java
  
  Index: TestPortletRenderer.java
  ===================================================================
  // Copyright 2005 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.tapestry.portlet;
  
  import org.apache.hivemind.test.HiveMindTestCase;
  import org.apache.tapestry.IMarkupWriter;
  import org.apache.tapestry.IPage;
  import org.apache.tapestry.IRequestCycle;
  import org.apache.tapestry.request.ResponseOutputStream;
  import org.easymock.MockControl;
  
  /**
   * Tests for {@link org.apache.tapestry.portlet.PortletRendererImpl}.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public class TestPortletRenderer extends HiveMindTestCase
  {
      private IMarkupWriter newWriter()
      {
          return (IMarkupWriter) newMock(IMarkupWriter.class);
      }
  
      private IPage newPage(IMarkupWriter writer, ResponseOutputStream output)
      {
          MockControl control = newControl(IPage.class);
          IPage page = (IPage) control.getMock();
  
          page.getResponseWriter(output);
          control.setReturnValue(writer);
  
          return page;
      }
  
      private IRequestCycle newCycle(String pageName, IPage page)
      {
          MockControl control = newControl(IRequestCycle.class);
          IRequestCycle cycle = (IRequestCycle) control.getMock();
  
          cycle.activate(pageName);
          
          cycle.getPage();
          control.setReturnValue(page);
  
          return cycle;
      }
  
      public void testSuccess()
      {
          ResponseOutputStream output = new ResponseOutputStream(null);
          IMarkupWriter writer = newWriter();
          IPage page = newPage(writer, output);
          IRequestCycle cycle = newCycle("ZePage", page);
  
          cycle.renderPage(writer);
          
          writer.close();
  
          replayControls();
  
          PortletRenderer r = new PortletRendererImpl();
  
          r.renderPage(cycle, "ZePage", output);
  
          verifyControls();
      }
  }
  
  
  1.1                  jakarta-tapestry/portlet/src/test/org/apache/tapestry/portlet/TestPortletHomeService.java
  
  Index: TestPortletHomeService.java
  ===================================================================
  // Copyright 2005 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.tapestry.portlet;
  
  import org.apache.hivemind.test.HiveMindTestCase;
  import org.apache.tapestry.IRequestCycle;
  import org.apache.tapestry.request.ResponseOutputStream;
  import org.apache.tapestry.services.ResponseRenderer;
  import org.easymock.MockControl;
  
  /**
   * Tests for {@link org.apache.tapestry.portlet.PortletHomeService}.
   * 
   * @author Howard M. Lewis Ship
   * @since 3.1
   */
  public class TestPortletHomeService extends HiveMindTestCase
  {
      private ResponseRenderer newResponseRenderer()
      {
          return (ResponseRenderer) newMock(ResponseRenderer.class);
      }
  
      private IRequestCycle newCycle()
      {
          return (IRequestCycle) newMock(IRequestCycle.class);
      }
  
      private PortletRequestGlobals newRequestGlobals(boolean isRender)
      {
          MockControl control = newControl(PortletRequestGlobals.class);
          PortletRequestGlobals globals = (PortletRequestGlobals) control.getMock();
  
          globals.isRenderRequest();
          control.setReturnValue(isRender);
  
          return globals;
      }
  
      private PortletRenderer newPortletRenderer()
      {
          return (PortletRenderer) newMock(PortletRenderer.class);
      }
  
      public void testIsRenderRequest() throws Exception
      {
          IRequestCycle cycle = newCycle();
          ResponseOutputStream output = new ResponseOutputStream(null);
          PortletRequestGlobals globals = newRequestGlobals(true);
          PortletRenderer renderer = newPortletRenderer();
  
          renderer.renderPage(cycle, "ZePage", output);
  
          replayControls();
  
          PortletHomeService phs = new PortletHomeService();
          phs.setPageName("ZePage");
          phs.setPortletRenderer(renderer);
          phs.setRequestGlobals(globals);
  
          phs.service(cycle, output);
  
          verifyControls();
      }
      
      public void testIsActionRequest() throws Exception
      {
          IRequestCycle cycle = newCycle();
          ResponseOutputStream output = new ResponseOutputStream(null);
          PortletRequestGlobals globals = newRequestGlobals(false);
          ResponseRenderer renderer = newResponseRenderer();
  
          cycle.activate("ZePage");
          renderer.renderResponse(cycle, output);
  
          replayControls();
  
          PortletHomeService phs = new PortletHomeService();
          phs.setResponseRenderer(renderer);
          phs.setRequestGlobals(globals);
          phs.setPageName("ZePage");
  
          phs.service(cycle, output);
  
          verifyControls();
      }
  }
  
  
  1.3       +4 -5      jakarta-tapestry/framework/src/java/org/apache/tapestry/services/ResponseRenderer.java
  
  Index: ResponseRenderer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/ResponseRenderer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResponseRenderer.java	5 Jan 2005 23:17:17 -0000	1.2
  +++ ResponseRenderer.java	18 Mar 2005 23:43:19 -0000	1.3
  @@ -22,9 +22,9 @@
   import org.apache.tapestry.request.ResponseOutputStream;
   
   /**
  - * Responsible for rendering the active page as the response.  Works with
  - * the {@link org.apache.tapestry.services.RequestLocaleManager}
  - * to persist any change to the selected locale.
  + * Responsible for rendering the active page as the response. Works with the
  + * {@link org.apache.tapestry.services.RequestLocaleManager}to persist any change to the selected
  + * locale.
    * 
    * @author Howard M. Lewis Ship
    * @since 3.1
  @@ -35,7 +35,6 @@
        * Renders the reponse, using the current active page defined by the request cycle.
        */
   
  -    public void renderResponse(IRequestCycle cycle, ResponseOutputStream output)
  -            throws ServletException, IOException;
  +    public void renderResponse(IRequestCycle cycle, ResponseOutputStream output);
   
   }
  \ No newline at end of file
  
  
  
  1.9       +3 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/services/ApplicationGlobals.java
  
  Index: ApplicationGlobals.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/ApplicationGlobals.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ApplicationGlobals.java	17 Mar 2005 21:53:34 -0000	1.8
  +++ ApplicationGlobals.java	18 Mar 2005 23:43:19 -0000	1.9
  @@ -77,6 +77,9 @@
   
       /**
        * Stores the {@link org.apache.tapestry.services.ResponseRenderer}.
  +     * <p>
  +     * TODO: Perhaps we should just override the default implementation from within the portlet
  +     * hivemodule.xml.
        */
   
       public void storeResponseRenderer(ResponseRenderer renderer);
  
  
  
  1.13      +1 -4      jakarta-tapestry/framework/src/java/org/apache/tapestry/asset/AssetService.java
  
  Index: AssetService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/asset/AssetService.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- AssetService.java	14 Mar 2005 22:29:48 -0000	1.12
  +++ AssetService.java	18 Mar 2005 23:43:19 -0000	1.13
  @@ -22,8 +22,6 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -import javax.servlet.ServletException;
  -
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.ClassResolver;
   import org.apache.hivemind.util.Defense;
  @@ -178,8 +176,7 @@
        * TBD: Security issues. Hackers can download .class files.
        */
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
           String path = cycle.getParameter(PATH);
           String md5 = cycle.getParameter(DIGEST);
  
  
  
  1.8       +7 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/web/WebRequest.java
  
  Index: WebRequest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/web/WebRequest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WebRequest.java	14 Mar 2005 22:29:47 -0000	1.7
  +++ WebRequest.java	18 Mar 2005 23:43:19 -0000	1.8
  @@ -15,6 +15,7 @@
   package org.apache.tapestry.web;
   
   import java.util.List;
  +import java.util.Locale;
   
   import org.apache.tapestry.describe.Describable;
   
  @@ -132,4 +133,10 @@
        *          requests).
        */
       public String getActivationPath();
  +
  +    /**
  +     * Returns the preferred locale to which content should be localized, as specified by the client
  +     * or by the container. May return null.
  +     */
  +    public Locale getLocale();
   }
  \ No newline at end of file
  
  
  
  1.8       +6 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/web/ServletWebRequest.java
  
  Index: ServletWebRequest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/web/ServletWebRequest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ServletWebRequest.java	14 Mar 2005 22:29:47 -0000	1.7
  +++ ServletWebRequest.java	18 Mar 2005 23:43:19 -0000	1.8
  @@ -16,6 +16,7 @@
   
   import java.io.IOException;
   import java.util.List;
  +import java.util.Locale;
   
   import javax.servlet.RequestDispatcher;
   import javax.servlet.ServletException;
  @@ -186,6 +187,11 @@
           return pathInfo == null ? servletPath : servletPath + pathInfo;
       }
   
  +    public Locale getLocale()
  +    {
  +        return _servletRequest.getLocale();
  +    }
  +
       public void describeTo(DescriptionReceiver receiver)
       {
           receiver.describeAlternate(_servletRequest);
  
  
  
  1.23      +1 -1      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.request.xml
  
  Index: tapestry.request.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.request.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- tapestry.request.xml	17 Mar 2005 22:22:19 -0000	1.22
  +++ tapestry.request.xml	18 Mar 2005 23:43:19 -0000	1.23
  @@ -38,7 +38,7 @@
       
       <invoke-factory model="threaded">
         <construct class="impl.RequestLocaleManagerImpl">
  -        <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
  +        <set-service property="request" service-id="tapestry.globals.WebRequest"/>
           <set-service property="cookieSource" service-id="CookieSource"/>
           <set-service property="threadLocale" service-id="hivemind.ThreadLocale"/>
         </construct>
  
  
  
  1.12      +6 -6      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.globals.xml
  
  Index: tapestry.globals.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.globals.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- tapestry.globals.xml	14 Mar 2005 22:29:47 -0000	1.11
  +++ tapestry.globals.xml	18 Mar 2005 23:43:19 -0000	1.12
  @@ -22,7 +22,7 @@
     on this global information are provided.
     
     <service-point id="ApplicationGlobals" interface="ApplicationGlobals">
  -    <create-instance class="impl.ApplicationGlobalsImpl"/>
  +    <create-instance class="impl.ApplicationGlobalsImpl" model="primitive"/>
     </service-point>
    
     
  @@ -37,7 +37,7 @@
       Exposes the current thread's HttpServletRequest as a service. The request is actually
       stored in the RequestGlobals service.
       
  -    <invoke-factory service-id="hivemind.lib.ServicePropertyFactory">
  +    <invoke-factory service-id="hivemind.lib.ServicePropertyFactory" model="primitive">
         <construct service-id="RequestGlobals" property="request"/>
       </invoke-factory>
     </service-point>  
  @@ -48,7 +48,7 @@
       stored in the RequestGlobals service.
       
       
  -    <invoke-factory service-id="hivemind.lib.ServicePropertyFactory">
  +    <invoke-factory service-id="hivemind.lib.ServicePropertyFactory" model="primitive">
         <construct service-id="RequestGlobals" property="webRequest"/>
       </invoke-factory>
     </service-point>
  @@ -58,7 +58,7 @@
       Exposes the current thread's HttpServletResponse as a service. The response is actually
       stored in the RequestGlobals service.
       
  -    <invoke-factory service-id="hivemind.lib.ServicePropertyFactory">
  +    <invoke-factory service-id="hivemind.lib.ServicePropertyFactory" model="primitive">
         <construct service-id="RequestGlobals" property="response"/>
       </invoke-factory>
     </service-point>   
  @@ -69,7 +69,7 @@
       stored in the RequestGlobals service.
       
       
  -    <invoke-factory service-id="hivemind.lib.ServicePropertyFactory">
  +    <invoke-factory service-id="hivemind.lib.ServicePropertyFactory" model="primitive">
         <construct service-id="RequestGlobals" property="webResponse"/>
       </invoke-factory>
     </service-point>  
  @@ -79,7 +79,7 @@
       Exposes the global WebContext (a wrapper around the Servlet or Portlet context)
       as a service.
       
  -    <invoke-factory service-id="hivemind.lib.ServicePropertyFactory">
  +    <invoke-factory service-id="hivemind.lib.ServicePropertyFactory" model="primitive">
         <construct service-id="ApplicationGlobals" property="webContext"/>
       </invoke-factory>
       
  
  
  
  1.7       +1 -2      jakarta-tapestry/examples/Workbench/src/java/org/apache/tapestry/workbench/chart/ChartService.java
  
  Index: ChartService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Workbench/src/java/org/apache/tapestry/workbench/chart/ChartService.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ChartService.java	6 Jan 2005 02:17:28 -0000	1.6
  +++ ChartService.java	18 Mar 2005 23:43:20 -0000	1.7
  @@ -67,8 +67,7 @@
           return _linkFactory.constructLink(cycle, parameters, true);
       }
   
  -    public void service(IRequestCycle cycle, ResponseOutputStream output) throws ServletException,
  -            IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
           String pageName = cycle.getParameter(ServiceConstants.PAGE);
           String componentId = cycle.getParameter(ServiceConstants.COMPONENT);
  
  
  
  1.75      +15 -15    jakarta-tapestry/.classpath
  
  Index: .classpath
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/.classpath,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- .classpath	15 Mar 2005 16:44:17 -0000	1.74
  +++ .classpath	18 Mar 2005 23:43:20 -0000	1.75
  @@ -8,29 +8,29 @@
   	<classpathentry kind="src" path="contrib/src/test"/>
   	<classpathentry kind="src" path="examples/Workbench/src/java"/>
   	<classpathentry kind="lib" path="config"/>
  -	<classpathentry kind="lib" path="framework/src/descriptor"/>
  -	<classpathentry kind="lib" path="contrib/src/descriptor"/>
  +	<classpathentry exported="true" kind="lib" path="framework/src/descriptor"/>
  +	<classpathentry exported="true" kind="lib" path="portlet/src/descriptor"/>
  +	<classpathentry exported="true" kind="lib" path="contrib/src/descriptor"/>
   	<classpathentry sourcepath="JRE_SRC" kind="var" path="JRE_LIB"/>
   	<classpathentry kind="var" path="JYTHON_DIR/jython.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/bsf-2.3.0.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/commons-codec-1.3.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/commons-fileupload-1.0.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/commons-lang-2.0.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/commons-logging-1.0.4.jar"/>
  +	<classpathentry exported="true" kind="lib" path="ext-package/lib/bsf-2.3.0.jar"/>
  +	<classpathentry exported="true" kind="lib" path="ext-package/lib/commons-codec-1.3.jar"/>
  +	<classpathentry exported="true" kind="lib" path="ext-package/lib/commons-fileupload-1.0.jar"/>
  +	<classpathentry exported="true" kind="lib" path="ext-package/lib/commons-lang-2.0.jar"/>
  +	<classpathentry exported="true" kind="lib" path="ext-package/lib/commons-logging-1.0.4.jar"/>
   	<classpathentry kind="lib" path="ext-package/lib/easymock-1.1.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/javassist-3.0-rc-1.jar"/>
  +	<classpathentry exported="true" kind="lib" path="ext-package/lib/javassist-3.0-rc-1.jar"/>
   	<classpathentry kind="lib" path="ext-package/lib/jdom-1.0.jar"/>
   	<classpathentry kind="lib" path="ext-package/lib/junit-3.8.1.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/log4j-1.2.8.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/ognl-2.6.7.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/oro-2.0.8.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/servletapi-2.3.jar"/>
  +	<classpathentry exported="true" kind="lib" path="ext-package/lib/log4j-1.2.8.jar"/>
  +	<classpathentry exported="true" kind="lib" path="ext-package/lib/ognl-2.6.7.jar"/>
  +	<classpathentry exported="true" kind="lib" path="ext-package/lib/oro-2.0.8.jar"/>
  +	<classpathentry exported="true" kind="lib" path="ext-package/lib/servletapi-2.3.jar"/>
   	<classpathentry kind="lib" path="ext-package/lib/cglib-full-2.0.2.jar"/>
   	<classpathentry kind="lib" path="ext-package/lib/easymockclassextension-1.1.jar"/>
   	<classpathentry kind="lib" path="ext-package/lib/jboss-j2ee-3.2.1.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/hivemind-1.1-alpha-3-snapshot.jar"/>
  -	<classpathentry kind="lib" path="ext-package/lib/hivemind-lib-1.1-alpha-3-snapshot.jar"/>
  -	<classpathentry kind="lib" path="portlet/src/descriptor"/>
  +	<classpathentry exported="true" kind="lib" path="ext-package/lib/hivemind-1.1-alpha-3-snapshot.jar"/>
  +	<classpathentry exported="true" kind="lib" path="ext-package/lib/hivemind-lib-1.1-alpha-3-snapshot.jar"/>
   	<classpathentry kind="lib" path="ext-package/lib/portlet-api-1.0.jar"/>
   	<classpathentry kind="lib" path="ext-package/lib/jcharts-0.6.0.jar"/>
   	<classpathentry kind="output" path="bin"/>
  
  
  
  1.4       +1 -4      jakarta-tapestry/examples/Workbench/src/java/org/apache/tapestry/workbench/WorkbenchHomeService.java
  
  Index: WorkbenchHomeService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/examples/Workbench/src/java/org/apache/tapestry/workbench/WorkbenchHomeService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WorkbenchHomeService.java	6 Jan 2005 02:17:29 -0000	1.3
  +++ WorkbenchHomeService.java	18 Mar 2005 23:43:20 -0000	1.4
  @@ -16,8 +16,6 @@
   
   import java.io.IOException;
   
  -import javax.servlet.ServletException;
  -
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.engine.HomeService;
   import org.apache.tapestry.request.ResponseOutputStream;
  @@ -32,8 +30,7 @@
   
   public class WorkbenchHomeService extends HomeService
   {
  -    public void service(IRequestCycle cycle, ResponseOutputStream output)
  -            throws ServletException, IOException
  +    public void service(IRequestCycle cycle, ResponseOutputStream output) throws IOException
       {
           Visit visit = (Visit) cycle.getEngine().getVisit();
   
  
  
  
  1.5       +60 -70    jakarta-tapestry/framework/src/java/org/apache/tapestry/request/ResponseOutputStream.java
  
  Index: ResponseOutputStream.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/request/ResponseOutputStream.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ResponseOutputStream.java	8 Mar 2005 15:36:36 -0000	1.4
  +++ ResponseOutputStream.java	18 Mar 2005 23:43:20 -0000	1.5
  @@ -26,49 +26,48 @@
   import org.apache.tapestry.web.WebResponse;
   
   /**
  - *  A special output stream works with a {@link HttpServletResponse}, buffering
  - *  data so as to defer opening the response's output stream.
  - *
  - *  <p>The buffering is pretty simple because the code
  - *  between {@link org.apache.tapestry.IMarkupWriter} and this shows lots of buffering
  - *  after the <code>PrintWriter</code> and inside the <code>OutputStreamWriter</code> that
  - *  can't be configured.
  - *
  - *  <p>This class performs some buffering, but it is not all that
  - *  useful because the 
  - *  {@link org.apache.tapestry.html.Body} component (which will
  - *  be used on virtually all Tapestry pages), buffers its wrapped contents
  - *  (that is, evertyhing inside the &lt;body&gt; tag in the generated HTML).
  - *
  - *  @author Howard Lewis Ship
  + * A special output stream works with a {@link HttpServletResponse}, buffering data so as to defer
  + * opening the response's output stream.
  + * <p>
  + * The buffering is pretty simple because the code between {@link org.apache.tapestry.IMarkupWriter}
  + * and this shows lots of buffering after the <code>PrintWriter</code> and inside the
  + * <code>OutputStreamWriter</code> that can't be configured.
  + * <p>
  + * This class performs some buffering, but it is not all that useful because the
  + * {@link org.apache.tapestry.html.Body}component (which will be used on virtually all Tapestry
  + * pages), buffers its wrapped contents (that is, evertyhing inside the &lt;body&gt; tag in the
  + * generated HTML).
    * 
  - **/
  + * @author Howard Lewis Ship
  + */
   
   public class ResponseOutputStream extends OutputStream
   {
       private static final Log LOG = LogFactory.getLog(ResponseOutputStream.class);
   
       /**
  -     *  Default size for the buffer (2000 bytes).
  -     *
  -     **/
  +     * Default size for the buffer (2000 bytes).
  +     */
   
       public static final int DEFAULT_SIZE = 2000;
   
       private int _pos;
  +
       private int _maxSize;
  +
       private byte[] _buffer;
   
       private String _contentType;
  +
       private WebResponse _response;
  +
       private OutputStream _out;
   
       private boolean _discard = false;
   
       /**
  -     *  Creates the stream with the default maximum buffer size.
  -     *
  -     **/
  +     * Creates the stream with the default maximum buffer size.
  +     */
   
       public ResponseOutputStream(WebResponse response)
       {
  @@ -76,9 +75,8 @@
       }
   
       /**
  -     *  Standard constructor.
  -     *
  -     **/
  +     * Standard constructor.
  +     */
   
       public ResponseOutputStream(WebResponse response, int maxSize)
       {
  @@ -87,10 +85,9 @@
       }
   
       /**
  -     *  Does nothing.  This is because of chaining of <code>close()</code> from
  -     *  {@link org.apache.tapestry.IMarkupWriter#close()} ... see {@link #flush()}.
  -     * 
  -     **/
  +     * Does nothing. This is because of chaining of <code>close()</code> from
  +     * {@link org.apache.tapestry.IMarkupWriter#close()}... see {@link #flush()}.
  +     */
   
       public void close() throws IOException
       {
  @@ -98,17 +95,15 @@
       }
   
       /**
  -     *  Flushes the underlying output stream, if is has been opened.  
  -     *
  -     *  <p>This method explicitly <em>does not</em> flush the internal buffer ...
  -     *  that's because when an {@link org.apache.tapestry.IMarkupWriter} is closed (for instance, because
  -     *  an exception is thrown), that <code>close()</code> spawns <code>flush()</code>es
  -     *  and <code>close()</code>s throughout the output stream chain, eventually
  -     *  reaching this method.
  -     *
  -     *  @see #forceFlush()
  -     *
  -     **/
  +     * Flushes the underlying output stream, if is has been opened.
  +     * <p>
  +     * This method explicitly <em>does not</em> flush the internal buffer ... that's because when
  +     * an {@link org.apache.tapestry.IMarkupWriter}is closed (for instance, because an exception is
  +     * thrown), that <code>close()</code> spawns <code>flush()</code> es and
  +     * <code>close()</code> s throughout the output stream chain, eventually reaching this method.
  +     * 
  +     * @see #forceFlush()
  +     */
   
       public void flush() throws IOException
       {
  @@ -124,18 +119,17 @@
       }
   
       /**
  -     *  Writes the internal buffer to the output stream, opening it if necessary, then
  -     *  flushes the output stream.  Future writes will go directly to the output stream.
  -     *
  -     **/
  +     * Writes the internal buffer to the output stream, opening it if necessary, then flushes the
  +     * output stream. Future writes will go directly to the output stream.
  +     */
   
       public void forceFlush() throws IOException
       {
           if (_out == null)
           {
   
  -            // In certain cases (such as when the Tapestry service sends a redirect),
  -            // there is no output to send back (and no content type set).  In this
  +            // In certain cases (such as when an engine service sends a redirect),
  +            // there is no output to send back (and no content type set). In this
               // case, forceFlush() does nothing.
   
               if (_buffer == null)
  @@ -150,7 +144,7 @@
           }
           catch (SocketException ex)
           {
  -            LOG.debug("Socket exception.");
  +            LOG.debug("Socket exception: " + ex.toString());
           }
       }
   
  @@ -165,14 +159,13 @@
       }
   
       /**
  -     *  Sets the response type to from the contentType property (which
  -     *  defaults to "text/html") and gets an output stream
  -     *  from the response, then writes the current buffer to it and
  -     *  releases the buffer.
  -     *
  -     *  @throws IOException if the content type has never been set.
  -     *
  -     **/
  +     * Sets the response type to from the contentType property (which defaults to "text/html") and
  +     * gets an output stream from the response, then writes the current buffer to it and releases
  +     * the buffer.
  +     * 
  +     * @throws IOException
  +     *             if the content type has never been set.
  +     */
   
       private void open() throws IOException
       {
  @@ -190,12 +183,11 @@
       }
   
       /**
  -     *  Discards all output in the buffer.  This is used after an error to
  -     *  restart the output (so that the error may be presented).
  -     *
  -     *  <p>Clears the discard flag.
  -     *
  -     **/
  +     * Discards all output in the buffer. This is used after an error to restart the output (so that
  +     * the error may be presented).
  +     * <p>
  +     * Clears the discard flag.
  +     */
   
       public void reset() throws IOException
       {
  @@ -204,11 +196,9 @@
       }
   
       /**
  -     *  Changes the maximum buffer size.  If the new buffer size is smaller
  -     *  than the number of
  -     *  bytes already in the buffer, the buffer is immediately flushed.
  -     *
  -     **/
  +     * Changes the maximum buffer size. If the new buffer size is smaller than the number of bytes
  +     * already in the buffer, the buffer is immediately flushed.
  +     */
   
       public void setBufferSize(int value) throws IOException
       {
  @@ -227,9 +217,8 @@
       }
   
       /**
  -     *  Indicates whether the stream should ignore all data written to it.
  -     *
  -     **/
  +     * Indicates whether the stream should ignore all data written to it.
  +     */
   
       public void setDiscard(boolean value)
       {
  @@ -291,7 +280,8 @@
           // This method is rarely called so this little inefficiency is better than
           // maintaining that ugly buffer expansion code in two places.
   
  -        byte[] tiny = new byte[] {(byte) b };
  +        byte[] tiny = new byte[]
  +        { (byte) b };
   
           write(tiny, 0, 1);
       }
  
  
  

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