HTTPS Server Example - GlassFish

This example demonstrates how to develop secure RESTful "Hello world" web service with a Servlet 2.5 container.

Contents

The example consists of just one Java class:

org.glassfish.jersey.examples.https.glassfish.resources.HelloWorldResource
A resource class that produces a textual response to an HTTP GET request.

The mapping of the URI path space is presented in the following table:

URI path Resource class HTTP methods
/helloworld HelloWorldResource GET

Running the Example

Run the example as follows:

  1. Create war package

    mvn clean package
  2. Setup GlassFish 4.0 (installed at AS_HOME=<install_dir>/glassfish4):

  3. From a web browser, visit:

    https://localhost:8181/https-server-glassfish-webapp/helloworld (you have to add security exception for GlassFish server certificate / ignore all warnings about security)

Running the Negative Example

Run the example as follows:

  1. Create war package

    mvn clean package
  2. setup GlassFish 4.0 (installed at AS_HOME=<install_dir>/glassfish4):

  3. From a web browser, visit:

    https://localhost:8181/https-server-glassfish-webapp/helloworld (you have to add security exception for GlassFish server certificate / ignore all warnings about security)