• 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

Working with HttpsURLConnection

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:


 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Jughead Jones", please check your private messages for an important administrative matter.
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about that..
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the suggestion , tried using jwebunit . It worked well.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic