You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Arne Brutschy <ma...@studserv.uni-leipzig.de> on 2003/11/17 16:14:08 UTC
Re[2]: Strange things happen to my servlet path..
Hello,
Monday, November 17, 2003, 4:08:26 PM, you wrote:
>> From: Arne Brutschy [mailto:mai01cvr@studserv.uni-leipzig.de]
>> The conclusion is, that something is wrong with filter. I'm not sure,
>> but using <url-pattern>/*</url-pattern> as pattern protects the
>> resources as well, doesn't it? So using such a generic pattern is not
>> possible for me, as the login page should have some colors.. :)
WS> You could put code in your Filter to detect the sort of thing being
WS> requested. If the URL ends in .jpg or .css then just return
WS> immediately.
Yes, I just came up with this solution myself! :) Thanks anyway. I'm
implemented it like this:
public final static String[] LOGIN_FILTER_WHITELIST = new String[] { "/images/.*\\.jpg",
"/images/.*\\.gif",
"/.*\\.css",
"/template/errorpage\\.jsp"};
.
.
private boolean checkWhiteList(String path) {
for (int i = 0; i < Constants.LOGIN_FILTER_WHITELIST.length; i++) {
if (path.matches(Constants.LOGIN_FILTER_WHITELIST[i]))
return true;
}
return false;
}
.
.
HttpServletRequest httpRequest = (HttpServletRequest)request;
if (checkWhiteList(httpRequest.getServletPath())) {
chain.doFilter(request, response);
return;
}
>> Is there a possibility to define an exclude list? A pattern of
>> <url-pattern>/*.jps</url-pattern> didn't seem to work.
WS> No exclusions that I'm aware of-- it's not a regular expression, either.
WS> Is that at typo, did you mean *.jsp? And what's the leading slash for?
WS> With that slash, I think /*.jps is exactly the same as /*, it stops
WS> parsing when it gets that far.
Oh, thanks, I missed that. I'll fix that.. Great, all fine now!
Thanks.
Regards,
Arne
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re[3]: Strange things happen to my servlet path..
Posted by Arne Brutschy <ma...@studserv.uni-leipzig.de>.
Hello,
Monday, November 17, 2003, 4:14:08 PM, Arne wrote:
WS>> No exclusions that I'm aware of-- it's not a regular expression, either.
WS>> Is that at typo, did you mean *.jsp? And what's the leading slash for?
WS>> With that slash, I think /*.jps is exactly the same as /*, it stops
WS>> parsing when it gets that far.
You cannot use <url-pattern>*</url-pattern> in a filter mapping, it
has to be <url-pattern>/*</url-pattern>. Tomcat dumps at this pattern
if I use it without a slash. And with a slash, it is parsing
subdirectories, as my images are in /images and haven't been loaded..
Regards,
Arne
PS: sorry for double-sending (I'm not even sure if I did), but my
mailer is quite buggy. :(
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org