1 Reply Latest reply on Aug 24, 2004 3:07 AM by camel

    Regular expression problem

    ltcmelo

      Hi,
      i'm trying to use a regular expression in my web.xml deployment descriptor, but i'm getting a error at deploy time.

      Here's what i wanna do:
      I have a servlet filter that must be executed for ALL urls of my application except for the login.jsp. Then, i tried something like this (and other variations).

       <filter-mapping>
       <filter-name>InitializationFilter</filter-name>
       <url-pattern>/*&&[^/login.jsp]</url-pattern>
       </filter-mapping>
      


      I also tried some very simple regular exception, but JBoss would always give me a deploy error.

      What am i doing wrong???

        • 1. Re: Regular expression problem
          camel

           

          "ltcmelo" wrote:
          <filter-mapping>
          <filter-name>InitializationFilter</filter-name>
          <url-pattern>/*&&[^/login.jsp]</url-pattern>
          </filter-mapping>
          ...
          What am i doing wrong???


          I don't think the servlet spec supports regexes. It just supports the "*.jsp" and "/foo/*" style patterns. Note that some servlet engines (e.g. Resin) do support more than the spec says, but Tomcat seems to stick to the spec.

          What I did once was write a filter that takes an init-param with a regex that I check myself (in my filter), and then apply it to /foo/*, etc.