Class HTTPSServer
java.lang.Object
org.languagetool.server.HTTPSServer
A small embedded HTTPS server that checks text. Works only with https, not with http.
- Since:
- 2.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected org.languagetool.server.LanguageToolHttpHandlerprotected intprotected com.sun.net.httpserver.HttpServer -
Constructor Summary
ConstructorsConstructorDescriptionHTTPSServer(HTTPSServerConfig config, boolean runInternally, String host, Set<String> allowedIps) Prepare a server on the given host and port - use run() to start it. -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidprotected @Nullable org.languagetool.server.ErrorRequestLimiterprotected ThreadPoolExecutorgetExecutorService(LinkedBlockingQueue<Runnable> workQueue, HTTPServerConfig config) protected Stringprotected @Nullable org.languagetool.server.RequestLimiterbooleanstatic voidprotected static voidprotected static voidvoidrun()Start the server.voidstop()Stop the server.protected static booleanusageRequested(String[] args)
-
Field Details
-
DEFAULT_ALLOWED_IPS
-
port
protected int port -
host
-
server
protected com.sun.net.httpserver.HttpServer server -
httpHandler
protected org.languagetool.server.LanguageToolHttpHandler httpHandler
-
-
Constructor Details
-
HTTPSServer
public HTTPSServer(HTTPSServerConfig config, boolean runInternally, String host, Set<String> allowedIps) Prepare a server on the given host and port - use run() to start it.- Parameters:
runInternally- if true, then the server was started from the GUI.host- the host to bind to, e.g."localhost"ornullto bind to any hostallowedIps- the IP addresses from which connections are allowed ornullto allow any host- Throws:
PortBindingException- if we cannot bind to the given port, e.g. because something else is running there
-
-
Method Details
-
stop
public void stop()Stop the server. Once stopped, a server cannot be used again. -
main
-
getProtocol
-
run
public void run()Start the server. -
isRunning
public boolean isRunning()- Returns:
- whether the server is running
- Since:
- 2.0
-
getRequestLimiterOrNull
@Nullable protected @Nullable org.languagetool.server.RequestLimiter getRequestLimiterOrNull(HTTPServerConfig config) -
getErrorRequestLimiterOrNull
@Nullable protected @Nullable org.languagetool.server.ErrorRequestLimiter getErrorRequestLimiterOrNull(HTTPServerConfig config) -
usageRequested
-
printCommonConfigFileOptions
protected static void printCommonConfigFileOptions() -
printCommonOptions
protected static void printCommonOptions() -
checkForNonRootUser
protected static void checkForNonRootUser() -
getExecutorService
protected ThreadPoolExecutor getExecutorService(LinkedBlockingQueue<Runnable> workQueue, HTTPServerConfig config)
-