java.lang.Object
net.i2p.i2pcontrol.servlets.jsonrpc2handlers.AdvancedSettingsHandler
- All Implemented Interfaces:
RequestHandler
JSON-RPC handler for advanced router settings.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router whose settings are read and written.private final JSONRPC2HelperValidates requests and formats replies.private static final String[]No method here requires arguments.Constructor Summary
ConstructorsConstructorDescriptionAdvancedSettingsHandler(RouterContext ctx, JSONRPC2Helper helper) Constructor for advanced settings handler.Method Summary
Modifier and TypeMethodDescriptionprivate booleancheckTypes(Map<String, Object> newSettings) Checks every supplied value is a string.private StringgetAdvancedSetting(String key) Reads one router config setting.Reads the whole router config map.String[]Requests handled by this handler.process(JSONRPC2Request req, MessageContext ctx) Process an AdvancedSettings requestprivate booleansetAdvancedSettings(Map<String, String> newSettings, boolean clearConfig) Writes the new settings to the router config.
Field Details
_context
The router whose settings are read and written._helper
Validates requests and formats replies.requiredArgs
No method here requires arguments.
Constructor Details
AdvancedSettingsHandler
Constructor for advanced settings handler.- Parameters:
ctx- router context the settings are read fromhelper- JSON-RPC helper instance
Method Details
handledRequests
Requests handled by this handler.- Specified by:
handledRequestsin interfaceRequestHandler- Returns:
- method names handled by this handler
process
Process an AdvancedSettings 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.
getAdvancedSetting
getAdvancedSettings
checkTypes
setAdvancedSettings