public final class ServletContextModel extends Identity
This class is 1:1 representation of server-specific ServletContext and is unaware of
OSGi-related representation of a context (like HttpContext and
ServletContextHelper).
It represents a web application (that could be described using single web.xml descriptor),
while the web elements (like servlets, filters, ...) or configuration (session, JSP config, ...) are
contributed possibly by many bundles (bundle-scoped HttpService services or
whiteboard service registrations).
Normally, web applications are represented by web.xml files which are parsed by server-specific
parsers:
org.eclipse.jetty.webapp.StandardDescriptorProcessor.visit()org.apache.catalina.startup.ContextConfig#configureContext(),
org.apache.tomcat.util.descriptor.web.WebXmlParser#parseWebXml()When user registers (through HttpService or Whiteboard) a web element
(like servlet), the registration seems unique, but physically, given servlet has to be explicitly registered
to all related ServletContextModel (and eventually - ServletContext). It is even more important
during unregistration - simple call to HttpService.unregister(String) has to
iterate over all mapped ServletContextModel contexts.
Each OsgiContextModel pointing to this class may declare virtual hosts. Actual, server
specific context has to be mapped (server-specific method) to all these virtual hosts.
Registered whiteboard element may refer to many OsgiContextModel - pointing to different or the same
target ServletContextModel. If two (or more) OsgiContextModel point to the same
ServletContextModel, priority (service rank + service id) is checked to find single OsgiContextModel
and associated helper.
| Constructor and Description |
|---|
ServletContextModel(String contextPath) |
getId, getIdPrefix, getNumericIdpublic ServletContextModel(String contextPath)
public void enableServletModel(ServletModel model)
Marks given ServletModel as enabled, which means it has to be immediately added to relevant
mappings, because validation was performed earlier.
model - public void disableServletModel(ServletModel model)
Marks given ServletModel as disabled, which means it should no longer be available on active
mappings, and should be moved to list of disabled servlets.
This method just removes the model from ServletContextModel, but special care should be taken,
because given ServletModel has to be remembered as disabled in ServerModel.
model - public void enableFilterModel(FilterModel model)
Marks given FilterModel as enabled.
model - public void disableFilterModel(FilterModel model)
Marks given FilterModel as disabled.
model - public void enableErrorPageModel(ErrorPageModel model)
ErrorPageModel as enabledmodel - public void disableErrorPageModel(ErrorPageModel model)
ErrorPageModel as disabledmodel - public void enableWebSocketModel(WebSocketModel model)
Marks given WebSocketModel as enabled.
model - public void disableWebSocketModel(WebSocketModel model)
Marks given WebSocketModel as disabled.
model - public String getContextPath()
public Map<String,ServletModel> getServletNameMapping()
public Map<String,FilterModel> getFilterNameMapping()
public Map<String,ServletModel> getAliasMapping()
public Map<String,ServletModel> getServletUrlPatternMapping()
public Map<String,ErrorPageModel> getErrorPageMapping()
public Map<String,WebSocketModel> getWebSocketUrlPathMapping()
Copyright © 2006–2024 OPS4J - Open Participation Software for Java. All rights reserved.