java.lang.Object
net.i2p.router.web.FormHandler
net.i2p.router.web.ConfigServiceHandler

public class ConfigServiceHandlerextends FormHandler
Handler to deal with form submissions from the service config form and act upon the values.
  • Field Details

    • wrapperListener

      private static WrapperListener wrapperListener
      Listener for the wrapper service commands.
    • LISTENER_AVAILABLE

      private static final String LISTENER_AVAILABLE
      Wrapper version with the listener API.
      See Also:
    • PROPERTIES_AVAILABLE

      private static final String PROPERTIES_AVAILABLE
      Wrapper version with the properties command.
      See Also:
    • LOCATION_AVAILABLE

      private static final String LOCATION_AVAILABLE
      Wrapper version with the location command.
      See Also:
  • Constructor Details

    • ConfigServiceHandler

      public ConfigServiceHandler()
      Creates a handler; the container calls it with no arguments before each submission.
  • Method Details

    • registerWrapperNotifier

      private void registerWrapperNotifier(int code, boolean rekey)
      Register two shutdown hooks, one to rekey and/or tell the wrapper we are stopping, and a final one to tell the wrapper we are stopped.
      Parameters:
      code - the exit code
      rekey - true to kill the router's keys on shutdown
    • registerWrapperNotifier

      public static void registerWrapperNotifier(RouterContext ctx, int code, boolean rekey)
      Register two shutdown hooks, one to rekey and/or tell the wrapper we are stopping, and a final one to tell the wrapper we are stopped.
      Parameters:
      ctx - the router context
      code - the exit code
      rekey - whether to rekey
    • registerSignalHandler

      static void registerSignalHandler(RouterContext ctx)
      Register a handler for signals, so we can handle HUP from the wrapper (wrapper 3.2.0 or higher).
      Parameters:
      ctx - the router context
    • unregisterSignalHandler

      public static void unregisterSignalHandler()
      Unregister the handler for signals.
    • shouldShowCancelGraceful

      public boolean shouldShowCancelGraceful()
      Should we show the cancel button?
      Returns:
      true if graceful shutdown is in progress
    • shouldShowSystray

      public boolean shouldShowSystray()
      Should we show the systray controls?
      Returns:
      true if the systray should be shown
    • isSystrayEnabled

      public boolean isSystrayEnabled()
      Is the systray enabled?
      Returns:
      true if the systray is enabled
    • getConsoleURL

      public String getConsoleURL()
      Get the console URL.
      Returns:
      the full http://host:port URL of the console
    • processForm

      protected void processForm()
      Description copied from class: FormHandler
      Implement this to perform the final processing (in turn, adding formNotice and formError messages, etc)

      Will only be called if _action is non-null and the nonce is valid.

      Specified by:
      processForm in class FormHandler
    • wrapperLogFile

      public static File wrapperLogFile(I2PAppContext ctx)
      Does not necessarily exist.
      Parameters:
      ctx - the I2P app context
      Returns:
      non-null, doesn't necessarily exist
    • enableService

      private void enableService()
      Enables the router as a system service.
    • disableService

      private void disableService()
      Disables the router as a system service.
    • execServiceAction

      private void execServiceAction(String action) throws IOException
      Run the consolidated service management script (service.ps1). The legacy EnableI2P+Service.bat / DisableI2P+Service.bat shims were removed; the Enable/Disable actions now live in service.ps1.
      Parameters:
      action - the action to pass to the script, "Enable" or "Disable"
      Throws:
      IOException - if powershell.exe cannot be started
    • browseOnStartup

      private void browseOnStartup(boolean shouldLaunchBrowser)
      Sets whether the browser opens at startup.
      Parameters:
      shouldLaunchBrowser - true to open the browser on startup
    • changeSystray

      private void changeSystray(boolean enable)
      Enable/disable and start/stop systray.
      Parameters:
      enable - true to start the systray app, false to shut it down