This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sending HTTP POST from Server to another Server

 
Sahil Reddy
Ranch Hand
Posts: 145
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Geeks


I am new to Servlet world... I have the requirement to send the HTTP Post from the Server to another server with the same request and response object i am getting in doPost method. Please let me
know how can i achieve the same..


Client---->(HTTP POST)---->Server 1-----.(HTTP POST)---->Server 2

I want to achieve step 2 i.e. Sending same HTTP POST request from Server 1 to Server 2.

Regards
 
Tim Moores
Bartender
Pie
Posts: 2496
9
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HttpClient library (or even just the HttpURLConnection class) can do this.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13047
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now wait a minute!

The request and response objects are created and managed by the servlet container, you can't just ship them around to another server.

The content of the HTTP POST body, sure, but the request and response belong to the initial servlet.

Bill

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sahil Reddy wrote:send the HTTP Post from the Server to another server with the same request and response object

As William pointed out, this is impossible, with HttpClient or otherwise.

What are you really trying to achieve?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic