Interface HttpContextMapping
-
- All Superinterfaces:
ContextMapping
public interface HttpContextMapping extends ContextMapping
HttpContext mapping collects all the information required to register a
HttpContext
to allow referencing it later.Registering a
HttpContext
can be done in two ways:- registering a service with this interface - all the information is included in service itself (explicit whiteboard approach)
- registering a
HttpContext
service, while required properties (mapping, name, parameters) are specified using service registration properties (legacy Pax Web Whiteboard approach)This interface doesn't extend
ContextRelated
, because it represents the context itself.Even if
getHttpContext()
may return a singleton or a new instance on each call, this method will be called once and the result will be treated as singleton.- Since:
- 0.4.0, March 16, 2008
- Author:
- Alin Dreghiciu, Grzegorz Grzybek
-
-
Field Summary
-
Fields inherited from interface org.ops4j.pax.web.service.whiteboard.ContextMapping
EMPTY_STRING_ARRAY
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description org.osgi.service.http.HttpContext
getHttpContext()
Get actual context being registered.default org.osgi.service.http.HttpContext
getHttpContext(org.osgi.framework.Bundle bundle)
Get actual context being registered.boolean
isShared()
Whether the context should be shared - Whiteboard contexts are always shared, but Http Service doesn't define such flag at all.-
Methods inherited from interface org.ops4j.pax.web.service.whiteboard.ContextMapping
getConnectors, getContextId, getContextPath, getInitParameters, getVirtualHosts
-
-
-
-
Method Detail
-
getHttpContext
org.osgi.service.http.HttpContext getHttpContext()
Get actual context being registered. If specified, this is the way to provide the behavioral aspects of the context (e.g.,
HttpContext.handleSecurity(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
). If not specified, defaultHttpContext
will be created according toContextMapping.getContextId()
.- Returns:
- associated HttpContext; can be null, case when a default http context will be created and used
-
getHttpContext
default org.osgi.service.http.HttpContext getHttpContext(org.osgi.framework.Bundle bundle)
Get actual context being registered. This version accepts
Bundle
argument to reflect recommendations from Whiteboard Service specification, whereServletContextHelper
is suggested to be registered asServiceFactory
.- Parameters:
bundle
-- Returns:
-
isShared
boolean isShared()
Whether the context should be shared - Whiteboard contexts are always shared, but Http Service doesn't define such flag at all.- Returns:
-
-