Meaningless Drivel is fun!*
The moose likes Sockets and Internet Protocols and the fly likes Relay request to another server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Relay request to another server" Watch "Relay request to another server" New topic
Author

Relay request to another server

Madangopal Venkatesan
Greenhorn

Joined: Jun 19, 2011
Posts: 16
A request hits my server. I want to modify the request header and send the same request to another application outside my container. How do I do that?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61084
    
  66

Start by taking the time to compose descriptive subjects for your posts. You will attract people who will can give you better and faster answers when your posts have good, descriptive subjects. For more information, please click this link ⇒ UseAMeaningfulSubjectLine.

Using a title such as "Help!" isn't going to attract the attention of those who can best help you.

I have modified your subject for you. Please use it as an example for future posts.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61084
    
  66

You cannot send the same request instance to another server. You'll need to generate a new request. The classes in java.net can help, or you can use tools such as HttpClient.
Madangopal Venkatesan
Greenhorn

Joined: Jun 19, 2011
Posts: 16
I cannot create a new request as per the specifications given to me. I saw on some forums that this can be done at the container level (Tomcat) using Perl. Could you suggest how and could you also suggest any mechanisms by which this can be achieved?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61084
    
  66

A specification that asks for the impossible cannot be met. There may be some way to relay a request at lower levels in the IP stack, but at the servlet level, it cannot be done.

I'll move this post along to the Protocols forum.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Relay request to another server