This project has retired. For details please refer to its Attic page.
Servlet Starter Template for Bootstrap
Overview
Scripting
Alarms
Circuit Breaker
Constraints
FileConfig
HTTP
Invocation Cache
JMX
Locking
Logging
OSGi
RDF
ReST Client
ReST - HATEOAS Primer
ReST Common
ReST Server
Restlet Support
Servlet
Shiro Security
Shiro Web Security
Spring Integration
SQL
UID
UoWFile

Servlet

code

docs

tests

This library provide the necessary boilerplate code to bootstrap a Polygene™ Application in a Servlet container plus some facilities. It aims at a very simple need and is provided as an example integration.

If instead you want to run a servlet container inside a Polygene™ Application, see HTTP Library.

Table 38. Artifact

Group IDArtifact IDVersion

org.apache.polygene.libraries

org.apache.polygene.library.servlet

0


Application Bootstrap

Extends AbstractPolygeneServletBootstrap to easily bind a Polygene™ Application activation/passivation to your webapp lifecycle.

Use PolygeneServletSupport#application(javax.servlet.ServletContext) to get a handle on the Application from the ServletContext.

Here is an example ServletContextListener:

public static class FooServletContextListener
        extends AbstractPolygeneServletBootstrap
{

    public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
            throws AssemblyException
    {
        ApplicationAssembly appass = applicationFactory.newApplicationAssembly();
          [...snip...]

        return appass;
    }

}

Facilities

PolygeneServlet and PolygeneFilter respectively provide base class for easy access to the Application from the ServletContext.

Here is a sample servlet that simply output the assembled Application name:

public static class FooServlet
        extends PolygeneServlet
{

    @Override
    protected void doGet( HttpServletRequest req, HttpServletResponse resp )
            throws ServletException, IOException
    {
        // Output the assembled Application's name as an example
        resp.getWriter().println( application().name() );
    }

}

Logging

The SLF4J logger used by this library is named "org.apache.polygene.library.servlet".