-
1. Re: Seam custom filter called 8 times
seamworker Jan 21, 2011 9:04 AM (in response to seamworker)Anybody there?
-
2. Re: Seam custom filter called 8 times
jeanluc Jan 21, 2011 10:16 AM (in response to seamworker)I suspect something is wrong with the declaration. Post your filter source (you can remove any specific functionality, I'm primarily interested in the declarations and the flow).
-
3. Re: Seam custom filter called 8 times
seamworker Jan 21, 2011 12:17 PM (in response to seamworker)Here is the Custom Filter code:
import org.jboss.seam.web.AbstractFilter; @Filter(within = "org.jboss.seam.web.exceptionFilter") @Name("ivUserAuthenticationFilter") @Scope(ScopeType.APPLICATION) @Startup @BypassInterceptors public class UserAuthenticationFilter extends AbstractFilter{ public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { //business logic chain.doFilter(request, response); //chain.doFilter(..) repeatedly calls the same method for 8 times } }
Nothing else is written supporting this.
in Web.xml SeamFilter is configured to run for each request<filter> <filter-name>Seam Filter</filter-name> <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class> </filter> <filter-mapping> <filter-name>Seam Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
Please let me know if more information required. Thank you.
-
4. Re: Seam custom filter called 8 times
jeanluc Jan 21, 2011 2:07 PM (in response to seamworker)What happens if you change the within declaration to
@Filter(within = {"org.jboss.seam.web.authenticationFilter"})
?
That's what I use for several filters and they are only executed once per request.
-
5. Re: Seam custom filter called 8 times
antibrumm.mfrey0.bluewin.ch Jan 25, 2011 7:15 AM (in response to seamworker)Hi
i was just wondering if you have some pictures and other referenced objects in your html? Because i had a similar issue and in the end i found out that the filter was called on each request, which also includes images, js, css, etc. :)Probalby its enough to restrict the filter with this ?
public String getRegexUrlPattern() { return "(^/.*.seam)|(^/[0-9a-zA-Z]+$)"; }
-
6. Re: Seam custom filter called 8 times
cash1981 Jan 25, 2011 10:42 AM (in response to seamworker)Try adding in the doFilter method, at the beginning.
if (!(req instanceof HttpServletRequest)) { chain.doFilter(req, res); return; }
or
if (HttpServletRequest.class.isAssignableFrom(request.getClass())) { //your code here }