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 ID | Artifact ID | Version |
|---|---|---|
org.apache.polygene.libraries | org.apache.polygene.library.servlet | 3.0.0 |
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;
}
}
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() );
}
}