Results 1 to 3 of 3
  1. #1
    malandro95 is offline Member
    Join Date
    Mar 2010
    Rep Power

    Default No location on http post

    I am trying to execute an http post. I traced the post using Firebug within Firefox and can see the Location header being returned. I am trying to grab this location header after my post executes, however, it doesn't seem to be in the header. I see everything else, but no location.

    Here's my code:

    Java Code:
    HttpPost httpost = new HttpPost("");
    List <NameValuePair> nvps = new ArrayList <NameValuePair>();
    nvps.add(new BasicNameValuePair("username", userid));
    nvps.add(new BasicNameValuePair("password", password));
    httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
    HttpResponse response = null;
           	response = httpclient.execute(httpost);
           	HttpEntity entity = response.getEntity();
           	System.out.println("Login form get: " + response.getStatusLine());
           	if (entity != null) {
    catch (Exception ex){
    location = response.getHeaders("location")
    At this point, I would expect location to contain the url being returned under the location header, but there doesn't seem to be a header when I execute my code, only using the browser does it work.

    What am I missing?

  2. #2
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Rep Power


    You can either try the apache HttpClient, I am sure you will have a success

  3. #3
    malandro95 is offline Member
    Join Date
    Mar 2010
    Rep Power

Similar Threads

  1. Replies: 1
    Last Post: 08-05-2009, 02:43 AM
  2. Need help with HTTP POST communication to desktop application (installer)
    By jeremy.wilson in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 07-17-2009, 06:19 PM
  3. Communicating with desktop application via HTTP POST
    By jeremy.wilson in forum New To Java
    Replies: 2
    Last Post: 07-17-2009, 06:06 PM
  4. Storing Array from HTTP Post
    By kskinner in forum New To Java
    Replies: 1
    Last Post: 09-08-2008, 06:00 AM
  5. SOAP over HTTP/POST
    By sabatier in forum NetBeans
    Replies: 0
    Last Post: 07-10-2007, 08:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts