Package org.apache.tika.server.core
Class TikaServerConfig
- java.lang.Object
-
- org.apache.tika.config.ConfigBase
-
- org.apache.tika.server.core.TikaServerConfig
-
public class TikaServerConfig extends ConfigBase
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_FORKED_STARTUP_MILLIS
Number of milliseconds to wait for forked process to startupstatic String
DEFAULT_HOST
static long
DEFAULT_MINIMUM_TIMEOUT_MILLIS
Clients may not set a timeout less than this amount.static int
DEFAULT_PORT
static long
DEFAULT_TASK_PULSE_MILLIS
How often to check to see that the task hasn't timed outstatic long
DEFAULT_TASK_TIMEOUT_MILLIS
Number of milliseconds to wait per server task (parse, detect, unpack, translate, etc.) before timing out and shutting down the forked process.static Set<String>
LOG_LEVELS
-
Constructor Summary
Constructors Constructor Description TikaServerConfig()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Path
getConfigPath()
String
getCors()
String
getDigest()
digest configuration string, e.g.int
getDigestMarkLimit()
List<String>
getEndpoints()
List<String>
getForkedJvmArgs()
List<String>
getForkedProcessArgs(int port, String id)
List<String>
getForkedProcessArgs(String portString, String id)
String
getForkedStatusFile()
String
getHost()
String
getId()
String
getIdBase()
String
getJavaPath()
full path to the java executableString
getLogLevel()
long
getMaxFiles()
maximum number of files before the forked server restarts.long
getMaxForkedStartupMillis()
Maximum time in millis to allow for the forked process to startup or restartint
getMaxRestarts()
long
getMinimumTimeoutMillis()
int
getNumRestarts()
String
getPort()
int[]
getPorts()
Set<String>
getSupportedEmitters()
Set<String>
getSupportedFetchers()
long
getTaskPulseMillis()
How often to check to see that a task has timed outlong
getTaskTimeoutMillis()
How long to wait for a task before shutting down the forked server process and restarting it.String
getTempFilePrefix()
TlsConfig
getTlsConfig()
boolean
hasConfigFile()
protected static List<String>
interpolateSysProps(List<String> forkedJvmArgs)
boolean
isEnableUnsecureFeatures()
boolean
isNoFork()
boolean
isPreventStopMethod()
boolean
isReturnStackTrace()
static TikaServerConfig
load()
Config with only the defaultsstatic TikaServerConfig
load(org.apache.commons.cli.CommandLine commandLine)
void
setConfigPath(String path)
void
setCors(String cors)
void
setDigest(String digest)
void
setDigestMarkLimit(int digestMarkLimit)
void
setEnableUnsecureFeatures(boolean enableUnsecureFeatures)
void
setEndpoints(List<String> endpoints)
void
setForkedJvmArgs(List<String> forkedJvmArgs)
void
setHost(String host)
void
setId(String id)
void
setJavaPath(String javaPath)
void
setLogLevel(String level)
void
setMaxFiles(long maxFiles)
void
setMaxforkedStartupMillis(long maxforkedStartupMillis)
void
setMaxForkedStartupMillis(long maxForkedStartupMillis)
void
setMaxRestarts(int maxRestarts)
void
setMinimumTimeoutMillis(long minimumTimeoutMillis)
void
setNoFork(boolean noFork)
void
setPort(String port)
void
setPreventStopMethod(boolean preventStopMethod)
void
setReturnStackTrace(boolean returnStackTrace)
void
setTaskPulseMillis(long taskPulseMillis)
void
setTaskTimeoutMillis(long taskTimeoutMillis)
void
setTlsConfig(TlsConfig tlsConfig)
-
Methods inherited from class org.apache.tika.config.ConfigBase
buildComposite, buildComposite, buildSingle, buildSingle, configure, handleSettings
-
-
-
-
Field Detail
-
DEFAULT_PORT
public static final int DEFAULT_PORT
- See Also:
- Constant Field Values
-
DEFAULT_HOST
public static final String DEFAULT_HOST
- See Also:
- Constant Field Values
-
DEFAULT_TASK_TIMEOUT_MILLIS
public static final long DEFAULT_TASK_TIMEOUT_MILLIS
Number of milliseconds to wait per server task (parse, detect, unpack, translate, etc.) before timing out and shutting down the forked process.- See Also:
- Constant Field Values
-
DEFAULT_MINIMUM_TIMEOUT_MILLIS
public static final long DEFAULT_MINIMUM_TIMEOUT_MILLIS
Clients may not set a timeout less than this amount. This hinders malicious clients from setting the timeout to a very low value and DoS the server by forcing timeout restarts. Making tika-server available to untrusted clients is dangerous.- See Also:
- Constant Field Values
-
DEFAULT_TASK_PULSE_MILLIS
public static final long DEFAULT_TASK_PULSE_MILLIS
How often to check to see that the task hasn't timed out- See Also:
- Constant Field Values
-
DEFAULT_FORKED_STARTUP_MILLIS
public static final long DEFAULT_FORKED_STARTUP_MILLIS
Number of milliseconds to wait for forked process to startup- See Also:
- Constant Field Values
-
-
Method Detail
-
load
public static TikaServerConfig load()
Config with only the defaults
-
load
public static TikaServerConfig load(org.apache.commons.cli.CommandLine commandLine) throws IOException, TikaException
- Throws:
IOException
TikaException
-
isNoFork
public boolean isNoFork()
-
setNoFork
public void setNoFork(boolean noFork)
-
getPort
public String getPort()
-
setPort
public void setPort(String port)
-
getTaskTimeoutMillis
public long getTaskTimeoutMillis()
How long to wait for a task before shutting down the forked server process and restarting it.- Returns:
-
setTaskTimeoutMillis
public void setTaskTimeoutMillis(long taskTimeoutMillis)
- Parameters:
taskTimeoutMillis
- number of milliseconds to allow per task (parse, detection, unzipping, etc.)
-
getTaskPulseMillis
public long getTaskPulseMillis()
How often to check to see that a task has timed out- Returns:
-
setTaskPulseMillis
public void setTaskPulseMillis(long taskPulseMillis)
-
getMaxRestarts
public int getMaxRestarts()
-
setMaxRestarts
public void setMaxRestarts(int maxRestarts)
-
getMaxForkedStartupMillis
public long getMaxForkedStartupMillis()
Maximum time in millis to allow for the forked process to startup or restart- Returns:
-
setMaxForkedStartupMillis
public void setMaxForkedStartupMillis(long maxForkedStartupMillis)
-
getMinimumTimeoutMillis
public long getMinimumTimeoutMillis()
-
setMinimumTimeoutMillis
public void setMinimumTimeoutMillis(long minimumTimeoutMillis)
-
getIdBase
public String getIdBase()
-
getJavaPath
public String getJavaPath()
full path to the java executable- Returns:
-
setJavaPath
public void setJavaPath(String javaPath)
-
getTempFilePrefix
public String getTempFilePrefix()
-
isEnableUnsecureFeatures
public boolean isEnableUnsecureFeatures()
-
setEnableUnsecureFeatures
public void setEnableUnsecureFeatures(boolean enableUnsecureFeatures)
-
getHost
public String getHost()
-
setHost
public void setHost(String host)
-
getLogLevel
public String getLogLevel()
-
setLogLevel
public void setLogLevel(String level) throws TikaConfigException
- Throws:
TikaConfigException
-
getCors
public String getCors()
- Returns:
- the origin url for cors, can be "*"
-
setCors
public void setCors(String cors)
-
hasConfigFile
public boolean hasConfigFile()
-
getConfigPath
public Path getConfigPath()
-
setConfigPath
public void setConfigPath(String path)
-
getDigestMarkLimit
public int getDigestMarkLimit()
-
setDigestMarkLimit
public void setDigestMarkLimit(int digestMarkLimit)
-
getDigest
public String getDigest()
digest configuration string, e.g. md5 or sha256, alternately w 16 or 32 encoding, e.g. md5:32,sha256:16 would result in two digests per file- Returns:
-
setDigest
public void setDigest(String digest)
-
getMaxFiles
public long getMaxFiles()
maximum number of files before the forked server restarts. This is useful for avoiding any slow-building memory leaks/bloat.- Returns:
-
setMaxFiles
public void setMaxFiles(long maxFiles)
-
isReturnStackTrace
public boolean isReturnStackTrace()
-
setReturnStackTrace
public void setReturnStackTrace(boolean returnStackTrace)
-
setTlsConfig
public void setTlsConfig(TlsConfig tlsConfig)
-
getTlsConfig
public TlsConfig getTlsConfig()
-
getId
public String getId()
-
setId
public void setId(String id)
-
getNumRestarts
public int getNumRestarts()
-
getForkedStatusFile
public String getForkedStatusFile()
-
setMaxforkedStartupMillis
public void setMaxforkedStartupMillis(long maxforkedStartupMillis)
-
setPreventStopMethod
public void setPreventStopMethod(boolean preventStopMethod)
-
isPreventStopMethod
public boolean isPreventStopMethod()
-
getPorts
public int[] getPorts()
-
-