Class JolokiaHttpHandler

java.lang.Object
org.jolokia.jvmagent.handler.JolokiaHttpHandler
All Implemented Interfaces:
HttpHandler

public class JolokiaHttpHandler extends Object implements HttpHandler
HttpHandler for handling a Jolokia request
Since:
Mar 3, 2010
Author:
roland
  • Constructor Details

    • JolokiaHttpHandler

      public JolokiaHttpHandler(org.jolokia.server.core.service.api.JolokiaContext pJolokiaContext)
      Create a new HttpHandler for processing HTTP request
      Parameters:
      pJolokiaContext - jolokia context
  • Method Details

    • handle

      public void handle(HttpExchange pHttpExchange) throws IOException
      Handle an incoming HTTP request. If the handler is not yet started, an exception is thrown. This is the com.sun.net.httpserver equivalent of org.jolokia.server.core.http.AgentServlet#handle().
      Specified by:
      handle in interface HttpHandler
      Parameters:
      pHttpExchange - the request/response object
      Throws:
      IOException - if something fails during handling
      IllegalStateException - if the handler has not yet been started
    • checkAuthentication

      protected void checkAuthentication(HttpExchange pHttpExchange) throws SecurityException
      Protocol based authentication checks called very early and before handling a request. If the check fails a security exception must be thrown

      The default implementation does nothing and should be overridden for a valid check.

      Parameters:
      pHttpExchange - exchange to check
      Throws:
      SecurityException - if check fails.
    • doHandle

      public void doHandle(HttpExchange pExchange) throws IOException
      Handle the incoming request. All exceptions during request processing are caught and turned into a Jolokia JSON error. The only exception thrown is when the handled exception (turned into JSON) can't be sent back.
      Parameters:
      pExchange - the request/response object
      Throws:
      IOException - thrown only if there's an issue sending the response.