java.lang.Object
net.i2p.i2pcontrol.I2PControlController
This handles the starting and stopping of Jetty from a single static class so it can be called via clients.config. This makes installation of a new eepsite a turnkey operation. This class is NOT used for the webapp or the bare ServerSocket implementation.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final I2PAppContextThe app context, never null.private final ConfigurationManagerThe configuration manager.private final RouterContextThe router context, null when run standalone in an app context.private final KeyStoreProviderProvider of the TLS key store.private final LogLogger for the I2PControl server.private final ClientAppManagerThe manager that starts the apps.private final StringDirectory holding the plugin configs.private final SecurityManagerThe jetty security manager.private final ServerThe embedded jetty server.private ClientAppStateCurrent state of the app.private static final intDefault HTTPS port of the API.(package private) static final StringAllowed hosts config propertyprivate static final StringPort mapper name of the HTTPS service.Constructor Summary
ConstructorsConstructorDescriptionRouterApp (new way)Method Summary
Modifier and TypeMethodDescriptionprivate ConnectorbuildDefaultListener(Server server) Builds the default SSL connector from the current configuration.Builds a new server.private ConnectorbuildSslListener(Server server, String address, int port) Creates a SSLListener with all the default options.private voidchangeState(ClientAppState state) Change the app state and notify the update manager.private voidchangeState(ClientAppState state, String msg, Exception e) Changes the app state and notifies listeners.Display name of the client app.getName()Unique name of the client app.Report the directory the plugin subsystem was started with, where each plugin's own configuration and data are kept.getState()Current state of the managed client app.voidStop the Jetty serverprivate voidstart()Starts the jetty server.voidstartup()Start the Jetty serverprivate voidstop()Stops the jetty server.private voidStop it
Field Details
_appContext
The app context, never null._context
The router context, null when run standalone in an app context._mgr
The manager that starts the apps._log
Logger for the I2PControl server._pluginDir
Directory holding the plugin configs._conf
The configuration manager._ksp
Provider of the TLS key store._secMan
The jetty security manager._server
The embedded jetty server._state
Current state of the app.PROP_ALLOWED_HOSTS
SVC_HTTPS_I2PCONTROL
Port mapper name of the HTTPS service.- See Also:
DEFAULT_PORT
Constructor Details
I2PControlController
RouterApp (new way)- Parameters:
ctx- the router context, also adopted as the application contextmgr- the client app manager to register this service with
Method Details
startup
shutdown
getState
Current state of the managed client app.getName
getDisplayName
Display name of the client app.- Specified by:
getDisplayNamein interfaceClientApp- Returns:
- "I2PControl"
changeState
Change the app state and notify the update manager.- Parameters:
state- the new state of the app
changeState
Changes the app state and notifies listeners.- Parameters:
state- the new statemsg- the message for the listenerse- the exception, null if none
start
buildDefaultListener
Builds the default SSL connector from the current configuration. The connector is neither added to a server nor started here; onlybuildServer()does that.- Parameters:
server- the server the connector is created for, may be null- Returns:
- the new connector
buildServer
buildSslListener
Creates a SSLListener with all the default options. The listener will use all the default options.- Parameters:
server- the server to add the connector to, may be nulladdress- - The address the listener will listen to.port- - The port the listener will listen to.- Returns:
- - Newly created listener
stopServer
private void stopServer()Stop itstop
private void stop()Stops the jetty server.getPluginDir
Report the directory the plugin subsystem was started with, where each plugin's own configuration and data are kept.- Returns:
- plugin directory path