Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Posting info from java through SSL to a servlet  RSS feed

 
vasu devan
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
As I need to post the details to servlet from java using URL Connection in secured way(SSL) to a servlet, how would I go about in doing that.
The above mentioned scenario is the requirement in my project. Do suggest me some thing.
Thanks in Advance,
Vasu
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer is so obvious that you missed it. Use the java.net.URL class to fire a "https://your.server/your.url" request at your servlet. You need to use either JDK 1.4, or a lower version with JSSE installed.
- Peter
 
Macky Shannon
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also trying to post to servlet behind an https webserver. eg. https://server.com/System/PostHandler
I am posting XML document for processing. Everything was fine and then the requirement was changed to use SSL.

I tried to use java.net.UrlConnection but get IO Exception for malformed url. Posting to regular http works. I looked at java.net.ssl Package but I cannot find any samples Code anywhere. I have not installed JSSE yet. Is that the easiest way?
Am I correct in assuming that I do not need to worry about any certificates on my end? The handshaking will send the servers key and then I use that. Do the classes in JSSE handle all this so it is just like making a regular URL connetion?
Comments regarding my assumptions above and the steps I should follow would be Welcome ! Also, if there is code sample or url for code sample I would be grateful.
Of Course, since it was working they want the change instantly.
Thanks,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!