public class HTTPSServer extends Object
HTTPServer
Modifier and Type | Field and Description |
---|---|
protected static Set<String> |
DEFAULT_ALLOWED_IPS |
protected String |
host |
protected org.languagetool.server.LanguageToolHttpHandler |
httpHandler |
protected int |
port |
protected com.sun.net.httpserver.HttpServer |
server |
Constructor and Description |
---|
HTTPSServer(HTTPSServerConfig config,
boolean runInternally,
String host,
Set<String> allowedIps)
Prepare a server on the given host and port - use run() to start it.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
checkForNonRootUser() |
protected org.languagetool.server.ErrorRequestLimiter |
getErrorRequestLimiterOrNull(HTTPServerConfig config) |
protected ThreadPoolExecutor |
getExecutorService(HTTPServerConfig config) |
protected String |
getProtocol() |
protected org.languagetool.server.RequestLimiter |
getRequestLimiterOrNull(HTTPServerConfig config) |
boolean |
isRunning() |
static void |
main(String[] args) |
protected static void |
printCommonConfigFileOptions() |
protected static void |
printCommonOptions() |
void |
run()
Start the server.
|
void |
stop()
Stop the server.
|
protected static boolean |
usageRequested(String[] args) |
protected int port
protected String host
protected com.sun.net.httpserver.HttpServer server
protected org.languagetool.server.LanguageToolHttpHandler httpHandler
public HTTPSServer(HTTPSServerConfig config, boolean runInternally, String host, Set<String> allowedIps)
runInternally
- if true, then the server was started from the GUI.host
- the host to bind to, e.g. "localhost"
or null
to bind to any hostallowedIps
- the IP addresses from which connections are allowed or null
to allow any hostPortBindingException
- if we cannot bind to the given port, e.g. because something else is running therepublic void stop()
public static void main(String[] args)
protected String getProtocol()
public void run()
public boolean isRunning()
@Nullable protected org.languagetool.server.RequestLimiter getRequestLimiterOrNull(HTTPServerConfig config)
@Nullable protected org.languagetool.server.ErrorRequestLimiter getErrorRequestLimiterOrNull(HTTPServerConfig config)
protected static boolean usageRequested(String[] args)
protected static void printCommonConfigFileOptions()
protected static void printCommonOptions()
protected static void checkForNonRootUser()
protected ThreadPoolExecutor getExecutorService(HTTPServerConfig config)