You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael Mehrle <mi...@datasaur.com> on 2005/05/18 18:01:32 UTC

CORRECTION: Can a servlet receive a response to its own request?

Simple question, but it's driving me nuts. I really don't want to get into 
the whole web service business - all I need is for a servlet to be the 
recipient of its own request. Or - in other words - can a servlet act like a 
web browser - just without the GUI?

Use case:

- Servlet issues https request to an outside server (via 
getServletContext().getRequestDispatcher(https://www.someoutsideserver/) )
- Outside server processes request and responds with POST response (also via 
https).
- Servlet [somehow] is able to be the recipient of the response.
- Servlet parses the response and stores data to the database.

Notes:

- The servlet is not the default servlet on that tomcat instance.
- Everything happens via https and I expect the outside server will listen 
on 443 and tomcat on 8443

ANY suggestions would be very helpful - this seems to be a tricky one.

TIA,

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: CORRECTION: Can a servlet receive a response to its own request?

Posted by Atanu Neogi <At...@symantec.com>.
Make your servlet act like a java HTTPS client using the java.net.URL, 
java.net.HttpURLConnection and javax.net.ssl.HttpsURLConnection classes. 
Read from the response input stream (using java.io. classes) returned by 
the connection. You will need to write your own hostname verifier and have 
the target server certificate chain validated in your java certificate 
store. 






"Michael Mehrle" <mi...@datasaur.com> 
05/18/2005 12:01 PM
Please respond to
"Tomcat Users List" <to...@jakarta.apache.org>


To
"Tomcat Users List" <to...@jakarta.apache.org>
cc

Subject
CORRECTION: Can a servlet receive a response to its own request?






Simple question, but it's driving me nuts. I really don't want to get into 

the whole web service business - all I need is for a servlet to be the 
recipient of its own request. Or - in other words - can a servlet act like 
a 
web browser - just without the GUI?

Use case:

- Servlet issues https request to an outside server (via 
getServletContext().getRequestDispatcher(https://www.someoutsideserver/) )
- Outside server processes request and responds with POST response (also 
via 
https).
- Servlet [somehow] is able to be the recipient of the response.
- Servlet parses the response and stores data to the database.

Notes:

- The servlet is not the default servlet on that tomcat instance.
- Everything happens via https and I expect the outside server will listen 

on 443 and tomcat on 8443

ANY suggestions would be very helpful - this seems to be a tricky one.

TIA,

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org