Package org.jolokia.server.core.osgi
Class OsgiAgentServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.jolokia.server.core.http.AgentServlet
org.jolokia.server.core.osgi.OsgiAgentServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
Extended here for the sole purpose of exporting
this servlet to the outside in order that
it can be instantiated from another bundle.
This service also tracks the availability of a log
service in order redirect the servlet logging to
the log service (if available). Otherwise it uses
the servlet's logging facility as fallback.
- Since:
- 10.02.11
- Author:
- roland
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor with an empty contextOsgiAgentServlet(org.osgi.framework.BundleContext pContext) Constructor which associates this servlet with a bundle contextOsgiAgentServlet(org.osgi.framework.BundleContext pContext, Restrictor pRestrictor) Constructor with a bundle context and a given restrictor -
Method Summary
Modifier and TypeMethodDescriptionprotected LogHandlercreateLogHandler(jakarta.servlet.ServletConfig pServletConfig, Configuration pConfiguration) Create a log handler which tracks aLogServiceand, if available, use the log service for logging, in the other time uses the servlet's default logging facilityvoiddestroy()protected ServerDetectorLookupGet an OSGi based lookup mechanism for finding all detectors available duringvoidinit(jakarta.servlet.ServletConfig pServletConfig) Initialize the backend systems by creating aJolokiaServiceManagerA subclass can tune this step by overridingAgentServlet.createLogHandler(jakarta.servlet.ServletConfig, org.jolokia.server.core.config.Configuration),AgentServlet.createRestrictor(org.jolokia.server.core.config.Configuration, org.jolokia.server.core.service.api.LogHandler)andAgentServlet.createConfig(jakarta.servlet.ServletConfig)protected voidinitServices(jakarta.servlet.ServletConfig pServletConfig, JolokiaServiceManager pServiceManager) Initialize the service manager and add an OSGi based lookup mechanismMethods inherited from class org.jolokia.server.core.http.AgentServlet
createConfig, createRestrictor, doGet, doOptions, doPostMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doPut, doTrace, getLastModified, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
OsgiAgentServlet
public OsgiAgentServlet()Constructor with an empty context -
OsgiAgentServlet
public OsgiAgentServlet(org.osgi.framework.BundleContext pContext) Constructor which associates this servlet with a bundle context- Parameters:
pContext- bundle context to associate with
-
OsgiAgentServlet
Constructor with a bundle context and a given restrictor- Parameters:
pContext- associated bundle contextpRestrictor- restrictor to use ornullif the default lookup mechanism should be used
-
-
Method Details
-
init
public void init(jakarta.servlet.ServletConfig pServletConfig) throws jakarta.servlet.ServletException Initialize the backend systems by creating aJolokiaServiceManagerA subclass can tune this step by overridingAgentServlet.createLogHandler(jakarta.servlet.ServletConfig, org.jolokia.server.core.config.Configuration),AgentServlet.createRestrictor(org.jolokia.server.core.config.Configuration, org.jolokia.server.core.service.api.LogHandler)andAgentServlet.createConfig(jakarta.servlet.ServletConfig)- Specified by:
initin interfacejakarta.servlet.Servlet- Overrides:
initin classAgentServlet- Parameters:
pServletConfig- servlet configuration- Throws:
jakarta.servlet.ServletException
-
getServerDetectorLookup
Get an OSGi based lookup mechanism for finding all detectors available during- Overrides:
getServerDetectorLookupin classAgentServlet- Returns:
- lookup instance
-
createLogHandler
protected LogHandler createLogHandler(jakarta.servlet.ServletConfig pServletConfig, Configuration pConfiguration) Create a log handler which tracks aLogServiceand, if available, use the log service for logging, in the other time uses the servlet's default logging facility- Overrides:
createLogHandlerin classAgentServlet- Parameters:
pServletConfig- servlet configurationpConfiguration- configuration which contains information like a log class handler or whether to to do debugging- Returns:
- a default log handler
-
initServices
protected void initServices(jakarta.servlet.ServletConfig pServletConfig, JolokiaServiceManager pServiceManager) Initialize the service manager and add an OSGi based lookup mechanism- Overrides:
initServicesin classAgentServlet- Parameters:
pServletConfig- servlet configurationpServiceManager- service manager to which to add services
-
destroy
public void destroy()- Specified by:
destroyin interfacejakarta.servlet.Servlet- Overrides:
destroyin classAgentServlet
-