This content has been marked as final.
Show 2 replies
-
1. Re: Need access to HttpServletResponse object within a seam component without using FacesContext
kfletcher2005 Jan 13, 2010 10:01 PM (in response to kfletcher2005)I'm mainly looking to expose the HttpServletResponse object in my seam remoting component without introducing FacesContext since we are using GWT in this shop.
-
2. Re: Need access to HttpServletResponse object within a seam component without using FacesContext
kfletcher2005 Jan 13, 2010 10:30 PM (in response to kfletcher2005)I'm looking at seam source code here which exposes the request via static method but not the response... This would be an ideal solution to my problem bypassing the FacesContext.
/** * A Seam component that binds the HttpServletRequest object * to the current thread. * * @author Gavin King */ @Scope(ScopeType.EVENT) @Name("org.jboss.seam.web.servletContexts") @BypassInterceptors @Install(precedence=BUILT_IN) public class ServletContexts { private HttpServletRequest request; public static ServletContexts instance() { if ( !Contexts.isEventContextActive() ) { throw new IllegalStateException("no event context active"); } return (ServletContexts) Component.getInstance(ServletContexts.class, ScopeType.EVENT); } public static ServletContexts getInstance() { return Contexts.isEventContextActive() ? (ServletContexts) Component.getInstance(ServletContexts.class, ScopeType.EVENT) : null; } public HttpServletRequest getRequest() { return request; } public void setRequest(HttpServletRequest request) { this.request = request; } }
Just curious why HttpServletResponse is omitted?