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:

com.sun.jersey.samples.helloworldwebapp.resources.HelloWorldResource
A resource class that produces a textual response to an HTTP GET.

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:

create war package

mvn clean package

setup GlassFish 3.1 (installed at AS_HOME=<install_dir>/glassfish):

From a web browser, visit:

https://localhost:8181/httpsBasicAuth-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:

create war package

mvn clean package

setup GlassFish 3.1 (installed at AS_HOME=<install_dir>/glassfish):

From a web browser, visit:

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