Package org.languagetool.server
Class HTTPServer
java.lang.Object
org.languagetool.server.Server
org.languagetool.server.HTTPServer
A small embedded HTTP server that checks text. Returns XML, prints debugging
to stdout/stderr. Note that by default the server only accepts connections from
localhost for security reasons.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.languagetool.server.Server
Server.StoppingThreadPoolExecutor
-
Field Summary
FieldsFields inherited from class org.languagetool.server.Server
DEFAULT_ALLOWED_IPS, host, httpHandler, port, server
-
Constructor Summary
ConstructorsConstructorDescriptionPrepare a server on the given port - use run() to start it.HTTPServer
(HTTPServerConfig config) Prepare a server on localhost on the given port - use run() to start it.HTTPServer
(HTTPServerConfig config, boolean runInternally) Prepare a server on localhost on the given port - use run() to start it.HTTPServer
(HTTPServerConfig config, boolean runInternally, String host, Set<String> allowedIps) Prepare a server on the given host and port - use run() to start it.HTTPServer
(HTTPServerConfig config, boolean runInternally, Set<String> allowedIps) Prepare a server on localhost on the given port - use run() to start it. -
Method Summary
Methods inherited from class org.languagetool.server.Server
checkForNonRootUser, getErrorRequestLimiterOrNull, getExecutorService, getRequestLimiterOrNull, isRunning, printCommonConfigFileOptions, printCommonOptions, run, usageRequested
-
Field Details
-
executorService
-
-
Constructor Details
-
HTTPServer
public HTTPServer()Prepare a server on the given port - use run() to start it. Accepts connections from localhost only. -
HTTPServer
Prepare a server on localhost on the given port - use run() to start it. Accepts connections from localhost only.- Throws:
PortBindingException
- if we cannot bind to the given port, e.g. because something else is running there
-
HTTPServer
Prepare a server on localhost on the given port - use run() to start it. Accepts connections from localhost only.- Parameters:
runInternally
- if true, then the server was started from the GUI.- Throws:
PortBindingException
- if we cannot bind to the given port, e.g. because something else is running there
-
HTTPServer
Prepare a server on localhost on the given port - use run() to start it. The server will bind to localhost.- Parameters:
runInternally
- if true, then the server was started from the GUI.allowedIps
- the IP addresses from which connections are allowed ornull
to allow any host- Throws:
PortBindingException
- if we cannot bind to the given port, e.g. because something else is running there
-
HTTPServer
public HTTPServer(HTTPServerConfig 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"
ornull
to bind to any hostallowedIps
- the IP addresses from which connections are allowed ornull
to allow any host- Throws:
PortBindingException
- if we cannot bind to the given port, e.g. because something else is running there- Since:
- 1.7
-
-
Method Details
-
stop
public void stop()Description copied from class:Server
Stop the server. Once stopped, a server cannot be used again. -
main
-
getProtocol
- Specified by:
getProtocol
in classServer
-