users@glassfish.java.net

Re: Sun Application Server 9/Glassfish with https

From: <glassfish_at_javadesktop.org>
Date: Thu, 22 Feb 2007 23:26:33 PST

Jeanfrancois, Wolfram,

Thank you for your answers. I wasn't able to get it to work with solution 3. However, I did get it to work with solution 1 - setting the security-constraint in web.xml. To recap for others, these are the steps I followed:

1. Install Sun Application Server 9
2. Set up listener on :80 (security not set, but with SSL redirect to 443)
3. Set up listener on :443 (security set)
4. Deploy Web application with additional insert in web.xml (see code below)
5. Set default web module for virtual server to that Web application
6. VoilĂ . Ca va bien! Merci! Requests to http://www.myweb.com/ are now automatically forwarded to https://www.myweb.com/.

[code]
-----------8< web.xml snip 8<---------------
   <servlet>
        <servlet-name>AuthController</servlet-name>
        <servlet-class>atr.AuthController</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ReplyController</servlet-name>
        <url-pattern>/ReplyController</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>AuthController</servlet-name>
        <url-pattern>/AuthController</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Automatic SSL Forwarding</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
          <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>
    <welcome-file-list>
        <welcome-file>
            index.jsp
        </welcome-file>
    </welcome-file-list>
-----------8< web.xml snip 8<---------------
[/code]
[Message sent by forum member 'dailysun' (dailysun)]

http://forums.java.net/jive/thread.jspa?messageID=204934