aspose file tools
The moose likes Servlets and the fly likes How to tranfer request parameter to another application on the same server Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "How to tranfer request parameter to another application on the same server" Watch "How to tranfer request parameter to another application on the same server" New topic
Author

How to tranfer request parameter to another application on the same server

Mike Anna
Ranch Hand

Joined: Jul 08, 2007
Posts: 112
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
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.


Android appsImageJ pluginsJava web charts
Mike Anna
Ranch Hand

Joined: Jul 08, 2007
Posts: 112
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
if the other applications servlet takes only a post call. I cannot really transfer any variable to "that" application(servlet). Is my understanding correct ?

Yes.
Mike Anna
Ranch Hand

Joined: Jul 08, 2007
Posts: 112
thanks. This forum rocks !!
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to tranfer request parameter to another application on the same server
 
Similar Threads
How to indentify a request that goes form one server to another
identifying the retry request
How to find the request from oneserver to another
Can sendRedirect method hit a different server instance?
forwarding request to some other server