public class HttpServiceImpl extends Object implements HttpServiceExtension
| Constructor and Description |
|---|
HttpServiceImpl(org.osgi.framework.Bundle bundle,
Logger logger)
HttpService constructor. |
| Modifier and Type | Method and Description |
|---|---|
org.osgi.service.http.HttpContext |
createDefaultHttpContext() |
void |
registerFilter(javax.servlet.Filter filter,
String urlPattern,
Dictionary initParams,
org.osgi.service.http.HttpContext context)
Registers a
Filter and with the HttpService. |
void |
registerResources(String alias,
String prefix,
org.osgi.service.http.HttpContext httpContext) |
void |
registerServlet(String alias,
javax.servlet.Servlet servlet,
Dictionary initparams,
org.osgi.service.http.HttpContext httpContext) |
void |
unregister(String alias) |
void |
unregisterFilter(javax.servlet.Filter filter)
Removes the specified
Filter from the service. |
public org.osgi.service.http.HttpContext createDefaultHttpContext()
createDefaultHttpContext in interface org.osgi.service.http.HttpServicepublic void registerServlet(String alias, javax.servlet.Servlet servlet, Dictionary initparams, org.osgi.service.http.HttpContext httpContext) throws javax.servlet.ServletException, org.osgi.service.http.NamespaceException
registerServlet in interface org.osgi.service.http.HttpServicejavax.servlet.ServletExceptionorg.osgi.service.http.NamespaceExceptionpublic void registerResources(String alias, String prefix, org.osgi.service.http.HttpContext httpContext) throws org.osgi.service.http.NamespaceException
registerResources in interface org.osgi.service.http.HttpServiceorg.osgi.service.http.NamespaceExceptionpublic void unregister(String alias)
unregister in interface org.osgi.service.http.HttpServicepublic void registerFilter(javax.servlet.Filter filter,
String urlPattern,
Dictionary initParams,
org.osgi.service.http.HttpContext context)
throws javax.servlet.ServletException
Filter and with the HttpService.
As this is an extension to the standard HttpService and there
are no clear rules on how the mapping of filters should occur,
this implementation follows the mapping rules as defined by the Servlet
specification.
Additionally, it should be noted that the registered Filters are
effectively associated with a particular HttpContext. Therefore,
if you wish to have multiple filters associated with a particular
Servlet, then you should use the same HttpContext
instance to perform the registration.
Filters will be invoked in registration order.
This method will invoke Filter.init(javax.servlet.FilterConfig) during
the registration process.
When registering a Filter, take care not to reuse the same Filter
instance across multiple registration invocations. This could cause issues
when removing the Filter as it may remove more url matching possibilities
than intended.registerFilter in interface HttpServiceExtensionfilter - the Filter to register.urlPattern - the url pattern that will invoke this Filter.initParams - the initialization params that will be passed to the
filter when Filter.init(javax.servlet.FilterConfig)
is invoked.context - the HttpContext associated with this Filter.javax.servlet.ServletException - if an error occurs during Filter initialization.public void unregisterFilter(javax.servlet.Filter filter)
Filter from the service.unregisterFilter in interface HttpServiceExtensionfilter - the Filter to remove.Copyright © 2019 Oracle Corporation. All Rights Reserved.