[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-3769) org.jboss.seam.ui.facelet.RendererRequest replaces HttpServletXXX with MockHttpServletXXX

Samuel Mendenhall (JIRA) jira-events at lists.jboss.org
Mon Jul 27 16:33:29 EDT 2009


     [ https://jira.jboss.org/jira/browse/JBSEAM-3769?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Samuel Mendenhall updated JBSEAM-3769:
--------------------------------------

    Attachment: RendererRequest.diff


> org.jboss.seam.ui.facelet.RendererRequest replaces HttpServletXXX with MockHttpServletXXX
> -----------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-3769
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3769
>             Project: Seam
>          Issue Type: Bug
>          Components: JSF Integration
>    Affects Versions: 2.1.1.CR1
>         Environment: Mac OS X 10.5.5
> JBoss AS 4.2.3.GA
> JBoss Seam 2.1.1.CR1
> Java 6
>            Reporter: Kenneth Christensen
>            Priority: Minor
>         Attachments: MockHttpServletRequest.diff, MockHttpServletRequest.diff, RendererRequest.diff, RendererRequest.diff
>
>
> Seam 2.0.3:
>       private void init()
>       {
>          // Make sure we are using the correct ClassLoader
>          originalClassLoader = Thread.currentThread().getContextClassLoader();
>          Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
>          // If a FacesContext isn't available, set one up
>          if (FacesContext.getCurrentInstance() == null)
>          {
>             MockFacesContext mockFacesContext = new MockFacesContext(new MockExternalContext(new MockServletContext()))
>                      .setCurrent();
>             mockFacesContext.createViewRoot();
>          }
>          FacesContext facesContext = FacesContext.getCurrentInstance();
>          // Wrap the ResponseWriter
>          originalResponseWriter = facesContext.getResponseWriter();
>          facesContext.setResponseWriter(facesContext.getRenderKit().createResponseWriter(writer,
>                   null, null));
>          // Create a new UIViewRoot
>          originalViewRoot = facesContext.getViewRoot();
>          UIViewRoot viewRoot = new UIViewRoot();
>          viewRoot.setRenderKitId(facesContext.getApplication().getViewHandler().calculateRenderKitId(facesContext));
>          viewRoot.setViewId(viewId);
>          viewRoot.setLocale(originalViewRoot.getLocale());
>          facesContext.setViewRoot(viewRoot);
>       }
> Seam 2.1.1.CR1:
>    private void init()
>    {
>       request = new MockHttpServletRequest(HttpSessionManager.instance());
>       response = new MockHttpServletResponse();
>       
>       // Generate the FacesContext from the JSF FacesContextFactory
>       originalFacesContext = FacesContext.getCurrentInstance();
>       facesContext = RendererFacesContextFactory.instance().getFacesContext(request, response);
>       DelegatingFacesContext.setCurrentInstance(facesContext);
>       
>       // Create the viewRoot
>       UIViewRoot newRoot = facesContext.getApplication().getViewHandler().createView(facesContext, viewId);
>       facesContext.setViewRoot(newRoot);
>       
>       // Set the responseWriter to write to a buffer
>       writer = new StringWriter();
>       facesContext.setResponseWriter(facesContext.getRenderKit().createResponseWriter(writer,
>       null, null));
>    }
> As you can see, Seam 2.1.1.CR1 never checks for the original FacesContext, but creates a new FacesContext which includes the MockHttpServletXXX.
> It's a problem for the application I'm developing, because I need the external context (HttpServletResponse) when I'm using the renderer.render("/abc/xyz.xhtml").
> It works fine with Seam 2.0.3, but not with Seam 2.1.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list