Class HttpServiceImpl
java.lang.Object
org.glassfish.grizzly.osgi.httpservice.HttpServiceImpl
- All Implemented Interfaces:
HttpServiceExtension,org.osgi.service.http.HttpService
Grizzly OSGi HttpService implementation.
- Since:
- Jan 20, 2009
- Author:
- Hubert Iwaniuk
-
Constructor Summary
ConstructorsConstructorDescriptionHttpServiceImpl(org.osgi.framework.Bundle bundle, Logger logger) HttpServiceconstructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.osgi.service.http.HttpContextvoidregisterFilter(javax.servlet.Filter filter, String urlPattern, Dictionary initParams, org.osgi.service.http.HttpContext context) Registers aFilterand with theHttpService.voidregisterResources(String alias, String prefix, org.osgi.service.http.HttpContext httpContext) voidregisterServlet(String alias, javax.servlet.Servlet servlet, Dictionary initparams, org.osgi.service.http.HttpContext httpContext) voidunregister(String alias) voidunregisterFilter(javax.servlet.Filter filter) Removes the specifiedFilterfrom the service.
-
Constructor Details
-
HttpServiceImpl
HttpServiceconstructor.- Parameters:
bundle-Bundlethat got this instance ofHttpService.logger-Loggerutility to be used here.
-
-
Method Details
-
createDefaultHttpContext
public org.osgi.service.http.HttpContext createDefaultHttpContext()- Specified by:
createDefaultHttpContextin interfaceorg.osgi.service.http.HttpService
-
registerServlet
public 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 - Specified by:
registerServletin interfaceorg.osgi.service.http.HttpService- Throws:
javax.servlet.ServletExceptionorg.osgi.service.http.NamespaceException
-
registerResources
public void registerResources(String alias, String prefix, org.osgi.service.http.HttpContext httpContext) throws org.osgi.service.http.NamespaceException - Specified by:
registerResourcesin interfaceorg.osgi.service.http.HttpService- Throws:
org.osgi.service.http.NamespaceException
-
unregister
- Specified by:
unregisterin interfaceorg.osgi.service.http.HttpService
-
registerFilter
public void registerFilter(javax.servlet.Filter filter, String urlPattern, Dictionary initParams, org.osgi.service.http.HttpContext context) throws javax.servlet.ServletException Registers aFilterand with theHttpService. As this is an extension to the standardHttpServiceand 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 registeredFilters are effectively associated with a particularHttpContext. Therefore, if you wish to have multiple filters associated with a particularServlet, then you should use the sameHttpContextinstance to perform the registration.Filters will be invoked in registration order. This method will invokeFilter.init(javax.servlet.FilterConfig)during the registration process. When registering aFilter, 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.- Specified by:
registerFilterin interfaceHttpServiceExtension- Parameters:
filter- theFilterto register.urlPattern- the url pattern that will invoke thisFilter.initParams- the initialization params that will be passed to the filter whenFilter.init(javax.servlet.FilterConfig)is invoked.context- theHttpContextassociated with thisFilter.- Throws:
javax.servlet.ServletException- if an error occurs duringFilterinitialization.
-
unregisterFilter
public void unregisterFilter(javax.servlet.Filter filter) Removes the specifiedFilterfrom the service.- Specified by:
unregisterFilterin interfaceHttpServiceExtension- Parameters:
filter- theFilterto remove.
-