aspose file tools*
The moose likes Servlets and the fly likes Multiple url-pattern in filter-mapping OC4j 10.1.3.3 Servlet 2.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Multiple url-pattern in filter-mapping OC4j 10.1.3.3 Servlet 2.5" Watch "Multiple url-pattern in filter-mapping OC4j 10.1.3.3 Servlet 2.5" New topic
Author

Multiple url-pattern in filter-mapping OC4j 10.1.3.3 Servlet 2.5

Greg Werner
Ranch Hand

Joined: May 07, 2009
Posts: 54
Hi all,

I can not get the multiple url-pattern to work. Maybe I misunderstand what is provided in 2.5. Let me give you what I am trying and someone can tell me how badly I have misread the new features



And at the top ...



In this case only the last url-pattern listed is applied, not all of them as I want.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
I'm pretty sure you need to list them as:
Greg Werner
Ranch Hand

Joined: May 07, 2009
Posts: 54
I tried the comma as suggested and now neither path works
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
Ah, sorry. I don't know where I saw that. I just tried something similar for servlet mappings in an IDE and it created multiple <servlet-mapping> element blocks. Can you try that? For example:Sorry for my misdirection.
Kris Schneider
Ranch Hand

Joined: Feb 14, 2001
Posts: 71
Multiple <url-pattern> elements should be fine, but the value /einwenig/*.jsp isn't really a valid pattern. See SRV.11.2 of the Servlet 2.5 Spec.
Greg Werner
Ranch Hand

Joined: May 07, 2009
Posts: 54
"Ah, sorry. I don't know where I saw that. I just tried something similar for servlet mappings in an IDE and it created multiple <servlet-mapping> element blocks. Can you try that? For example:"

Yes that works just fine, but that is Servlet 2.4 style and I am trying to avoid the problem of extra typing.
Ravishanker kumar
Ranch Hand

Joined: Jul 20, 2006
Posts: 53
multiple url-pattern can be specified using comma separated like


or it can be specified as


it can NOT be specified as


because <url-pattern> element is allowed only once under <filter-mapping> .
Greg Werner
Ranch Hand

Joined: May 07, 2009
Posts: 54
"Multiple <url-pattern> elements should be fine, but the value /einwenig/*.jsp isn't really a valid pattern. See SRV.11.2 of the Servlet 2.5 Spec. "

Thanks for the section in the document. I read it and I agree with you, ths spec does not seem to allow for the pattern I am attempting. I could do *.jsp or I could do /einwenig/* but not /einwenig/*.jsp

My overall problem is that my directory structure is much larger and can not be easily captured with *.jsp and /einwenig/* solutions. I do not wish to apply the filter to all *.jsp files and there are a few directories where I only wish to apply the filter to some of the files. Perhaps I can play around with my directory structure to get /einwenig/* to work but lots of manual work for me ahead.

Just one last shot out there to the community, does the equivalent of /einwenig/*.jsp exist?
Kris Schneider
Ranch Hand

Joined: Feb 14, 2001
Posts: 71
Ravishanker kumar wrote:because <url-pattern> element is allowed only once under <filter-mapping> .


This is the Servlet 2.5 schema definition for <filter-mapping>:


So I respectfully disagree with your statement.
Kris Schneider
Ranch Hand

Joined: Feb 14, 2001
Posts: 71
Greg Werner wrote:Just one last shot out there to the community, does the equivalent of /einwenig/*.jsp exist?


In lieu of rolling your own URL pattern processor, you might want to see if something like UrlRewriteFilter can be of help.
Ravishanker kumar
Ranch Hand

Joined: Jul 20, 2006
Posts: 53
Kris Schneider,
You are absolutely correct, in Servlet 2.5 its allowed. Thanks for this correction
Greg Werner
Ranch Hand

Joined: May 07, 2009
Posts: 54

So I respectfully disagree with your statement.


That is fine, but through actually running my web app,



does not work



does not work



does work. Could be an OC4J thing? I will look at the UrlRewriteFilter thing on Monday. Thanks for the tip.
Kris Schneider
Ranch Hand

Joined: Feb 14, 2001
Posts: 71
Greg Werner wrote:Could be an OC4J thing?


Right, I'm pretty sure that OC4J 10.1.3 is a Servlet 2.4 container. So, you should probably fix up your deployment descriptor to match, but that won't make a difference in terms of the URL pattern you're trying to process...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple url-pattern in filter-mapping OC4j 10.1.3.3 Servlet 2.5