Skip to Content
0
Former Member
Jun 25, 2009 at 10:03 PM

Problem using HttpURLConnection class

113 Views

Hello

I´m building a simple servlet that retrieves Cookies information of a website and displays in the screen. I´m using the following code to retrieve headers:

HttpURLConnection  urlConn;
URL url= new URL ("http://mywebsite");
urlConn = (HttpURLConnection) url.openConnection();	
String testHeader = urlConn.getHeaderField(2);
out.println("Key: " + testHeader);

When I run this code locally, it runs perfectly and fast. When I run on J2EE Server SAP, the getHeaderField line takes about 3 minutes to end. I changed the code to show the current time before and after the "print" of Header. The result is:

Thu, 25-Jun-2009 18:53:21

Key: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8k mod_jk/1.2.28

Thu, 25-Jun-2009 18:56:31

If I take the line of "getHeaderField" off, the program runs fast.

Does anyone have an idea of what´s going on ? I´m using J2EE SAP Server of Netweaver 7.0 (sp13)

Thanks

Edited by: vitorz on Jun 26, 2009 12:05 AM

Edited by: vitorz on Jun 26, 2009 12:05 AM