Zest™
Introduction
Tutorials
Javadoc
Samples
Core
Libraries
Extensions
Tools
Glossary 

Servlet

code

docs

tests

This library provide the necessary boilerplate code to bootstrap a Zest™ 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 Zest™ Application, see HTTP Library.

Table 46. Artifact

Group IDArtifact IDVersion

org.apache.zest.library

org.apache.zest.library.servlet

0


Application Bootstrap

Extends AbstractZestServletBootstrap to easily bind a Zest™ Application activation/passivation to your webapp lifecycle.

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

Here is an example ServletContextListener:

public static class FooServletContextListener
        extends AbstractZestServletBootstrap
{

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

        return appass;
    }

}

Facilities

ZestServlet and ZestFilter 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 ZestServlet
{

    @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.zest.library.servlet".