public class ServiceModel extends Object implements BatchVisitor
Service Model is kept at HttpService level, which is bundle-scoped in Pax Web
(though Http Service specification doesn't mention the scope of Http Service). Its goal is to remember which
web elements were registered from given bundle (both HttpService usage
and Whiteboard service registrations).
This is just organizational separation, because the models are kept anyway at ServerModel and
OsgiContextModel levels. It's required to correctly handle bundle-scoped unregistrations.
This bundle-scoped model is the main BatchVisitor, though it may delegate some
visiting methods to other parts of the model.
Even if model elements (like ServletModel are added here, initial validation (whether given model
can be added at all without causing conflicts), validation is performed at ServerModel level.
| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
LOG |
| Constructor and Description |
|---|
ServiceModel(ServerModel serverModel,
ServerController serverController,
org.osgi.framework.Bundle serviceBundle,
WebElementEventListener eventDispatcher) |
| Modifier and Type | Method and Description |
|---|---|
OsgiContextModel |
createDefaultHttpContext(String contextId)
Creates named
OsgiContextModel for the bundle from this ServiceModel and ensures that
this OsgiContextModel is stored at ServerModel level. |
Map<String,Map<String,ServletModel>> |
getAliasMapping() |
Set<ContainerInitializerModel> |
getContainerInitializerModels() |
Set<ErrorPageModel> |
getErrorPageModels() |
Set<EventListenerModel> |
getEventListenerModels() |
Set<FilterModel> |
getFilterModels() |
org.ops4j.pax.web.service.WebContainerContext |
getOrCreateDefaultHttpContext(String contextId) |
org.ops4j.pax.web.service.MultiBundleWebContainerContext |
getOrCreateDefaultSharedHttpContext(String contextId) |
Set<ServletModel> |
getServletModels() |
Set<WebSocketModel> |
getWebSocketModels() |
Set<WelcomeFileModel> |
getWelcomeFileModels() |
void |
reRegisterWebElementsIfNeeded(OsgiContextModel oldContext,
OsgiContextModel newContext,
Batch batch)
Fragile method that should check all the web elements registered into this
ServiceModel but only
if these elements were NOT registered through Whiteboard and were registered using oldContext. |
void |
visitClearDynamicRegistrationsChange(ClearDynamicRegistrationsChange change)
Process a change related to reset of dynamic registrations (like
ServletContext.addServlet(java.lang.String, java.lang.String) |
void |
visitContainerInitializerModelChange(ContainerInitializerModelChange change)
Process a change related to
ContainerInitializerModel |
void |
visitErrorPageModelChange(ErrorPageModelChange change)
Process a change related to error pages
|
void |
visitErrorPageStateChange(ErrorPageStateChange change)
Process full change of the state of error pages per context
|
void |
visitEventListenerModelChange(EventListenerModelChange change)
Processing a change related to
EventListenerModel |
void |
visitFilterModelChange(FilterModelChange change)
Processing a change related to
FilterModel. |
void |
visitFilterStateChange(FilterStateChange change)
Processing full change of registered filters for all the affected contexts.
|
void |
visitOsgiContextModelChange(OsgiContextModelChange change)
Processing a change related to
OsgiContextModel - a model
that affects one ServletContextModel thought the relation is
not 1:1, but N:1 - many OsgiContextModels may be associated with single ServletContextModel. |
void |
visitServletContextModelChange(ServletContextModelChange change)
Processing the most high-level change - related to
ServletContextModel, which creates (or destroys) entire
context (1:1 with "context path"). |
void |
visitServletModelChange(ServletModelChange change)
Processing a change related to
ServletModel. |
void |
visitWebSocketModelChange(WebSocketModelChange change)
Process a change related to
WebSocketModel |
void |
visitWelcomeFileModelChange(WelcomeFileModelChange change)
Process a change related to welcome files.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvisitContextMetadataModelChange, visitContextParamsChange, visitContextStartChange, visitContextStopChange, visitMimeAndLocaleMappingChange, visitSecurityConfigChange, visitTransactionStateChangepublic ServiceModel(ServerModel serverModel, ServerController serverController, org.osgi.framework.Bundle serviceBundle, WebElementEventListener eventDispatcher)
public org.ops4j.pax.web.service.WebContainerContext getOrCreateDefaultHttpContext(String contextId)
public OsgiContextModel createDefaultHttpContext(String contextId)
OsgiContextModel for the bundle from this ServiceModel and ensures that
this OsgiContextModel is stored at ServerModel level.contextId - public org.ops4j.pax.web.service.MultiBundleWebContainerContext getOrCreateDefaultSharedHttpContext(String contextId)
public Map<String,Map<String,ServletModel>> getAliasMapping()
public Set<ServletModel> getServletModels()
public Set<FilterModel> getFilterModels()
public Set<EventListenerModel> getEventListenerModels()
public Set<WelcomeFileModel> getWelcomeFileModels()
public Set<ErrorPageModel> getErrorPageModels()
public Set<ContainerInitializerModel> getContainerInitializerModels()
public Set<WebSocketModel> getWebSocketModels()
public void visitServletContextModelChange(ServletContextModelChange change)
BatchVisitorServletContextModel, which creates (or destroys) entire
context (1:1 with "context path").visitServletContextModelChange in interface BatchVisitorpublic void visitOsgiContextModelChange(OsgiContextModelChange change)
BatchVisitorOsgiContextModel - a model
that affects one ServletContextModel thought the relation is
not 1:1, but N:1 - many OsgiContextModels may be associated with single ServletContextModel.visitOsgiContextModelChange in interface BatchVisitorpublic void visitServletModelChange(ServletModelChange change)
BatchVisitorServletModel. Related
to registration or unregistration of servlets.visitServletModelChange in interface BatchVisitorpublic void visitFilterModelChange(FilterModelChange change)
BatchVisitorFilterModel. Related
to registration or unregistration of filter.visitFilterModelChange in interface BatchVisitorpublic void visitFilterStateChange(FilterStateChange change)
BatchVisitorvisitFilterStateChange in interface BatchVisitorpublic void visitEventListenerModelChange(EventListenerModelChange change)
BatchVisitorEventListenerModelvisitEventListenerModelChange in interface BatchVisitorpublic void visitContainerInitializerModelChange(ContainerInitializerModelChange change)
BatchVisitorContainerInitializerModelvisitContainerInitializerModelChange in interface BatchVisitorpublic void visitWelcomeFileModelChange(WelcomeFileModelChange change)
BatchVisitorvisitWelcomeFileModelChange in interface BatchVisitorpublic void visitErrorPageModelChange(ErrorPageModelChange change)
BatchVisitorvisitErrorPageModelChange in interface BatchVisitorpublic void visitErrorPageStateChange(ErrorPageStateChange change)
BatchVisitorvisitErrorPageStateChange in interface BatchVisitorpublic void visitWebSocketModelChange(WebSocketModelChange change)
BatchVisitorWebSocketModelvisitWebSocketModelChange in interface BatchVisitorpublic void visitClearDynamicRegistrationsChange(ClearDynamicRegistrationsChange change)
BatchVisitorServletContext.addServlet(java.lang.String, java.lang.String)visitClearDynamicRegistrationsChange in interface BatchVisitorpublic void reRegisterWebElementsIfNeeded(OsgiContextModel oldContext, OsgiContextModel newContext, Batch batch)
Fragile method that should check all the web elements registered into this ServiceModel but only
if these elements were NOT registered through Whiteboard and were registered using oldContext.
If conditions match, each such element should be unregistered and then registered again
in order to switch its HttpService-related context.
This method is an equivalent of
org.ops4j.pax.web.extender.whiteboard.internal.WhiteboardContext#reRegisterWebElements().
oldContext - newContext - may be null - in such case we have to determine new contextbatch - Copyright © 2006–2024 OPS4J - Open Participation Software for Java. All rights reserved.