• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get servlet forward response ?

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my servelt coding, I need to go to another URL and get responses from that servlet in remote server.

the coding looks like this

String result = forward("http://www.ddd.com/servlet");
// "http://www.ddd.com/servlet" will send back a info

if(result.equals("success")){
// continue
}
else{
// notify user this forward has exception
}

I need to do this forward internally, not shown in browser.

Thanks.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at both
http://java.sun.com/j2se/1.4.2/docs/api/java/net/HttpURLConnection.html

And the (higher level) libraries in:
http://jakarta.apache.org/commons/httpclient/

There is nothing built into servlets for doing this kind of proxying.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic