This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Servlets and the fly likes Http and Https Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Http and Https" Watch "Http and Https" New topic
Author

Http and Https

jayram
Ranch Hand

Joined: Oct 30, 2000
Posts: 94
Hello...
I am developing an application which might involve use of secure connections. But I dont know how different Https is from Http. Also what additional coding do i need to put in my servelts if i am using Https.
Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
http is a regular http protocol, while https is a secure one. I think your server needs to be set-up so it can process secure (S) transactions.
------------------
Alex
"Java is the answer"


All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
Mirko Froehlich
Ranch Hand

Joined: Aug 21, 2000
Posts: 114
You will need to configure your webserver for HTTPS, but your application server should be fine. Generally, this should not have any impact on your application, although there are a few cases that can cause problems. For example, you should not hardcode any URLs to "http://....", since this will generate browser warnings. In general, it is best to use relative URLs or dynamically generate the URLs based on the protocol anyway.
-Mirko

Originally posted by joshi jayram:
Hello...
I am developing an application which might involve use of secure connections. But I dont know how different Https is from Http. Also what additional coding do i need to put in my servelts if i am using Https.

Bharatesh H Kakamari
Ranch Hand

Joined: Nov 09, 2000
Posts: 198
Please excuse if I am asking silly questions.
i) How does one configure webserver for HTTPS (Secure HTTP);
ii) How does one ascertain whether HTTP has to be provided or HTTPS has to be provided in the URL ?
iii) How to dynamically generate URLs ?
Thanks
Mirko Froehlich
Ranch Hand

Joined: Aug 21, 2000
Posts: 114
Don't worry, your questions are not silly at all. I'll try to answer them:
i) The details depend on your webserver. In any case, you will have to obtain a certificate (for example from Verisign) in order to use SSL. However, for development you can generate unsigned certificates for free (sorry, don't have a URL handy). You will then need to configure your webserver for this certificate and tell it to accept SSL connections on port 443 (the default port for HTTPS). For example if you are using IIS, it includes a key manager tool that you can use to add certificates.
ii) I am not sure I understand your question. For example on e-commerce websites, you will probably use HTTP until you log in, at which point you switch over to HTTPS. In your HTML login form, just make sure that the action uses HTTPS instead of HTTP. On the login page, you probably also want to make sure that the request came in over HTTPS.
iii) This depends on your exact needs. What I meant was mainly that you should under no circumstances hardcode the full URL including the protocol (HTTP / HTTPS) into your JSP pages or Servlets, since this will cause problems with HTTPS. Also this makes you inflexible if you need to change the hostname later on, so this should never be hardcoded. In many cases, simply using relative URLs will be sufficient (i.e. "/store/product.jsp" instead of "http://myshop.mydomain.com/store/product.jsp"). If for some reason you find it necessary to use a full URL, you should dynamically generate it from the desired protocol (for example you can determine what protocol the request used and use the same), the hostname (which could be stored in a configuration file), and the rest of the URL.
-Mirko
Originally posted by Bharatesh H Kakamari:
Please excuse if I am asking silly questions.
i) How does one configure webserver for HTTPS (Secure HTTP);
ii) How does one ascertain whether HTTP has to be provided or HTTPS has to be provided in the URL ?
iii) How to dynamically generate URLs ?
Thanks

shikhar singh
Ranch Hand

Joined: Oct 02, 2000
Posts: 31
Hi
Can somebody tell me good source, where I can learn how or can to implement HTTPS concept in my application. I'm unaware about this concept.
Thanks
Shikhar
 
Don't get me started about those stupid light bulbs.
 
subject: Http and Https
 
Similar Threads
After enabling SSL, it shows a Download Prompt when I access a local address
compressing HTTP responses (mod_deflate)
Problem with getScheme()
getRequestURL() returning only http instead of https?
how to make https post in JavaScript