This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sending credentials/data from Swing application to Servlets

 
B Bhutta
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to send some data, such as userid and password, from swing application to the servlet so that I can open an application without loggin in again.
I am thinking to call a URL and add my userid and password in the URL ( http://www.my.com/test?userid=aaa&password=bbb ) and servlet received this information and open up the application without asking to login again to the user. The servlet/site which I am trying to access is a secure site.
I will appreciate your help in this regard.
Thanks.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18152
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Uh uh. If you've logged in and the client's using cookies to track sessions, your work has already been done for you. Just use the HttpURLConnection to make the applet talk to the server. It will propagate everything that's necessary - cookie and all.
For people with cookies disabled, the URL rewriting thingy applies, just as it does for web pages.
Also, if you're a secure site, don't forget to use https in the HttpURLConnection!
 
B Bhutta
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,
Thanks for your input but I am trying to call this url from the swing application.
Are you giving me an idea that I can set a cookie in application or what??
However thanks for the help.
 
Juanjo Bazan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of sending userid & pass, you could send just one parameter with a (MD5?) hash of a userid+pass string.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic