Results 1 to 7 of 7
  1. #1
    mutuah is offline Member
    Join Date
    Jul 2007
    Posts
    9
    Rep Power
    0

    Default switching between HTTP and HTTPS

    Hi all.

    Am trying to create jsp pages where the login page runs on htts but the rest are on http protocol. How can i implement this. At least I know that the two protocols create different sessions.

    I would also wish to know how to revert back to https from http. Thanks in advance.
    Mutua.

  2. #2
    brianhks is offline Senior Member
    Join Date
    Jul 2007
    Posts
    135
    Rep Power
    0

    Default

    Your best bet is to use apache in front of tomcat (or whatever servlet container you are using) and use the apache java connector - I forget the name right now.

    Apache is much better and configuring which URLs should be secure and which should not. This way the security is transparent to your jsp files.

  3. #3
    mutuah is offline Member
    Join Date
    Jul 2007
    Posts
    9
    Rep Power
    0

    Default

    Thanks brianhks.

    Am using tomcat and servlet container and have already configured the web.xml

    <security-constraint>
    <display-name>secure_pages</display-name>
    <web-resource-collection>
    <web-resource-name>index.jsp</web-resource-name>
    <description/>
    <url-pattern>/index.jsp</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
    <description/>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
    </security-constraint>

    but the problem is all pages become secured (https) contrary to my wish. I want the login page and later another page to be secured.

    What I need is to switch between the https and http sessions.
    Last edited by mutuah; 08-03-2007 at 05:57 PM. Reason: typo errors

  4. #4
    brianhks is offline Senior Member
    Join Date
    Jul 2007
    Posts
    135
    Rep Power
    0

    Default

    It is a lot easier to let Apache do it for you. The connector is modjk.

  5. #5
    mutuah is offline Member
    Join Date
    Jul 2007
    Posts
    9
    Rep Power
    0

    Default

    Sorry brianhks to trouble you this far. I have set one page 'index.jsp' to an https. this 'index.jsp' is the first my page. After signing, all other pages are https but its not what i want.

  6. #6
    brianhks is offline Senior Member
    Join Date
    Jul 2007
    Posts
    135
    Rep Power
    0

    Default

    I think you have missed my point. What you do is forget about doing anything in https from tomcat. From tomcat every thing is in the clear. You install Apache in front of Tomcat so that Apache passes request through to Tomcat. Now from Apache it is easy to setup certain URL's to be https and other to not be https. This way from within Tomcat every thing is on the same session. Apache handles the switching which is what it is good at (and a bunch of other stuff too).

  7. #7
    mutuah is offline Member
    Join Date
    Jul 2007
    Posts
    9
    Rep Power
    0

    Default

    Hi brianhks,
    Am running my jsp pages on apache tomcat. The first page 'index.jsp' is the home page. I have set the web.xml for the page i need secured but seems the other pages too get secured contrary to my wish.

    In the servlet, I have redirected by hard-coding the url page I need after the index page but I loose the session. How do I get the same session data in both HTTP and HTTPS?

Similar Threads

  1. Switching Careers to Java? It's never to late, is it?
    By /-ICEpik in forum Jobs Discussion
    Replies: 10
    Last Post: 12-30-2008, 06:03 PM
  2. Replies: 0
    Last Post: 01-31-2008, 02:34 PM
  3. JDK 1.3 with HTTPS
    By sriram in forum Advanced Java
    Replies: 2
    Last Post: 01-21-2008, 11:51 PM
  4. how To Use Https Connection For Communication
    By fred in forum Advanced Java
    Replies: 2
    Last Post: 08-01-2007, 05:59 PM
  5. HTTPS and JBoss
    By Heather in forum Advanced Java
    Replies: 2
    Last Post: 06-30-2007, 05:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •