Is there a way I can route http requests

J

Janaka Perera

Hi All,

I have a servlet which works as a web service. In a one scenario, I
need to send the request i am getting from a client to another server
and send back the exact reply i am getting from the server to the
request client. Is there a way to do this or any libraries i should
look for.

Thank you

Janaka
 
D

derek

Hi All,
I have a servlet which works as a web service. In a one scenario, I
need to send the request i am getting from a client to another server
and send back the exact reply i am getting from the server to the
request client. Is there a way to do this or any libraries i should
look for.
Thank you
Janaka

You could send a redirect.

http://java.sun.com/javaee/5/docs/a...tResponse.html#sendRedirect(java.lang.String)

Or do you want to do a proxy? Proxy would be more difficult.
 
J

Janaka Perera

http://java.sun.com/javaee/5/docs/api/javax/servlet/http/HttpServletR...)

Or do you want to do a proxy? Proxy would be more difficult.

Actually what i wanted to do is calling the other server in the doPost
or doGet method and converting them into the HttpServletResponse. I
finally managed to do it using org.apache.commons.httpclient library.
Transfered the headrers and the body using some logic in the doGet
method to the HttpServletResponse from the #rd party server response.

Thank you very much for your help. sorry if my explanation earlier was
not clear.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top