java.lang.Object
net.i2p.i2pcontrol.servlets.jsonrpc2handlers.RouterInfoHandler
- All Implemented Interfaces:
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.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumRouter network status, as reported by the console sidebar.Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router context.private final JSONRPC2HelperThe JSON-RPC helper for this request.Constructor Summary
ConstructorsConstructorDescriptionRouterInfoHandler(RouterContext ctx, JSONRPC2Helper helper) Retains the router context and helper used to build the reply.Method Summary
Modifier and TypeMethodDescriptionprivate RouterInfoHandler.NETWORK_STATUSReturns the router's network status.String[]Method names this handler services.private JSONRPC2Responseprocess(JSONRPC2Request req) Handles one router info request.process(JSONRPC2Request req, MessageContext ctx) Process a RouterInfo request
Field Details
_helper
The JSON-RPC helper for this request._context
The router context.
Constructor Details
RouterInfoHandler
Retains the router context and helper used to build the reply.- Parameters:
ctx- router context the handler reads version, uptime and transport state fromhelper- resolves the localized strings and version data used in the reply
Method Details
handledRequests
Method names this handler services.- Specified by:
handledRequestsin interfaceRequestHandler- Returns:
- method names handled by this handler
process
Process a RouterInfo request- Specified by:
processin interfaceRequestHandler- Parameters:
req- A valid JSON-RPC 2.0 request instance. Must not benull.ctx- Context information about the request message, may benullif undefined.- Returns:
- The resulting JSON-RPC 2.0 response. It indicates success or an error, such as METHOD_NOT_FOUND.
process
Handles one router info request.- Parameters:
req- the request to handle- Returns:
- the response to send
getNetworkStatus
Returns the router's network status.- Returns:
- the status name