[jboss-user] [JBoss Seam] - Re: Access Seam Component from Servlet Filter in JSF Request
wadahiro
do-not-reply at jboss.com
Mon Jul 30 08:16:39 EDT 2007
Thank you for your advice.
I made a custom filter that is called inside the Seam context filter.
Although Contexts access that is called before doFilter method of
next filter is successful, the access that is called after doFilter method
cause IllegalStateException because of No active Contexts.
It seems that SeamPhaseListener already destroy Contexts after render response,
so my custom filter can't access the Contexts.
How do I access to Contexts after doFilter method?
My sample code is as follows.
custom filter code is:
| @Startup
| @Scope(ScopeType.APPLICATION)
| @Name("filtertest")
| @BypassInterceptors
| @Filter(within = "org.jboss.seam.web.contextFilter")
| public class FileterTest extends AbstractFilter {
|
| public void doFilter(ServletRequest arg0, ServletResponse arg1,
| FilterChain arg2) throws IOException, ServletException {
| String s = Interpolator.instance().interpolate("#{cookie}");
| System.out.println(s);
| arg2.doFilter(arg0, arg1);
| }
|
| }
|
and WEB-INF/components.xml is:
| <web:context-filter />
|
and console log is:
| 17:13:14,218 INFO [STDOUT] [Ljavax.servlet.http.Cookie;@7baddd
| 17:13:14,250 ERROR [ContextualHttpServletRequest] ended request due to exception
| java.lang.IllegalStateException: No active event context
| at org.jboss.seam.core.Manager.instance(Manager.java:235)
| at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:48)
| at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:39)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:87)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
| at java.lang.Thread.run(Thread.java:595)
| 17:13:14,250 ERROR [ExceptionFilter] handling uncaught exception
| javax.servlet.ServletException: java.lang.IllegalStateException: No active event context
| at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:67)
| at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:39)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:87)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:63)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:46)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:140)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: java.lang.IllegalStateException: No active event context
| at org.jboss.seam.core.Manager.instance(Manager.java:235)
| at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:48)
| ... 27 more
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068697#4068697
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068697
More information about the jboss-user
mailing list