Chapter 5. Deploying Restful Objects Webapps

Table of Contents

5.1. Update POM Dependencies
5.2. web.xml
5.2.1. DTD and Display Name
5.2.2. Context Parameters
5.2.3. Filters and Filter Mappings
5.2.4. Listeners
5.2.5. Servlets and Servlet Mappings
5.3. Testing
5.3.1. Using NakedObjectsWebServer
5.3.2. Using Maven Jetty plugin
5.3.3. Deploy to an External Servlet Container
5.4. Authentication

At some point you'll presumably want to deploy your domain object using Restful Objects as a webapp.

If you've used the Naked Objects archetype then it will have created a webapp project for you, with its web.xml set up with the servlets and filters for the HTML viewer. We can use this as the basis for Restful Objects' configuration. (In principle, the web.xml could support both the HTML viewer and Restful Objects. This chapter assumes you only want to expose the latter interface, however).

In addition, you'll need to decide on the authentication mechanism. Restful Objects comes with some out-of-the-box support, but you may want to extend it for your own purposes. This chapter shows you how.d

5.1. Update POM Dependencies

First up (just as we did when prototyping, see Chapter 2, Using Restful Objects in Prototypes), we need to reference the Restful Objects viewer:

<dependencies>
  ...
  <dependency>
    <groupId>org.starobjects.restful</groupId>
    <artifactId>viewer</artifactId>
  </dependency>
  ...
</dependencies>

Here I'm assuming that this is in the webapp submodule where the parent defines the version in its <dependencyManagement> section (see Section 2.1, “Parent Module”).