wood burning stoves 2.0*
The moose likes Servlets and the fly likes forwarding to a different webApp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "forwarding to a different webApp" Watch "forwarding to a different webApp" New topic
Author

forwarding to a different webApp

Vladan Radovanovic
Ranch Hand

Joined: Mar 20, 2000
Posts: 216
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

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Apr 20, 2000
Posts: 3252
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

Joined: Mar 20, 2000
Posts: 216
Peter, that is exactly what I thougth.
Thank You very much.
Vladan
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: forwarding to a different webApp