my dog learned polymorphism*
The moose likes Sockets and Internet Protocols and the fly likes Working with HttpsURLConnection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Working with HttpsURLConnection " Watch "Working with HttpsURLConnection " New topic
Author

Working with HttpsURLConnection

Cian Karthik
Greenhorn

Joined: May 10, 2010
Posts: 3
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

Joined: Jan 10, 2002
Posts: 61456
    
  67

"Jughead Jones", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19725
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Cian Karthik
Greenhorn

Joined: May 10, 2010
Posts: 3
Sorry about that..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42372
    
  64
If this was my problem I'd use a library like HtmlUnit (or jWebUnit) which takes care of all the HTTP details.


Ping & DNS - my free Android networking tools app
Cian Karthik
Greenhorn

Joined: May 10, 2010
Posts: 3
Thanks for the suggestion , tried using jwebunit . It worked well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Working with HttpsURLConnection