| Author |
Forward or Redirect http request to a web application on different web container/JVM with some param
|
Raj Arya
Greenhorn
Joined: May 24, 2011
Posts: 3
|
|
Hi,
I'm inside web application A. I want to send request to a web application B which is running in different container/different JVM with some parameter. How could I do so.
Will Request Dispatcher would work? or Is there any other way to do so. Please help!!
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26190
|
|
Just add the parameters to the URL. For example /other/app?a=1&b=2.
Also, please check your private messages.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Gaurav Sagar
Ranch Hand
Joined: Sep 08, 2010
Posts: 97
|
|
A RequestDispatcher is only for in the intra application communication and would not work for things outside the web application. The only thing you may do is to use the GET request for the inter communication between the two web applications.
Regards,
Gaurav
|
 |
Raj Arya
Greenhorn
Joined: May 24, 2011
Posts: 3
|
|
@Jeanne & Gaurav
Thanks for your reply. But adding parameters to the URL doesn't work. the moment I try to submit request for web app outside the container; I loose the data.
|
 |
Chinna Eranna
Ranch Hand
Joined: Dec 08, 2009
Posts: 174
|
|
test now wrote:
I'm inside web application A. I want to send request to a web application B which is running in different container/different JVM with some parameter.
For what reason you are sending a request from A to B application. Do you want to use the response of "B" for building response in "A" or user will be redirected to application "B" ?
|
- Chinna
|
 |
Shanky Sohar
Ranch Hand
Joined: Mar 17, 2010
Posts: 1046
|
|
@Test now..
Welcome to JavaRanch..
|
SCJP6.0,My blog Ranchers from Delhi
|
 |
Shanky Sohar
Ranch Hand
Joined: Mar 17, 2010
Posts: 1046
|
|
If you are using the doGet() method originally to reach the servlet then the method that is used by requestdispatcher to pass the request to different application will be doGet() only.
So that may be the reason your request dispatcher is not working and when you add parameters to the URL you loose the data.
So try it using doPost(),
It should forward the request with additional parameters to other application.
|
 |
Raj Arya
Greenhorn
Joined: May 24, 2011
Posts: 3
|
|
@Chinna
Actually Whenever user comes to Application A, I'm doing some preprocessing of user data in Application A and then I want to send some encripted information to application B which is in different container.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56192
|
|
|
"test now", please check your private messages for an important administrative matter. Do it now. Thanks.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Shanky Sohar
Ranch Hand
Joined: Mar 17, 2010
Posts: 1046
|
|
As you want to send the secure data so make sure to use
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
in web.xml
|
 |
Rudy Gireyev
Ranch Hand
Joined: May 03, 2011
Posts: 39
|
|
|
Raj could HttpURLConnection be what you are looking for?
|
 |
 |
|
|
subject: Forward or Redirect http request to a web application on different web container/JVM with some param
|
|
|