Hi dear all,
I supose I've a simple question about HTTPServlet but my I'm really stucked. I 
hope Tomcat mailing list can help me!! I'm using Tomcat V5.
Is it possible to have an HTTP Servlet GET a URL using the same URL connection 
always (I mean the same socket connected). Maybe it's better to give you an 
example. I have an HTTP Servlet that treats somes information and then make a 
GET URL with that information, the problem is that everytime the HTTP Servlet 
is requested to treat the information and then do a GET URL I'm opening a new 
connection to that URL and than close the connection. So if I have 10000 
requests I will open and close about 10000 sockets to GET the URL. Is there a 
way to avoid this?
The ideal, I guess, would be that my HTTPServlet when requested, would open a 
connection to GET an URL and then would use the same connection for future 
requests, so the connection would be closed only when the HTTP Servlet was 
stopped by Tomcat.
I attached an example of my code for GET URL, which might help you to give me 
some suggestions.

Best Regards
Tiago
_________________________________________________________________________
public int sendInformation(Informatio inf) throws MalformedURLException{
        URL add = new URL("http://<url address> );
        URLConnection url = null;
        HttpURLConnection con = null;
        try{
            url = add.openConnection();
            url.setDoInput(true);
            url.setDoOutput(true);
            con = (HttpURLConnection)url;
            con.setRequestMethod("GET");
            con.connect();
            res = con.getResponseCode();
            con.disconnect();
        }       
        catch(IOException e){}
        return res;
    }
_________________________________________________________


__________________________________________________________
O email preferido dos portugueses agora com 
100Mb de espaço e acesso gratuito à Internet
http://www.portugalmail.pt/servicos/email/gold/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to