• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem posting data using HttpsConnection

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am currently having problems posting data using a HttpsConnection.

I am setting the setRequestMethod to HttpConnection.POST and then using the openDataOutputStream method.

I will post my code when I get home for reference.

Background to my problem - I am trying to use the declarative security features of J2EE to authenticate a mobile user.

I am firstly firing a HttpsConnection from the mobile device to a protected resource on the app server. I grab the JSessionId from the Set-Cookie http header of the response and post a second request to the j_security_check and provide the refer http header to the protected resource - this simulates exactly what happens on a browser (I used a Http monitor tool to confirm this). However, I need to pass the j_username and j_password as body of the https request. This doesn't seem to work because the server displays my access denied at this point - as if it hadn't received the crednetials

However, just to confirm my technique works I subsituted the post request for a get request to j_security_check and passed the j_username and j_password as request params in the URL. This worked fine and I got a 302 response 'temporily moved' which I then handle by simply making a further request for the original resource - this time it serves back the resource because I am authenticated.

Anyway that sets the scene - so the problem definitely appears to be posting data using an HttpsConnection.

Any help would be greatly appreciated

Rgds,

David
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic