Hi everybody.
I need to connect to a servlet, because i want to send an http request
with some parameters.
This is the code:
URL url = new URL("http://blahblahblah.com.../servlet?var1=value");
HttpURLConnection connection = (HttpURLConnection)
url.openConnection();
connection.getInputStream();
The point is that connection.getInputStream() waits for the for the
whole processed response of the servlet. But i don't want to wait,
because the server-side is a long process and i don't mind about the
output. I just want to send the request.
How can i accomplish that? If i write a raw-socket request, will the
server (tomcat) kill the servlet thread if i close the socket? Do i
really need to write a raw-socket request?
thanks
> Hi everybody.
> I need to connect to a servlet, because i want to send an http request
[quoted text clipped - 14 lines]
> really need to write a raw-socket request?
> thanks
On the top of my mind, if you don't care about the output, you can
create a thread and do it from there. Your main thread will not be
blocked.
ennio - 18 Sep 2006 21:06 GMT
Thank you very much. I was thinking about it too. I was wondering if
it's "okay" to launch threads from a servlet.
su_dang@hotmail.com ha scritto:
> On the top of my mind, if you don't care about the output, you can
> create a thread and do it from there. Your main thread will not be
> blocked.
Andrea Desole - 19 Sep 2006 09:01 GMT
> Thank you very much. I was thinking about it too. I was wondering if
> it's "okay" to launch threads from a servlet.
yes. Just make sure the thread terminates, or you will have a lot of
threads after some time. Maybe a better solution would be to use one
thread that queues the jobs coming from the servlets called by the users