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

public class RouterInfoHandlerextends Object implements RequestHandler
JSON-RPC2 handler for the RouterInfo method. Provides read-only access to router status information including version, uptime, network status, bandwidth usage, and peer statistics.
  • Field Details

    • _helper

      private final JSONRPC2Helper _helper
      The JSON-RPC helper for this request.
    • _context

      private final RouterContext _context
      The router context.
  • Constructor Details

    • RouterInfoHandler

      public RouterInfoHandler(RouterContext ctx, JSONRPC2Helper helper)
      Retains the router context and helper used to build the reply.
      Parameters:
      ctx - router context the handler reads version, uptime and transport state from
      helper - resolves the localized strings and version data used in the reply
  • 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 a RouterInfo 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)
      Handles one router info request.
      Parameters:
      req - the request to handle
      Returns:
      the response to send
    • getNetworkStatus

      private RouterInfoHandler.NETWORK_STATUS getNetworkStatus()
      Returns the router's network status.
      Returns:
      the status name