java.lang.Object
net.i2p.i2pcontrol.servlets.jsonrpc2handlers.I2PControlHandler
All Implemented Interfaces:
RequestHandler

public class I2PControlHandlerextends Object implements RequestHandler
JSON-RPC2 handler for the I2PControl method. Manages I2PControl service settings, primarily handling password changes for the control interface.
  • Field Details

    • _secMan

      private final SecurityManager _secMan
      The manager that validates request tokens.
    • _helper

      private final JSONRPC2Helper _helper
      Checks the token a request carries.
  • Constructor Details

    • I2PControlHandler

      public I2PControlHandler(JSONRPC2Helper helper, SecurityManager secMan)
      I2PControlHandler.
      Parameters:
      helper - the JSON-RPC2 helper used to build responses and check authentication
      secMan - the security manager holding the control interface password hash
  • Method Details

    • handledRequests

      public String[] handledRequests()
      Method names this handler services.
      Specified by:
      handledRequests in interface RequestHandler
      Returns:
      method names handled by this handler
    • process

      public JSONRPC2Response process(JSONRPC2Request req, MessageContext ctx)
      Process an I2PControl request
      Specified by:
      process in interface RequestHandler
      Parameters:
      req - A valid JSON-RPC 2.0 request instance. Must not be null.
      ctx - Context information about the request message, may be null if undefined.
      Returns:
      The resulting JSON-RPC 2.0 response. It indicates success or an error, such as METHOD_NOT_FOUND.
    • process

      private JSONRPC2Response process(JSONRPC2Request req)
      Runs one JSON-RPC request and returns its reply.
      Parameters:
      req - the request to run
      Returns:
      the reply to send back