public interface ContextMapping
HttpContext for Http Service scenarioServletContextHelper for Whiteboard Service scenario| Modifier and Type | Field and Description |
|---|---|
static String[] |
EMPTY_STRING_ARRAY |
| Modifier and Type | Method and Description |
|---|---|
default String[] |
getConnectors()
Get connector names through which this context should be accessible.
|
String |
getContextId()
Get an ID of the context that may be referenced later:
Using
httpContext.id service registration property (legacy Pax Web Whiteboard approach)
Using osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=name) service
registration property (OSGi CMPN Whiteboard approach)
|
String |
getContextPath()
Get a context path (directly matching
ServletContext.getContextPath() from Servlet API. |
Map<String,String> |
getInitParameters()
Get context initialization parameters as defined by
ServletContext.getInitParameterNames()
(<context-param> elements in web.xml). |
default String[] |
getVirtualHosts()
Get virtual host names to which this context is mapped.
|
static final String[] EMPTY_STRING_ARRAY
String getContextId()
Get an ID of the context that may be referenced later:
httpContext.id service registration property (legacy Pax Web Whiteboard approach)osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=name) service
registration property (OSGi CMPN Whiteboard approach)String getContextPath()
Get a context path (directly matching ServletContext.getContextPath() from Servlet API.
This allows to augment HttpContext with context path, because original specification doesn't do it
at all.
When registering HttpContext directly, context path may be specified as
httpContext.id service registration property.
For complete picture, OSGi CMPN Whiteboard's ServletContextHelper
may have context path specified using osgi.http.whiteboard.context.name service registration
property or org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardContext annotation.
Map<String,String> getInitParameters()
Get context initialization parameters as defined by ServletContext.getInitParameterNames()
(<context-param> elements in web.xml).
Please notice the "init" vs. "context" parameters confusion. Here - it's the same.
default String[] getVirtualHosts()
Get virtual host names to which this context is mapped. Virtual hosts may be targeted by deployments in several ways:
httpContext.virtualhosts init parameter (yes - init
parameter, not service registration property) with mapped context (HttpContextMapping).Web-VirtualHosts manifest header in WAR bundleHttpContextMapping or ServletContextHelperMapping).By default, a context is mapped to all virtual hosts, which means that any web element registered with such context will be available in all virtual hosts.
Elements like servlets, filters are never directly associated with virtual hosts. It can only be done via association with some context.
null or 0-sized array is
returned, context will be mapped to all virtual hosts.default String[] getConnectors()
Get connector names through which this context should be accessible. This is mostly modelled for Jetty, but Tomcat and Undertow also have some tricky configuration.
Copyright © 2006–2024 OPS4J - Open Participation Software for Java. All rights reserved.