///////////////////////////////////////////////////////////////
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
///////////////////////////////////////////////////////////////

[[library-servlet,Servlet Library]]
= Servlet =

[devstatus]
--------------
source=libraries/servlet/dev-status.xml
--------------

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 <<library-http>>.

include::../../build/docs/buildinfo/artifact.txt[]

== 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:

[snippet,java]
----
source=libraries/servlet/src/test/java/org/apache/polygene/library/servlet/ServletTest.java
tag=bootstrap
----


== 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:

[snippet,java]
----
source=libraries/servlet/src/test/java/org/apache/polygene/library/servlet/ServletTest.java
tag=usage
----


== Logging ==

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

