tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: Can a servlet receive its own request?
Date Wed, 18 May 2005 17:05:21 GMT
You *probably* could do this... I'm not 100% sure.

What I *AM* sure about though is that this would be pretty ugly :)

I'm not sure what you mean by "Outside server processes request and
responds with POST response (also via https)." though...

Is the idea that the request to the outside server is to be asychronous,
or will your servlet be awaiting a reply?  If the former, then you
probably can go with your approach and it won't be all that ugly... it's
essentially nothing more than another request coming in to the servlet,
same as always, your just going to process it differently...  as long as
you get enough information back to be able to complete the "transaction",
it should work fine.  Just treat the initial request to your servlet and
the response back from the outside server as two separate requests and you
should be fine.

If however, as I suspect might be the case, your servlet is going to
actually be awaiting a reply from the outside server, then you should look
at using Commons HTTPClient.  I'm relatively sure it supports SSL
connections, and then all your doing is making a remote request, awaiting
the response and processing accordingly.  It'd be just like using the
standard URL object, but it's more robust than that.

Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies

On Wed, May 18, 2005 11:58 am, Michael Mehrle said:
> 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:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message