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

public class EchoHandlerextends Object implements RequestHandler
JSON-RPC2 handler for the Echo method. Returns the provided echo string as a simple test mechanism for the I2PControl API.
  • Field Details

    • requiredArgs

      private static final String[] requiredArgs
      The argument names this method requires.
    • _helper

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

    • EchoHandler

      public EchoHandler(JSONRPC2Helper helper)
      Retains the shared helper used to validate Echo request parameters.
      Parameters:
      helper - shared I2PControl helper used to validate request parameters
  • 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 Echo 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.