Package org.apache.tika.server.core
Class TikaServerConfig
java.lang.Object
org.apache.tika.server.core.TikaServerConfig
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final intDefault connector idle timeout: 2 minutes.static final longDefault cap on request-body bytes in flight: 0, meaning maxRequestSizeBytes x 2 x pipes clients.static final longHow long a full /async queue blocks a POST before it is rejected with 429.static final longDefault time allowed to receive a request body: 5 minutes, so 1 GiB needs about 29 Mbit/s.static final longDefault request-body cap: 1 GiB.static final longDefault time allowed to write a response body: 5 minutes.static final intstatic final StringComma-separated catalog presets to activate, read at startup like--preset. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe config file withgetPresets()folded in: the file itself when there are none, else a temp copy, for components that load their configuration from a path.getCors()getHost()getId()Identifier for this server, surfaced in the startup log.intHow long a connection may go without any bytes moving before it is closed; defaults toDEFAULT_IDLE_TIMEOUT_MILLIS(2 minutes).longHow many request-body bytes all requests together may hold at once, counted as they are read and freed when each response completes; a request that would go over gets 429.longHow long a POST to /async blocks when the queue is full before it is rejected with 429 (Retry-After); defaults toDEFAULT_MAX_QUEUE_PAUSE_MILLIS.longHow long, from the start of the request, reading its body may take; defaults toDEFAULT_MAX_REQUEST_READ_MILLIS(5 minutes).longMaximum request body in bytes; defaults toDEFAULT_MAX_REQUEST_SIZE_BYTES(1 GiB). tika-server spools uploads to disk, so this bounds how much one request can write.longHow long, from when its status line is sent, writing a response body may take; defaults toDEFAULT_MAX_RESPONSE_WRITE_MILLIS(5 minutes).Prometheus scrape port; null means metrics are off.intgetPort()Catalog presets named with--presetor in "TIKA_PRESETS", activated like"presets": {"name": true}in the config, over the config's own entry for the name.Severity at which each request URI is logged.Null when the config has notlsConfigblock, i.e. plain HTTP.booleanbooleanWhether to accept cleartext HTTP/2 (h2c) as well as HTTP/1.1; off by default.booleanWhether callers may supply per-request parser configuration (the/configendpoints and the multipartconfigpart).booleanWhether the pipes/fetch endpoints (pipes,async) may be enabled.static TikaServerConfigload()Config with only the defaultsstatic TikaServerConfigload(org.apache.commons.cli.CommandLine commandLine) voidsetAllowHttp2(boolean allowHttp2) voidsetAllowPerRequestConfig(boolean allowPerRequestConfig) voidsetAllowPipes(boolean allowPipes) voidsetConfigPath(String path) Set from the -c argument at load time; not a user-settable config key.voidvoidsetEndpoints(ArrayList<String> endpoints) voidvoidvoidsetIdleTimeoutMillis(int idleTimeoutMillis) voidsetMaxInFlightRequestBytes(long maxInFlightRequestBytes) voidsetMaxQueuePauseMillis(long maxQueuePauseMillis) voidsetMaxRequestReadMillis(long maxRequestReadMillis) voidsetMaxRequestSizeBytes(long maxRequestSizeBytes) voidsetMaxResponseWriteMillis(long maxResponseWriteMillis) voidsetMetricsPort(Integer metricsPort) voidsetPort(int port) voidsetRequestLogLevel(String level) voidsetTlsConfig(TlsConfig tlsConfig) boolean
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
DEFAULT_HOST
- See Also:
-
PRESETS_ENV
Comma-separated catalog presets to activate, read at startup like--preset.- See Also:
-
DEFAULT_MAX_REQUEST_SIZE_BYTES
public static final long DEFAULT_MAX_REQUEST_SIZE_BYTESDefault request-body cap: 1 GiB. Generous enough for essentially any single-document upload, bounded so one request cannot fill the temp directory. Operators who genuinely need larger bodies raise it explicitly; setting a negative value restores no limit.- See Also:
-
DEFAULT_MAX_REQUEST_READ_MILLIS
public static final long DEFAULT_MAX_REQUEST_READ_MILLISDefault time allowed to receive a request body: 5 minutes, so 1 GiB needs about 29 Mbit/s.- See Also:
-
DEFAULT_MAX_RESPONSE_WRITE_MILLIS
public static final long DEFAULT_MAX_RESPONSE_WRITE_MILLISDefault time allowed to write a response body: 5 minutes.- See Also:
-
DEFAULT_IDLE_TIMEOUT_MILLIS
public static final int DEFAULT_IDLE_TIMEOUT_MILLISDefault connector idle timeout: 2 minutes. Ends clients that stop sending or reading entirely.- See Also:
-
DEFAULT_MAX_IN_FLIGHT_REQUEST_BYTES
public static final long DEFAULT_MAX_IN_FLIGHT_REQUEST_BYTESDefault cap on request-body bytes in flight: 0, meaning maxRequestSizeBytes x 2 x pipes clients.- See Also:
-
DEFAULT_MAX_QUEUE_PAUSE_MILLIS
public static final long DEFAULT_MAX_QUEUE_PAUSE_MILLISHow long a full /async queue blocks a POST before it is rejected with 429.- See Also:
-
-
Constructor Details
-
TikaServerConfig
public TikaServerConfig()
-
-
Method Details
-
load
Config with only the defaults -
load
public static TikaServerConfig load(org.apache.commons.cli.CommandLine commandLine) throws IOException, TikaException - Throws:
IOExceptionTikaException
-
getPort
public int getPort() -
setPort
public void setPort(int port) -
isAllowPipes
public boolean isAllowPipes()Whether the pipes/fetch endpoints (pipes,async) may be enabled. Off by default; selecting one of those endpoints without this set causes the server to refuse to start. -
setAllowPipes
public void setAllowPipes(boolean allowPipes) -
isAllowPerRequestConfig
public boolean isAllowPerRequestConfig()Whether callers may supply per-request parser configuration (the/configendpoints and the multipartconfigpart). Off by default; when off, such requests are rejected with 403. -
setAllowPerRequestConfig
public void setAllowPerRequestConfig(boolean allowPerRequestConfig) -
isAllowHttp2
public boolean isAllowHttp2()Whether to accept cleartext HTTP/2 (h2c) as well as HTTP/1.1; off by default. HTTP/2 requests get nomaxResponseWriteMillis: its abort closes the connection, which would end every request multiplexed on it. HTTP/2 over TLS is not offered either way (tika-server ships no ALPN server provider). -
setAllowHttp2
public void setAllowHttp2(boolean allowHttp2) -
getHost
-
setHost
-
getRequestLogLevel
Severity at which each request URI is logged. Empty (the default) disables request logging entirely; this does not change the log level of anything else. -
setRequestLogLevel
- Throws:
TikaConfigException
-
getCors
- Returns:
- the origin url for cors, can be "*"
-
setCors
-
hasConfigFile
public boolean hasConfigFile() -
getPresets
Catalog presets named with--presetor in "TIKA_PRESETS", activated like"presets": {"name": true}in the config, over the config's own entry for the name. -
getConfigPathWithPresets
The config file withgetPresets()folded in: the file itself when there are none, else a temp copy, for components that load their configuration from a path.- Throws:
IOException
-
getConfigPath
-
setConfigPath
Set from the -c argument at load time; not a user-settable config key. -
getMaxRequestSizeBytes
public long getMaxRequestSizeBytes()Maximum request body in bytes; defaults toDEFAULT_MAX_REQUEST_SIZE_BYTES(1 GiB). tika-server spools uploads to disk, so this bounds how much one request can write. A negative value disables the limit (the pre-4.0 behavior); an over-limit request is rejected with 413. -
setMaxRequestSizeBytes
public void setMaxRequestSizeBytes(long maxRequestSizeBytes) -
getMaxRequestReadMillis
public long getMaxRequestReadMillis()How long, from the start of the request, reading its body may take; defaults toDEFAULT_MAX_REQUEST_READ_MILLIS(5 minutes). A request still sending after that is rejected with 408. A negative value disables the deadline; zero is rejected. -
setMaxRequestReadMillis
- Throws:
TikaConfigException
-
getMaxResponseWriteMillis
public long getMaxResponseWriteMillis()How long, from when its status line is sent, writing a response body may take; defaults toDEFAULT_MAX_RESPONSE_WRITE_MILLIS(5 minutes). A response still being written after that is cut off. A negative value disables the deadline; zero is rejected. -
setMaxResponseWriteMillis
- Throws:
TikaConfigException
-
getIdleTimeoutMillis
public int getIdleTimeoutMillis()How long a connection may go without any bytes moving before it is closed; defaults toDEFAULT_IDLE_TIMEOUT_MILLIS(2 minutes). Jetty applies it only to a read or write waiting on the wire, so a request waiting on its parse is never ended by it. Must be positive: Jetty treats zero as "use its own default", not "never". -
setIdleTimeoutMillis
- Throws:
TikaConfigException
-
getMaxInFlightRequestBytes
public long getMaxInFlightRequestBytes()How many request-body bytes all requests together may hold at once, counted as they are read and freed when each response completes; a request that would go over gets 429. This bounds the temp disk and memory request bodies take, without letting a client that sends slowly hold capacity it has not used. 0 (the default) meansmaxRequestSizeBytesx 2 x the pipes clients; negative disables it; a positive value belowmaxRequestSizeBytesis rejected, as a request of that size could never succeed. -
setMaxInFlightRequestBytes
public void setMaxInFlightRequestBytes(long maxInFlightRequestBytes) -
getMaxQueuePauseMillis
public long getMaxQueuePauseMillis()How long a POST to /async blocks when the queue is full before it is rejected with 429 (Retry-After); defaults toDEFAULT_MAX_QUEUE_PAUSE_MILLIS. -
setMaxQueuePauseMillis
public void setMaxQueuePauseMillis(long maxQueuePauseMillis) -
getTlsConfig
Null when the config has notlsConfigblock, i.e. plain HTTP. -
tlsEnabled
public boolean tlsEnabled() -
setTlsConfig
-
getMetricsPort
Prometheus scrape port; null means metrics are off. The listener binds togetHost(). -
setMetricsPort
-
getEndpoints
-
setEndpoints
-
getId
Identifier for this server, surfaced in the startup log. Defaults to a random UUID. -
setId
-