Results 1 to 3 of 3
Thread: No location on http post
- 03-09-2010, 05:23 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 2
- Rep Power
- 0
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:
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.Java Code:HttpPost httpost = new HttpPost("https://secure.website.org/url.html"); 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; try{ response = httpclient.execute(httpost); HttpEntity entity = response.getEntity(); System.out.println("Login form get: " + response.getStatusLine()); if (entity != null) { entity.consumeContent(); } } catch (Exception ex){ System.out.println(); } location = response.getHeaders("location")
What am I missing?
- 03-09-2010, 11:17 AM #2
You can either try the apache HttpClient, I am sure you will have a success
- 03-09-2010, 02:49 PM #3
Member
- Join Date
- Mar 2010
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Responding back to application's HTTP POST values with application/x-www-form-urlenc
By jeremy.wilson in forum New To JavaReplies: 1Last Post: 08-05-2009, 02:43 AM -
Need help with HTTP POST communication to desktop application (installer)
By jeremy.wilson in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 07-17-2009, 06:19 PM -
Communicating with desktop application via HTTP POST
By jeremy.wilson in forum New To JavaReplies: 2Last Post: 07-17-2009, 06:06 PM -
Storing Array from HTTP Post
By kskinner in forum New To JavaReplies: 1Last Post: 09-08-2008, 06:00 AM -
SOAP over HTTP/POST
By sabatier in forum NetBeansReplies: 0Last Post: 07-10-2007, 08:04 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks