File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

filtering a request

 
Pawanpreet Singh
Ranch Hand
Posts: 264
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everybody,

I need your help for writing a filter for changing the request path for a servlet. Suppose i pass a request

http://localhost:8080/periodicals/electronicsforyou/journal

instead of

http://localhost:8080/periodicals?param1=electronicsforyou¶m2=journal

I want that user type the first url with request path periodicals/electronicsforyou/journal and finally the filter convert that request path into ?param1=electronicsforyou¶m2=journal.

Is it possible. Could you please advise.

Sincerely,
Pawan
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It this was an Apache httpd with mod_rewrite it would be so easy...
 
Pawanpreet Singh
Ranch Hand
Posts: 264
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can i use Servlet Filters in this case?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can, and there is a servlet filter clone of Apache mod_rewrite, which may do what you need done: Url Rewrite Filter
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
But you can also use a simple servlet to do that if you have only this url to rewrite!

In this servlet you just forward to the good url!
 
Ahmed Salah
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can add simple code in doGet method that tests for these QueryString variables if they are null redirect him to the second path
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic