Problems with HttpURLConnection

From: Art Perry (eowynfuzz_at_yahoo.com)
Date: 01/12/04


Date: 12 Jan 2004 12:42:34 -0800

I have a class that opens up an HttpsURLConnection to a web server.
The purpose is to log in to the web resource using Siteminder forms
based authentication. Therefore, the request is a POST, and the body
of the request is the username, password and target. The object is to
get the cookie for the siteminder session to use on subsequent
requests. Here is the skeleton code:

URL url = new URL("https://foo.com/login");
HttpURLConnection uc = (HttpURLConnection) url.openConnection();
uc.setRequestMethod("POST");
uc.setDoOutput(true);
String requestBody = "USER=XXXX&PASSWORD=XXXX&target=XXXX";
uc.connect();
OutputStream os = uc.getOutputStream();
os.write(requestBody.getBytes());
setCookieValue(uc.getHeaderField("Set-Cookie"));

In JDK 1.3, the webserver processes the request then uc.getContent()
returns the results of the login and uc.getHeaderField("Set-Cookie")
gives me the session cookie I need.

However, in JDK 1.4.2, uc.getContent() is just giving me the login
page itself and no cookie value, as if the webserver is not processing
the user parameters.

What would change between these versions of the JDK?

Thanks,

-Art Perry



Relevant Pages

  • Re: Application pool terminated unexpectedly
    ... Things that can be responding to the request include: ... pool 'DefaultAppPool' terminated unexpectedly. ... We have always used Nessus for this. ... condition where almost every scan I run against the rebuilt web server ...
    (microsoft.public.inetserver.iis)
  • Re: The server committed a protocol violation
    ... Response -> ... instead sending a new request right away. ... One potential gotcha here is that the web server does one sendfor ... application can access the web service without any problems. ...
    (microsoft.public.windowsce.embedded)
  • Re: Writing or copying file to another directory
    ... Perl has a special varable named $< that contains the UID of the ... A browser makes an "HTTP Request". ... A web server services that request, ... The Web Server might call a CGI program in the course of fulfilling ...
    (comp.lang.perl.misc)
  • Re: proxy server in lisp
    ... ??>> almost all garbage collectors do full GC from time to time, ... if we'd like to test web server workloads, let's do a benchmarking of UCW. ... 100% 11754 (longest request) ... ??>> pauses) implemented for Common Lisp. ...
    (comp.lang.lisp)
  • Re: Web hits, graphics vs non-graphics
    ... AW> Every webserver I have management experience with (OSU, WASD, ... the last being the most popular Linux web server) ... AW> HTTP request and a separate hit. ... possible that someone using NetZero would issue a request for the page ...
    (rec.arts.sf.fandom)