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 longDEFAULT_FORKED_STARTUP_MILLISNumber of milliseconds to wait for forked process to startupstatic StringDEFAULT_HOSTstatic longDEFAULT_MINIMUM_TIMEOUT_MILLISClients may not set a timeout less than this amount.static intDEFAULT_PORTstatic longDEFAULT_TASK_PULSE_MILLISHow often to check to see that the task hasn't timed outstatic longDEFAULT_TASK_TIMEOUT_MILLISNumber 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 PathgetConfigPath()StringgetCors()StringgetDigest()digest configuration string, e.g.intgetDigestMarkLimit()List<String>getEndpoints()List<String>getForkedJvmArgs()List<String>getForkedProcessArgs(int port, String id)List<String>getForkedProcessArgs(String portString, String id)StringgetForkedStatusFile()StringgetHost()StringgetId()StringgetIdBase()StringgetJavaPath()full path to the java executableStringgetLogLevel()longgetMaxFiles()maximum number of files before the forked server restarts.longgetMaxForkedStartupMillis()Maximum time in millis to allow for the forked process to startup or restartintgetMaxRestarts()longgetMinimumTimeoutMillis()intgetNumRestarts()StringgetPort()int[]getPorts()Set<String>getSupportedEmitters()Set<String>getSupportedFetchers()longgetTaskPulseMillis()How often to check to see that a task has timed outlonggetTaskTimeoutMillis()How long to wait for a task before shutting down the forked server process and restarting it.StringgetTempFilePrefix()TlsConfiggetTlsConfig()booleanhasConfigFile()protected static List<String>interpolateSysProps(List<String> forkedJvmArgs)booleanisEnableUnsecureFeatures()booleanisNoFork()booleanisPreventStopMethod()booleanisReturnStackTrace()static TikaServerConfigload()Config with only the defaultsstatic TikaServerConfigload(org.apache.commons.cli.CommandLine commandLine)voidsetConfigPath(String path)voidsetCors(String cors)voidsetDigest(String digest)voidsetDigestMarkLimit(int digestMarkLimit)voidsetEnableUnsecureFeatures(boolean enableUnsecureFeatures)voidsetEndpoints(List<String> endpoints)voidsetForkedJvmArgs(List<String> forkedJvmArgs)voidsetHost(String host)voidsetId(String id)voidsetJavaPath(String javaPath)voidsetLogLevel(String level)voidsetMaxFiles(long maxFiles)voidsetMaxforkedStartupMillis(long maxforkedStartupMillis)voidsetMaxForkedStartupMillis(long maxForkedStartupMillis)voidsetMaxRestarts(int maxRestarts)voidsetMinimumTimeoutMillis(long minimumTimeoutMillis)voidsetNoFork(boolean noFork)voidsetPort(String port)voidsetPreventStopMethod(boolean preventStopMethod)voidsetReturnStackTrace(boolean returnStackTrace)voidsetTaskPulseMillis(long taskPulseMillis)voidsetTaskTimeoutMillis(long taskTimeoutMillis)voidsetTlsConfig(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:
IOExceptionTikaException
-
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)
-
getTlsConfig
public TlsConfig getTlsConfig()
-
setTlsConfig
public void setTlsConfig(TlsConfig tlsConfig)
-
getId
public String getId()
-
setId
public void setId(String id)
-
getNumRestarts
public int getNumRestarts()
-
getForkedStatusFile
public String getForkedStatusFile()
-
setMaxforkedStartupMillis
public void setMaxforkedStartupMillis(long maxforkedStartupMillis)
-
isPreventStopMethod
public boolean isPreventStopMethod()
-
setPreventStopMethod
public void setPreventStopMethod(boolean preventStopMethod)
-
getPorts
public int[] getPorts()
-
-