Interface ContextMapping
-
- All Known Subinterfaces:
HttpContextMapping,ServletContextHelperMapping
public interface ContextMappingInterface common for mappings related to context:HttpContextfor Http Service scenarioServletContextHelperfor Whiteboard Service scenario
-
-
Field Summary
Fields Modifier and Type Field Description static String[]EMPTY_STRING_ARRAY
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default String[]getConnectors()Get connector names through which this context should be accessible.StringgetContextId()Get an ID of the context that may be referenced later: UsinghttpContext.idservice registration property (legacy Pax Web Whiteboard approach) Usingosgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=name)service registration property (OSGi CMPN Whiteboard approach)StringgetContextPath()Get a context path (directly matchingServletContext.getContextPath()from Servlet API.Map<String,String>getInitParameters()Get context initialization parameters as defined byServletContext.getInitParameterNames()(<context-param>elements inweb.xml).default String[]getVirtualHosts()Get virtual host names to which this context is mapped.
-
-
-
Field Detail
-
EMPTY_STRING_ARRAY
static final String[] EMPTY_STRING_ARRAY
-
-
Method Detail
-
getContextId
String getContextId()
Get an ID of the context that may be referenced later:
- Using
httpContext.idservice 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)
- Returns:
- context identifier; cannot be null
- Using
-
getContextPath
String getContextPath()
Get a context path (directly matching
ServletContext.getContextPath()from Servlet API. This allows to augmentHttpContextwith context path, because original specification doesn't do it at all.When registering
HttpContextdirectly, context path may be specified ashttpContext.idservice registration property.For complete picture, OSGi CMPN Whiteboard's
ServletContextHelpermay have context path specified usingosgi.http.whiteboard.context.nameservice registration property orHttpWhiteboardContextannotation.- Returns:
- context path as in servlet context path; can be null
-
getInitParameters
Map<String,String> getInitParameters()
Get context initialization parameters as defined by
ServletContext.getInitParameterNames()(<context-param>elements inweb.xml).Please notice the "init" vs. "context" parameters confusion. Here - it's the same.
- Returns:
- context parameters; can be null
-
getVirtualHosts
default String[] getVirtualHosts()
Get virtual host names to which this context is mapped. Virtual hosts may be targeted by deployments in several ways:
- Legacy Pax Web way: by passing
httpContext.virtualhostsinit parameter (yes - init parameter, not service registration property) with mapped context (HttpContextMapping). - Legacy (?) Pax Web way: by setting
Web-VirtualHostsmanifest header in WAR bundle - New (?) Pax Web way: by implementing this method when registering a context using
(
HttpContextMappingorServletContextHelperMapping).
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.
- Returns:
- list of virtual hosts to which this context should be mapped. If
nullor 0-sized array is returned, context will be mapped to all virtual hosts.
- Legacy Pax Web way: by passing
-
getConnectors
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.
- Returns:
-
-