public interface WebAppWebContainerView
extends org.ops4j.pax.web.service.views.PaxWebContainerView
This interface should be used by pax-web-extender-war, so the manipulation of different web elements and contexts happens as if all of them belonged to single web application.
Internally, the same methods of Pax Web WebContainer are used, but additionally
we can arrange the operations within a kind of transaction. This is desired and expected if all the
web elements belong to single WAR (WAB) and also because some kind of validation was already performed when
WAB's web.xml (and possibly web fragments and annotated elements) was parsed. Also all the elements
really belong to single ServletContext and share single context path.
As with traditional Servlet containers, each WAR (in OSGi: WAB) maps 1:1 to unique servlet context identified by context path. In Whiteboard scenario, many bundles may contribute to a single context (path) by registering servlets, filters, etc. In WAR/WAB scenario, we have to remember about few things:
Before Pax Web 8 there were special begin() and end() methods in
WebContainer interface which are now implemented as transactional
batches.
| Modifier and Type | Interface and Description |
|---|---|
static class |
WebAppWebContainerView.AllocationStatus |
| Modifier and Type | Method and Description |
|---|---|
WebAppWebContainerView.AllocationStatus |
allocateContext(org.osgi.framework.Bundle wab,
String contextPath)
Before a WAB can be deployed, we have to check if the target context is available.
|
Configuration |
getConfiguration()
Returns
Configuration object related to current container |
OsgiContextModel |
getOsgiContext(org.osgi.framework.Bundle wab,
String contextPath)
After
allocateContext(Bundle, String) has returned true, we can use this method to get the
OsgiContextModel created by Pax Web Runtime for our WAB. |
ServletContextModel |
getServletContext(org.osgi.framework.Bundle wab,
String contextPath)
After
allocateContext(Bundle, String) has returned true, we can use this method to get
ServletContextModel for our WAB. |
void |
registerReportViewPlugin(ReportViewPlugin plugin)
Register additional
ReportViewPlugin |
void |
releaseContext(org.osgi.framework.Bundle wab,
String contextPath)
After a WAB is undeployed, the context path used by this bundle is again free for registration by Whiteboard
or HttpService.
|
void |
sendBatch(Batch batch)
Pax Web Extender WAR assembles a "web application" using many different sources (
web.xml, fragments,
annotations, ...). |
void |
unregisterReportViewPlugin(ReportViewPlugin plugin)
Unregister previously registered
ReportViewPlugin |
WebAppWebContainerView.AllocationStatus allocateContext(org.osgi.framework.Bundle wab, String contextPath)
wab - contextPath - ServletContextModel getServletContext(org.osgi.framework.Bundle wab, String contextPath)
allocateContext(Bundle, String) has returned true, we can use this method to get
ServletContextModel for our WAB.wab - contextPath - OsgiContextModel getOsgiContext(org.osgi.framework.Bundle wab, String contextPath)
allocateContext(Bundle, String) has returned true, we can use this method to get the
OsgiContextModel created by Pax Web Runtime for our WAB. The same instance should be returned until
releaseContext(Bundle, String) is called.wab - contextPath - void releaseContext(org.osgi.framework.Bundle wab,
String contextPath)
After a WAB is undeployed, the context path used by this bundle is again free for registration by Whiteboard or HttpService.
wab - contextPath - void sendBatch(Batch batch)
web.xml, fragments,
annotations, ...). Eventually this method should be used to pass the model with all the servlets, SCIs, filters,
listeners, ... to the runtime, so it's send then to actual HTTP runtime.batch - void registerReportViewPlugin(ReportViewPlugin plugin)
ReportViewPluginplugin - void unregisterReportViewPlugin(ReportViewPlugin plugin)
ReportViewPluginplugin - Configuration getConfiguration()
Configuration object related to current containerCopyright © 2006–2024 OPS4J - Open Participation Software for Java. All rights reserved.