• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Route requests by address

 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all
I would like to route part requests to specific Action,
For example:
For addresses finish with mng:
http://localhost:8080/myapp/mng -> Route the request to MngAction

For addresses finish with upl:
http://localhost:8080/myapp/upl -> Route the request to UploadAction

mng & upl doesn't really exist on my file system.

currently the configuration in the web.xml is :


So every ".do" request routed to the ActionServlet.
When a user wishes to go to the upload page,
he will enter the "upl" suffix,(without the ".do" part). he will just enter: "http://localhost:8080/myapp/upl"

What is the correct way to achieve this?
Any help will be appreciated deeply!
Thank you.
Sharon
[ September 09, 2007: Message edited by: Sharon whipple ]
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One possibility would be to create a servlet filter. In this filter, you could have logic that would read and analyze the incoming URL and change it to something else. For example, you could read the URL http://localhost:8080/myapp/upl and change it to http://localhost:8080/myapp/upl.do so that Struts would know what to do with it.
 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did it using mapping insted of filter :



Then in the actionUpl I forwarded the request to the desired servlet


Thank you!
[ September 11, 2007: Message edited by: Sharon whipple ]
reply
    Bookmark Topic Watch Topic
  • New Topic