This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic path configuration/resolving

 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a strange requirement herem, not sure if I can explain it properly, but let me try - I need to display different set of sites with dyamic paths such as -

http://xyz.com/people/1234/index.do?someparams=pqr
http://xyz.com/people/5678/index.do?someparams=pqr
http://xyz.com/people/1234/photos.do
http://xyz.com/people/5678/photos.do

Now - the NOS here (1234 or 5678) will be generated dynamially and the action will be requested - but they should resolve to the same action say - http://xyz.com/people/index.do?someparams=pqr and the action should also get the requested number in the path. Obviously it is not possible to add configurations for all those dynamic numbers, so there has to be only one action mapped here.

So what I want is this http://xyz.com/people/1234/index.do?someparams=pqr should resolve to http://xyz.com/people/index.do?someparams=pqr and it should also get "1234" as part of the info.

How can I achieve this?? I have not done this before but I think this sort of path manipulation should be possible.

Any pointers, help would be highly appreciated!

TIA,
- Manish
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One possibility would be to create a Servlet Filter. By doing so, you can read the URI, examine it, and then forward to a different URI. So, for example, you could read a URI like
http://xyz.com/people/1234/index.do?someparams=pqr
and then forward to
http://xyz.com/people/index.do?Id=1234&someparams=pqr

For more information on Servlet Filters, see chapter 11 of the Sun J2EE 1.4 Tutorial.
 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, that should help!! Thanks a ton!!!

- Manish
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic