• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Forward or Redirect http request to a web application on different web container/JVM with some param

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!

 
author & internet detective
Posts: 41125
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just add the parameters to the URL. For example /other/app?a=1&b=2.

Also, please check your private messages.
 
Ranch Hand
Posts: 97
MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@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.
 
Ranch Hand
Posts: 174
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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" ?
 
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Test now..
Welcome to JavaRanch..
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@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.
 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"test now", please check your private messages for an important administrative matter. Do it now. Thanks.
 
Shanky Sohar
Ranch Hand
Posts: 1051
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Raj could HttpURLConnection be what you are looking for?
 
reply
    Bookmark Topic Watch Topic
  • New Topic