You can match a prefix, or a file extension but not both. So you can do this:

<filter-mapping>
  <filter-name>AdminSection</filter-name>
  <url-pattern>/admin/*</url-pattern>
</filter-mapping>

The Servlet spec has some examples of how URL matching will work.

-Tim

Ryan Parr wrote:
As so many have said before, I'm new to Java and Tomcat. So please
forgive any poor design you see in my code, but please let me know about
it :)

I've created a filter class that handles user authorization. Basically
when a user hits a page the filter is defined for, it checks for a
boolean value in the user's session that describes their access to a
certain auth group.

If the user is not authorized, they are forwarded to a login page
defined as an init-param which handles their authentication for that
group.

This works flawlessly on pages in the root directory, and if I do:
        <url-pattern>/*.jsp</url-pattern>
it operates on every file throughout the hierarchy. This isn't what I
wanted so I defined a url exclusion method, that accepts paths and
regular expressions that the filter tests before processing auth.

I setup a new <filter> for each group/directory. It only works on the
root directory though, and using a url-pattern of /admin/*.jsp doesn't
appear to trigger the filter. It's never run. This happens whether or
not the filter on the root of the context exists.

Thank you very much for any advice you can give!


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to