• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java application and HTTPS  RSS feed

 
Jeff Yan
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey all, i have been racking my brain and researching for a few days now about this matter,

the thing is i want to be able to get information off the internet that has the https protocol,

i have created a login class and i have hardcoded some login details in it to test it, however, now it has got to the stage where i have to get information of a https website to complete the project.

i need to login to the https server from the java app and get timtable information off of it. i have looked at servelets and sockets and have no idea where to start, from what i have looked at i need to run something from the server side of things but i am not allowed to do this as it is a university site.

is there any possible way of getting the information just by logging in by the java app??

im at my wits end with this
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Libraries like HtmlUnit and jWebUnit (which is based on HtmlUnit) make programmatic web access real easy.
 
Jeff Yan
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, ive just looked up that, and it seems like it will work but how do i implement it?

sorry if it sounds wierd, i have only ever used the standard java class librarys! so i have no clue as to how id go about doing this
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HtmlUnit site has a "How do I" section with a "Getting Starting" page; see if that makes sense to you, and if you can get it to work for some web site of your choosing. You'll need to keep all the jar files that come with HtmlUnit in your classpath.

A confusing aspect might be that the library is meant for unit testing, so there are lots of references to jUnit that you kind of need to filter out.
 
Jeff Yan
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, thank you, il try it and get back to ya !!
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The classes in the standard Java API for accessing HTTP websites are unfortunately not very powerful. Apache HttpClient is a library which makes this kind of thing easier. See the SSL Guide for information on how to use this for HTTPS.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apache HttpClient is a library which makes this kind of thing easier.

While I agree with that, IMO HtmlUnit makes the process much easier still than HttpClient does, since it operates on a higher level (web pages and HTML elements instead of HTTP requests/responses).
 
Jeff Yan
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but do all these work with https aswell as http?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!