Class Server

java.lang.Object
org.languagetool.server.Server
Direct Known Subclasses:
HTTPServer, HTTPSServer

abstract class Server extends Object
Super class for HTTP and HTTPS server.
Since:
2.0
  • Field Details

    • DEFAULT_ALLOWED_IPS

      protected static final Set<String> DEFAULT_ALLOWED_IPS
    • port

      protected int port
    • host

      protected String host
    • server

      protected com.sun.net.httpserver.HttpServer server
    • httpHandler

      protected LanguageToolHttpHandler httpHandler
    • isRunning

      private boolean isRunning
  • Constructor Details

    • Server

      Server()
  • Method Details

    • getProtocol

      protected abstract String getProtocol()
    • run

      public void run()
      Start the server.
    • stop

      public void stop()
      Stop the server. Once stopped, a server cannot be used again.
    • isRunning

      public boolean isRunning()
      Returns:
      whether the server is running
      Since:
      2.0
    • getRequestLimiterOrNull

      @Nullable protected @Nullable RequestLimiter getRequestLimiterOrNull(HTTPServerConfig config)
    • getErrorRequestLimiterOrNull

      @Nullable protected @Nullable ErrorRequestLimiter getErrorRequestLimiterOrNull(HTTPServerConfig config)
    • usageRequested

      protected static boolean usageRequested(String[] args)
    • printCommonConfigFileOptions

      protected static void printCommonConfigFileOptions()
    • printCommonOptions

      protected static void printCommonOptions()
    • checkForNonRootUser

      protected static void checkForNonRootUser()
    • getExecutorService

      protected ThreadPoolExecutor getExecutorService(LinkedBlockingQueue<Runnable> workQueue, HTTPServerConfig config)