How to tranfer request parameter to another application on the same server
Mike Anna
Ranch Hand
Joined: Jul 08, 2007
Posts: 112
posted
0
Dear all,
I have two questions : 1) How can I transfer the request parameters to another application on the same server/container ? ( is it possible at all ?) 2) I know for sure this is not possible using only the req/res objects but still, is there a way I can tranfer my request/response parameters to another application on another servlet , without using hidden parameters ?
Please let me know
Rgds
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
A few workarounds come to mind.
In some containers it is possible to obtain a RequestDispatcher for a resource in a different web app. That generally needs to be enabled especially; e.g. Tomcat uses the crossContext setting to do that.
Another way -with a number of drawbacks- would be to perform a client-side redirect to a URL that has all the parameters included as GET parameters.
If you have an Apache in front of your servlet container -and know that the request needs to be sent elsewhere before looking at it- then that's what the mod_rewrite module is for.
got you. Thanks Ulf Dittmer. That pretty much explains my 1 question. Thanks a ton. I know I could never have gotten to it.
I am assuming, that for the question 2. There is infact no other way around other than having a GET method populated with the values/params. Right ? So all in all, if the other applications servlet takes only a post call. I cannot really transfer any variable to "that" application(servlet). Is my understanding correct ?
Rgds
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
if the other applications servlet takes only a post call. I cannot really transfer any variable to "that" application(servlet). Is my understanding correct ?