| Author |
Filter mapping based on query string
|
siva kumar
Ranch Hand
Joined: May 02, 2004
Posts: 118
|
|
Hi Friends, Can you please clarify on the below 1.) can I do a filter mapping based on query string something like <Filter-mapping>/servletname?s=1</Filter-mapping> 2.) In the response header can I get the servlet name which has generated this response. Thanks Kumar
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26218
|
|
Kumar, I don't think you can match on parameters in the filter mapping. It seems simple enough to try though. What happens when you try it?
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
1. No, it won't work. I don't know how the container will react, but it's not a valid url pattern. By the way, you don't put url patterns directly in the filter-mapping tag, but in the url-pattern tag of the filter-mapping tag. What you could try is : and check if s=1 in the filter.
|
[My Blog]
All roads lead to JavaRanch
|
 |
siva kumar
Ranch Hand
Joined: May 02, 2004
Posts: 118
|
|
Hi, Sorry I typed the tags wrongly, Yes you are right I couldnt do it in tomcat I think it is not possible. Thanks for your response anyway
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
You can't map it according to querystring variables but you can read the variables from within your filter and branch accordingly.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
siva kumar
Ranch Hand
Joined: May 02, 2004
Posts: 118
|
|
Thanks Ben, I am done with my filter development.
|
 |
 |
|
|
subject: Filter mapping based on query string
|
|
|