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

Christian Bauer (JIRA) jira-events at lists.jboss.org
Tue Dec 8 04:32:30 EST 2009


    [ https://jira.jboss.org/jira/browse/JBSEAM-3769?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12498742#action_12498742 ] 

Christian Bauer commented on JBSEAM-3769:
-----------------------------------------

I still need the following rollback patch to make this work. Whoever committed the fix for this issue, please test it again.

Index: ui/src/main/java/org/jboss/seam/ui/facelet/RendererRequest.java
===================================================================
--- ui/src/main/java/org/jboss/seam/ui/facelet/RendererRequest.java	(revision 11312)
+++ ui/src/main/java/org/jboss/seam/ui/facelet/RendererRequest.java	Sun Oct 04 11:35:39 CEST 2009
@@ -50,6 +50,7 @@
       setContextClassLoader();
       
       // If a FacesContext isn't available, set one up
+/*
       if (FacesContext.getCurrentInstance() == null)
       {
          facesContext = RendererFacesContextFactory.instance().getFacesContext(request, response);
@@ -58,9 +59,11 @@
       {
          facesContext = FacesContext.getCurrentInstance();
       }
+*/
 
       // Generate the FacesContext from the JSF FacesContextFactory
       originalFacesContext = FacesContext.getCurrentInstance();
+      facesContext = RendererFacesContextFactory.instance().getFacesContext(request, response);
       DelegatingFacesContext.setCurrentInstance(facesContext);
 
       // Create the viewRoot


> 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, 2.2.0.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
>            Assignee: Samuel Mendenhall
>            Priority: Minor
>             Fix For: 2.2.1.CR1
>
>         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