Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Working with HttpsURLConnection

 
Cian Karthik
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Im using the code below to connect to a https server from java .
It validates the username and password but it doesnt redirect or goto the homepage when the inputstream is read
DataInputStream input = new DataInputStream( connection.getInputStream() );

always has the same html code from the login page even after the login has been successful .(I was expecting the html page of the user's "home").

I tried opening the connection to a new url(the actual servlet running home page of the user) but it didnt go through..(It again gave back the html code of the login page)

Could you please help me figure out a way to navigate through the website.
From login page to home page to page 2 etc using java https ?

Please find the source code below.
Greatly appreciate the help.

Thanks,
JJ

Source code:


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65223
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Jughead Jones", please check your private messages for an important administrative matter.
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And please UseCodeTags. Your code is not readable in its current form. You can add them by pressing the edit button. Don't forget to keep your original indentation; unindented code is just as unreadable as the current form.
 
Cian Karthik
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry about that..
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this was my problem I'd use a library like HtmlUnit (or jWebUnit) which takes care of all the HTTP details.
 
Cian Karthik
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestion , tried using jwebunit . It worked well.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic