Package org.languagetool.server
Class Server
- java.lang.Object
-
- org.languagetool.server.Server
-
- Direct Known Subclasses:
HTTPServer,HTTPSServer
abstract class Server extends java.lang.ObjectSuper class for HTTP and HTTPS server.- Since:
- 2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classServer.StoppingThreadPoolExecutor
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.Set<java.lang.String>DEFAULT_ALLOWED_IPSprotected java.lang.Stringhostprotected LanguageToolHttpHandlerhttpHandlerprivate booleanisRunningprotected intportprotected com.sun.net.httpserver.HttpServerserver
-
Constructor Summary
Constructors Constructor Description Server()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static voidcheckForNonRootUser()protected @Nullable ErrorRequestLimitergetErrorRequestLimiterOrNull(HTTPServerConfig config)protected java.util.concurrent.ThreadPoolExecutorgetExecutorService(java.util.concurrent.LinkedBlockingQueue<java.lang.Runnable> workQueue, HTTPServerConfig config)protected abstract java.lang.StringgetProtocol()protected @Nullable RequestLimitergetRequestLimiterOrNull(HTTPServerConfig config)booleanisRunning()protected static voidprintCommonConfigFileOptions()protected static voidprintCommonOptions()voidrun()Start the server.voidstop()Stop the server.protected static booleanusageRequested(java.lang.String[] args)
-
-
-
Field Detail
-
DEFAULT_ALLOWED_IPS
protected static final java.util.Set<java.lang.String> DEFAULT_ALLOWED_IPS
-
port
protected int port
-
host
protected java.lang.String host
-
server
protected com.sun.net.httpserver.HttpServer server
-
httpHandler
protected LanguageToolHttpHandler httpHandler
-
isRunning
private boolean isRunning
-
-
Method Detail
-
getProtocol
protected abstract java.lang.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(java.lang.String[] args)
-
printCommonConfigFileOptions
protected static void printCommonConfigFileOptions()
-
printCommonOptions
protected static void printCommonOptions()
-
checkForNonRootUser
protected static void checkForNonRootUser()
-
getExecutorService
protected java.util.concurrent.ThreadPoolExecutor getExecutorService(java.util.concurrent.LinkedBlockingQueue<java.lang.Runnable> workQueue, HTTPServerConfig config)
-
-