3 Replies Latest reply on Jul 4, 2009 3:41 PM by Nick Belaevski

    Filters not working when using RichFaces

    Christopher Davies Newbie

      Hi,

      I have a filter that I've been using successfully for years, but now I am using RichFaces (3.3.1GA) I can no longer use it.

      The problem seems to be related to the filter chaining but that's just a guess. Maybe I am just doing something stupid.

      Below is my filter code. As you can see it simply checks is the session contains a user id attribute, if found then it just calls the filter chain, if not set then it forwards to the login page:

      public void doFilter(ServletRequest req, ServletResponse res,
      FilterChain chain) throws IOException, ServletException {

      Log.info("Running login security check filter");
      HttpSession session = ((HttpServletRequest) req).getSession();
      if (session != null && session.getAttribute(Constants.Key_uid) != null) {
      Log.debug("Logged in user is: "
      + session.getAttribute(Constants.Key_uid));
      chain.doFilter(req, res);
      } else {
      Log.info("Not logged in");
      RequestDispatcher rd
      =req.getRequestDispatcher(ConfigUtils.getParameter(Constants.Param_LoginPage));
      rd.forward(req, res);
      }
      }


      The stack trace is showing some strange errors:

      INFO: Not logged in
      04/07/2009 4:42:18 PM org.apache.catalina.core.ApplicationDispatcher invoke
      SEVERE: Servlet.service() for servlet Faces Servlet threw exception
      javax.faces.FacesException: Error decode resource data
      at org.ajax4jsf.resource.ResourceBuilderImpl.decrypt(ResourceBuilderImpl.java:627)
      at org.ajax4jsf.resource.ResourceBuilderImpl.getResourceDataForKey(ResourceBuilderImpl.java:369)
      at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:156)
      at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:141)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:488)
      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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
      at com.trm.security.filters.LoginCheckFilter.doFilter(LoginCheckFilter.java:56)
      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.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Unknown Source)
      Caused by: java.util.zip.DataFormatException: unknown compression method
      at java.util.zip.Inflater.inflateBytes(Native Method)
      at java.util.zip.Inflater.inflate(Unknown Source)
      at java.util.zip.Inflater.inflate(Unknown Source)
      at org.ajax4jsf.resource.ResourceBuilderImpl.decrypt(ResourceBuilderImpl.java:621)
      ... 23 more