Class HTTPServerConfig
java.lang.Object
org.languagetool.server.HTTPServerConfig
- Direct Known Subclasses:
HTTPSServerConfig
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected intprotected longprotected Stringprotected booleanprotected Stringprotected Stringprotected Stringstatic final Stringstatic final intThe default port on which the server is running (8081).protected Fileprotected Fileprotected org.languagetool.GlobalConfigprotected List<org.languagetool.Language> protected Stringprotected intprotected intprotected intprotected Fileprotected intprotected longprotected longprotected floatprotected intprotected intprotected intprotected intprotected intprotected intprotected org.languagetool.server.HTTPServerConfig.Modeprotected Fileprotected booleanprotected intprotected booleanprotected intprotected booleanprotected intprotected booleanprotected intprotected intprotected intprotected Fileprotected Stringprotected URIprotected booleanprotected booleanprotected intprotected intprotected booleanprotected booleanprotected File -
Constructor Summary
ConstructorsConstructorDescriptionCreate a server configuration for the default port (DEFAULT_PORT).HTTPServerConfig(int serverPort) HTTPServerConfig(int serverPort, boolean verbose) -
Method Summary
Modifier and TypeMethodDescription@Nullable String@Nullable StringValue to set as the "Access-Control-Allow-Origin" http header.@Nullable FileGet binary path for fasttext language detection@Nullable FileGet model path for fasttext language detectionintGet base directory for neural network models ornullprotected StringgetOptionalProperty(Properties props, String propertyName, String defaultValue) intintgetPort()intprotected StringgetProperty(Properties props, String propertyName, File config) @Nullable URIintbooleanbooleanbooleanbooleanbooleanbooleanvoidvoidsetAllowOriginUrl(String allowOriginUrl) voidsetFasttextBinary(File binary) Set binary path for fasttext language detectionvoidsetFasttextModel(File model) Set model path for fasttext language detectionvoidsetLanguageModelDirectory(String langModelDir) voidsetMaxPipelinePoolSize(int maxPipelinePoolSize) voidsetMaxTextHardLength(int len) voidsetMaxTextLength(int len) voidsetPipelineCaching(boolean pipelineCaching) voidsetPipelineExpireTime(int pipelineExpireTime) voidsetPipelinePrewarming(boolean pipelinePrewarming) voidsetServerURL(@Nullable String url)
-
Field Details
-
DEFAULT_HOST
- See Also:
-
DEFAULT_PORT
public static final int DEFAULT_PORTThe default port on which the server is running (8081).- See Also:
-
verbose
protected boolean verbose -
publicAccess
protected boolean publicAccess -
port
protected int port -
allowOriginUrl
-
serverURL
-
maxTextLength
protected int maxTextLength -
maxTextHardLength
protected int maxTextHardLength -
maxTextLengthWithApiKey
protected int maxTextLengthWithApiKey -
secretTokenKey
-
maxCheckTimeMillis
protected long maxCheckTimeMillis -
maxCheckTimeWithApiKeyMillis
protected long maxCheckTimeWithApiKeyMillis -
maxCheckThreads
protected int maxCheckThreads -
mode
protected org.languagetool.server.HTTPServerConfig.Mode mode -
languageModelDir
-
word2vecModelDir
-
pipelineCaching
protected boolean pipelineCaching -
pipelinePrewarming
protected boolean pipelinePrewarming -
maxPipelinePoolSize
protected int maxPipelinePoolSize -
pipelineExpireTime
protected int pipelineExpireTime -
fasttextModel
-
fasttextBinary
-
neuralNetworkModelDir
-
requestLimit
protected int requestLimit -
requestLimitInBytes
protected int requestLimitInBytes -
timeoutRequestLimit
protected int timeoutRequestLimit -
requestLimitPeriodInSeconds
protected int requestLimitPeriodInSeconds -
ipFingerprintFactor
protected int ipFingerprintFactor -
trustXForwardForHeader
protected boolean trustXForwardForHeader -
maxWorkQueueSize
protected int maxWorkQueueSize -
rulesConfigFile
-
cacheSize
protected int cacheSize -
cacheTTLSeconds
protected long cacheTTLSeconds -
maxErrorsPerWordRate
protected float maxErrorsPerWordRate -
maxSpellingSuggestions
protected int maxSpellingSuggestions -
blockedReferrers
-
dbDriver
-
dbUrl
-
dbUsername
-
dbPassword
-
dbLogging
protected boolean dbLogging -
prometheusMonitoring
protected boolean prometheusMonitoring -
prometheusPort
protected int prometheusPort -
globalConfig
protected org.languagetool.GlobalConfig globalConfig -
disabledRuleIds
-
skipLoggingRuleMatches
protected boolean skipLoggingRuleMatches -
skipLoggingChecks
protected boolean skipLoggingChecks -
slowRuleLoggingThreshold
protected int slowRuleLoggingThreshold -
abTest
-
-
Constructor Details
-
HTTPServerConfig
public HTTPServerConfig()Create a server configuration for the default port (DEFAULT_PORT). -
HTTPServerConfig
public HTTPServerConfig(int serverPort) - Parameters:
serverPort- the port to bind to- Since:
- 2.8
-
HTTPServerConfig
public HTTPServerConfig(int serverPort, boolean verbose) - Parameters:
serverPort- the port to bind toverbose- when set to true, the input text will be logged in case there is an exception
-
-
Method Details
-
setLanguageModelDirectory
-
isVerbose
public boolean isVerbose() -
isPublicAccess
public boolean isPublicAccess() -
getPort
public int getPort() -
getAllowOriginUrl
Value to set as the "Access-Control-Allow-Origin" http header.nullwill not return that header at all. With*your server can be used from any other web site from Javascript/Ajax (search Cross-origin resource sharing (CORS) for details). -
setAllowOriginUrl
- Since:
- 4.2
-
getServerURL
- Returns:
- prefix / base URL for API requests
- Since:
- 4.8
-
setServerURL
- Parameters:
url- prefix / base URL for API requests- Since:
- 4.8
-
setMaxTextLength
public void setMaxTextLength(int len) - Parameters:
len- the maximum text length allowed (in number of characters), texts that are longer will cause an exception when being checked, unless the user can provide a JWT 'token' parameter with a 'maxTextLength' claim
-
setMaxTextHardLength
public void setMaxTextHardLength(int len) - Parameters:
len- the maximum text length allowed (in number of characters), texts that are longer will cause an exception when being checked even if the user can provide a JWT token- Since:
- 3.9
-
getNeuralNetworkModelDir
Get base directory for neural network models ornull- Since:
- 4.4
-
getFasttextModel
Get model path for fasttext language detection- Since:
- 4.3
-
setFasttextModel
-
getFasttextBinary
Get binary path for fasttext language detection- Since:
- 4.3
-
setFasttextBinary
Set binary path for fasttext language detection- Since:
- 4.4
-
isPipelineCachingEnabled
public boolean isPipelineCachingEnabled()- Since:
- 4.4 Cache initalized JLanguageTool instances and share between non-parallel requests with identical paramenters Improves response time (especially when dealing with many small requests without specific settings), but increases memory usage
-
isPipelinePrewarmingEnabled
public boolean isPipelinePrewarmingEnabled()- Since:
- 4.4 Before starting to listen for requests, create a few pipelines for frequently used request settings and run simple checks on them; prevents long response time / request overload on the first real incoming requests
-
getMaxPipelinePoolSize
public int getMaxPipelinePoolSize()- Since:
- 4.4 Keep pipelines ready for this many different request settings
-
getPipelineExpireTime
public int getPipelineExpireTime()- Since:
- 4.4 Expire pipelines for a specific request setting after this many seconds without any matching request elapsed
-
setPipelineCaching
public void setPipelineCaching(boolean pipelineCaching) - Since:
- 4.4
-
setPipelinePrewarming
public void setPipelinePrewarming(boolean pipelinePrewarming) - Since:
- 4.4
-
setMaxPipelinePoolSize
public void setMaxPipelinePoolSize(int maxPipelinePoolSize) - Since:
- 4.4
-
setPipelineExpireTime
public void setPipelineExpireTime(int pipelineExpireTime) - Since:
- 4.4
-
isPrometheusMonitoring
public boolean isPrometheusMonitoring()- Returns:
- Since:
- 4.6
-
getPrometheusPort
public int getPrometheusPort()- Returns:
- Since:
- 4.6
-
getSlowRuleLoggingThreshold
@Experimental public int getSlowRuleLoggingThreshold()- Returns:
- threshold for rule computation time until a warning gets logged, in milliseconds
- Since:
- 4.5
-
isSkipLoggingChecks
public boolean isSkipLoggingChecks()- Since:
- 4.6
-
getDisabledRuleIds
-
getAbTest
- Since:
- 4.4 See if a specific A/B-Test is to be run
-
setAbTest
- Since:
- 4.4 Enable a specific A/B-Test to be run (or null to disable all tests)
-
getProperty
- Throws:
org.languagetool.server.IllegalConfigurationException- if property is not set
-
getOptionalProperty
-