Scala HelloWorldWebApp Example

This example demonstrates how to develop RESTful hello world web service in Scala with a Servlet 2.5 container.

Contents

The example consists of these Scala classes:

com.sun.jersey.samples.helloworldwebapp.resources.HelloWorldResource
A resource class that produces a textual response to an HTTP GET.
com.sun.jersey.samples.helloworldwebapp.resources.MarkupResource
A resource class that produces a HTML response using Scala's embedded markup syntax together with the jersey-scala library.

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

URI path Resource class HTTP methods
/helloworld HelloWorldResource GET
/markup MarkupResource GET

Running the Example

If you are working with Jersey GlassFish update center module installed into your existing GlassFish instance, you will need to follow instructions at the module README file in order to deploy the example.

Otherwise, you can run the example using embedded GlassFish as follows:

run

mvn clean package embedded-glassfish:run

From a web browser, visit:

http://localhost:8080/scala-helloworld-webapp/helloworld
http://localhost:8080/scala-helloworld-webapp/markup