Servlet API Library

This module (isis-module-servletapi) provides access to various elements of the Servlet API, namely the ServletContext, the HttpServletRequest and the HttpServletResponse.

For each of these APIs a corresponding "provider" domain service exists; for example ServletContextProvider service provides access to the ServletContext.

This module is only available for Wicket viewer, not the REST API.


The module’s functionality can be explored by running the quickstart with example usage using the

A home page is displayed when the app is run:

010 install fixtures

The demo object has all of the various "provider" domain services injected into it. It uses the ServletContextProvider and the HttpServletRequestProvider services to simply show the servlet context name and user’s locale:

020 servlet and request

To demonstrate the use of the HttpServletResponseProvider, the demo object provides an "addHeader" action:

030 response

When invoked, this adds a HTTP header to the response:

040 response header

How to configure/use


Update your classpath by adding this dependency in your dom project’s pom.xml:


Check for later releases by searching Maven Central Repo.


In the AppManifest, update its getModules() method, eg:

public List<Class<?>> getModules() {
    return Arrays.asList(

API & Implementation

The ServletContextProvider defines the following API:

public class ServletContextProvider {
    public ServletContext getServletContext() { ... }

The HttpServletRequestProvider defines the following API:

public class HttpServletRequestProvider {
    public HttpServletRequest getHttpServletRequest() { ... }

The HttpServletResponseProvider defines the following API:

public class HttpServletResponseProvider {
    public HttpServletResponse getHttpServletResponse() { ... }

And finally, the HttpSessionProvider defines the following API:

@DomainService(nature = NatureOfService.DOMAIN)
public class HttpSessionProvider {
    public Optional<HttpSession> getHttpSession() { ... }
    public <T> Optional<T> getAttribute(String key, Class<T> clazz) { ... } (1)
    public <T> void setAttribute( String key, T value) { ... }
    public void removeAttribute(String key) { ... }
1 obtains an attribute (previous set) by key, cast to the specified class

These actions are all programmatic and do not appear in the UI.

Known issues

None known at this time.


Maven can report modules dependencies using:

mvn dependency:list -o -pl modules/lib/servletapi/impl -D excludeTransitive=true

which, excluding Apache Isis itself, returns these compile/runtime dependencies:


The direct Wicket dependency is because the module implementation depends on Apache Isis, and in particular on Apache Isis' Wicket viewer. This means that it cannot be used within domain objects invoked from the REST API (Restful Objects viewer).

For further details on 3rd-party dependencies, see: