This setup is composed of two steps:
Web-ContextPath
OSGi manifest entry. WEB-INF/web.xml
configuration.The preceding are the steps based on the (recently) released OSGi Service Platform Enterprise Specification 4.2 and may be updated in the Pax Web implementation by the time you read this. In the meantime, we need to use the Webapp-Context
manifest entry.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.1.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Category>sample</Bundle-Category>
<Webapp-Context>bookshelf</Webapp-Context>
<!--
<Web-ContextPath>/bookshelf</Web-ContextPath>
-->
I've included the Web-ContextPath
element (commented out) in the plugin configuration for the sake of compatibility with the specifications.
Next is the web.xml
file. It is located under src/main/resources/WEB-INF/
. Its contents are kept to a minimum:
<?xml version="1.0" encoding="UTF-8"?> <web-app> <display-name>Bookshelf Web-app</display-name> </web-app>
We don't need more.
Based on the bundle manifest entry (and the web.xml
file), the Web Container will identify this bundle as a web application bundle and deploy its contents under the given context path. Once deployed, JSP content will be served under http://localhost:8080/bookshelf/
.
So let's finish our preparation work and get to the JSP side of things.