Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

forwarding to a different webApp

 
Vladan Radovanovic
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
Can someone give me some pointers how to forward the request to a servlet or a jsp page but in *different* web Application?
I would really appreciate help.
Vladan
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
I do not know if it can help but you can use a sendRedirect to redirect on a url on a other application server.
see httpServletResponce.sendRedirect. If it is not what you want sorry!
------------------
Benjamin l´┐Żonard
www.evisor.com
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vladan Radovanovic:
Can someone give me some pointers how to forward the request to a servlet or a jsp page but in *different* web Application?

You can only forward a request to a web-app inside the same engine. As you know, a RequestDispatcher will only work for a specific context (web-app). The trick is to first get the context for the web-app you want to forward to, and then get the RequestDispatcher from that context.
Say your other web-app root is "/your/other/web/app/root", and the servlet you want to forward to is "/servlets/theServlet" (its URI is "/your/other/web/app/root/servlets/theServlet").

If the servlet runs on a different server, you've got no choice but to use sendRedirect.
- Peter
 
Vladan Radovanovic
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Peter, that is exactly what I thougth.
Thank You very much.
Vladan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic