You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by webzo <we...@yahoo.com> on 2007/05/11 01:41:42 UTC

url-pattern troubles...

Ok, this should have been simple. But Tomcat doesn't seem to be doing what I thought it would-
I have a bunch of jsp files under a directory called "protected". I want a filter to be invoked when these files are accessed. I also have a directory called "includes" under "protected". I DON'T want the filter to be invoked when files under "includes" are accessed. I cannot change this directory structure. I used the pattern "/protected/*.jsp" for the filter in question and hoped  that Tomcat will realize that I want the filter invoked only for those files under "protected". However, Tomcat doesn't like the pattern (I get a stacktrace- Invalid url-pattern...). Tomcat doesn't complain about "/*.jsp" or "/protected/*" (except it invokes the filter for all the files under "/protected/includes"), but it complains about "/protected/*.jsp". So, whats the pattern to use?

Thanks,

Av.




 
____________________________________________________________________________________
Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: url-pattern troubles...

Posted by "Reich, Matthias" <ma...@siemens.com>.
The annoying thing about it is, that you cannot use a pattern that says
"ignore /protected/include".
Thus, you must specify patterns for all subdirectories that shall be
protected separately.
 
Matthias

> -----Original Message-----
> From: Hassan Schroeder [mailto:hassan.schroeder@gmail.com] 
> Sent: Friday, May 11, 2007 2:45 AM
> To: Tomcat Users List
> Subject: Re: url-pattern troubles...
> 
> On 5/10/07, webzo <we...@yahoo.com> wrote:
> > Ok, this should have been simple. But Tomcat doesn't seem 
> to be doing what I thought it would-
> > I have a bunch of jsp files under a directory called 
> "protected". I want a filter to be invoked when these files 
> are accessed. I also have a directory called "includes" under 
> "protected". I DON'T want the filter to be invoked when files 
> under "includes" are accessed. I cannot change this directory 
> structure. I used the pattern "/protected/*.jsp" for the 
> filter in question
> 
> BZZZT. See the Servlet Spec -- SRV.11.2 Your pattern is invalid (and
> so is "/*.jsp" -- if that actually worked, it's a bug.)
> 
> The url-pattern isn't a wide-open regexp, so I think you'll have to
> change your Filter to ignore the "includes" subdirectory, unless you
> can differentiate based on the request type (client request, forward,
> include -- see SRV.6.2.5).
> 
> HTH,
> -- 
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: url-pattern troubles...

Posted by Hassan Schroeder <ha...@gmail.com>.
On 5/10/07, webzo <we...@yahoo.com> wrote:
> Ok, this should have been simple. But Tomcat doesn't seem to be doing what I thought it would-
> I have a bunch of jsp files under a directory called "protected". I want a filter to be invoked when these files are accessed. I also have a directory called "includes" under "protected". I DON'T want the filter to be invoked when files under "includes" are accessed. I cannot change this directory structure. I used the pattern "/protected/*.jsp" for the filter in question

BZZZT. See the Servlet Spec -- SRV.11.2 Your pattern is invalid (and
so is "/*.jsp" -- if that actually worked, it's a bug.)

The url-pattern isn't a wide-open regexp, so I think you'll have to
change your Filter to ignore the "includes" subdirectory, unless you
can differentiate based on the request type (client request, forward,
include -- see SRV.6.2.5).

HTH,
-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: url-pattern troubles...

Posted by Martin Gainty <mg...@hotmail.com>.
in /WEB-INF/web.xml you have something like
<servlet>
      <servlet-name>ServletName</servlet-name>
      <servlet-class>package.ServletClass</servlet-class>
 </servlet>
<servlet-mapping>
        <servlet-name>ServletName</servlet-name>
        <url-pattern>/servlet/Servlet</url-pattern>
 </servlet-mapping>

/servlet/Servlet maps to 'ServletName' identifier
'ServletName' identifier is served by package.ServletClass

M--
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "webzo" <we...@yahoo.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Thursday, May 10, 2007 7:41 PM
Subject: url-pattern troubles...


> Ok, this should have been simple. But Tomcat doesn't seem to be doing what 
> I thought it would-
> I have a bunch of jsp files under a directory called "protected". I want a 
> filter to be invoked when these files are accessed. I also have a 
> directory called "includes" under "protected". I DON'T want the filter to 
> be invoked when files under "includes" are accessed. I cannot change this 
> directory structure. I used the pattern "/protected/*.jsp" for the filter 
> in question and hoped  that Tomcat will realize that I want the filter 
> invoked only for those files under "protected". However, Tomcat doesn't 
> like the pattern (I get a stacktrace- Invalid url-pattern...). Tomcat 
> doesn't complain about "/*.jsp" or "/protected/*" (except it invokes the 
> filter for all the files under "/protected/includes"), but it complains 
> about "/protected/*.jsp". So, whats the pattern to use?
>
> Thanks,
>
> Av.
>
>
>
>
>
> ____________________________________________________________________________________
> Food fight? Enjoy some healthy debate
> in the Yahoo! Answers Food & Drink Q&A.
> http://answers.yahoo.com/dir/?link=list&sid=396545367
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org