Skip to content

Commit 5add0fa

Browse files
committed
TIKA-4809: Purge dead keys from the server config section
1 parent fe197f0 commit 5add0fa

3 files changed

Lines changed: 15 additions & 46 deletions

File tree

docs/modules/ROOT/pages/using-tika/server/index.adoc

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -322,23 +322,18 @@ Server behavior beyond host/port is controlled by a JSON config file passed via
322322
|`false`
323323
|Include parser stack traces in error responses. Useful in dev, dangerous in production (leaks internals).
324324

325-
|`digest`
326-
|`""` (off)
327-
|Compute a digest of the parsed bytes. Comma-separated algorithm names: `md5`, `sha1`, `sha256`, `sha384`, `sha512`.
328-
329-
|`digestMarkLimit`
330-
|`20971520` (20 MiB)
331-
|Max bytes buffered for digest computation.
332-
333325
|`logLevel`
334326
|_inherited_
335327
|`debug` or `info` to override the runtime log level.
336328

337-
|`idBase`
329+
|`id`
338330
|random UUID
339-
|Override the auto-generated server ID (the `-i` CLI flag is the same setting).
331+
|Override the auto-generated server ID, which is written to the startup log (the `-i` CLI flag is the same setting).
340332
|===
341333

334+
NOTE: Digests are configured in `parse-context`, not in the `server` section. See
335+
xref:configuration/digesters.adoc[Digesters].
336+
342337
For the full Pipes-related sections (`pipes`, `fetchers`, `emitters`, `parse-context`)
343338
that tika-server 4.x requires, see
344339
xref:migration-to-4x/migrating-tika-server-4x.adoc#_configuration_changes[Configuration Changes].

tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerConfig.java

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public class TikaServerConfig {
4141
public static final String DEFAULT_HOST = "localhost";
4242
public static final Set<String> LOG_LEVELS = new HashSet<>(Arrays.asList("debug", "info"));
4343
private static final Logger LOG = LoggerFactory.getLogger(TikaServerConfig.class);
44-
private static final int DEFAULT_DIGEST_MARK_LIMIT = 20 * 1024 * 1024;
4544
/**
4645
* Endpoints that expose the pipes/fetch machinery (process-isolated pipes
4746
* parsing and async batch processing). Selecting any of these requires
@@ -71,20 +70,16 @@ public class TikaServerConfig {
7170
private boolean allowPerRequestConfig = false;
7271
private String cors = "";
7372
private boolean returnStackTrace = false;
74-
private String idBase = UUID
73+
private String id = UUID
7574
.randomUUID()
7675
.toString();
7776
private int port = DEFAULT_PORT;
7877
private String host = DEFAULT_HOST;
79-
private int digestMarkLimit = DEFAULT_DIGEST_MARK_LIMIT;
80-
private String digest = "";
8178
//debug or info only
8279
private String logLevel = "";
8380
private Path configPath;
8481
private ArrayList<String> endpoints = new ArrayList<>();
8582

86-
private boolean preventStopMethod = false;
87-
8883
private TlsConfig tlsConfig = new TlsConfig();
8984

9085
/**
@@ -144,10 +139,6 @@ public void setPort(int port) {
144139
this.port = port;
145140
}
146141

147-
public String getIdBase() {
148-
return idBase;
149-
}
150-
151142
/**
152143
* Whether the pipes/fetch endpoints ({@code pipes}, {@code async}) may be
153144
* enabled. Off by default; selecting one of those endpoints without this set
@@ -237,37 +228,17 @@ public boolean hasConfigFile() {
237228
return configPath != null;
238229
}
239230

231+
@com.fasterxml.jackson.annotation.JsonIgnore
240232
public Path getConfigPath() {
241233
return configPath;
242234
}
243235

236+
/** Set from the -c argument at load time; not a user-settable config key. */
237+
@com.fasterxml.jackson.annotation.JsonIgnore
244238
public void setConfigPath(String path) {
245239
this.configPath = Paths.get(path);
246240
}
247241

248-
public int getDigestMarkLimit() {
249-
return digestMarkLimit;
250-
}
251-
252-
public void setDigestMarkLimit(int digestMarkLimit) {
253-
this.digestMarkLimit = digestMarkLimit;
254-
}
255-
256-
/**
257-
* digest configuration string, e.g. md5 or sha256, alternately w 16 or 32 encoding,
258-
* e.g. md5:32,sha256:16 would result in two digests per file
259-
*
260-
* @return
261-
*/
262-
public String getDigest() {
263-
return digest;
264-
}
265-
266-
public void setDigest(String digest) {
267-
LOG.info("As of Tika 2.5.0, you can set the digester via the AutoDetectParserConfig in " + "tika-config.xml. We plan to remove this commandline option in 2.8.0");
268-
this.digest = digest;
269-
}
270-
271242
public boolean isReturnStackTrace() {
272243
return returnStackTrace;
273244
}
@@ -292,13 +263,15 @@ public void setEndpoints(ArrayList<String> endpoints) {
292263
this.endpoints = endpoints;
293264
}
294265

266+
/**
267+
* Identifier for this server, surfaced in the startup log. Defaults to a random UUID.
268+
*/
295269
public String getId() {
296-
//TODO fix this
297-
return idBase;
270+
return id;
298271
}
299272

300273
public void setId(String id) {
301-
this.idBase = id;
274+
this.id = id;
302275
}
303276

304277
private void addEndPoints(List<String> endPoints) {

tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/TikaServerProcess.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ private static ServerDetails initServer(TikaServerConfig tikaServerConfig) throw
232232
ServerDetails details = new ServerDetails();
233233
details.sf = sf;
234234
details.url = url;
235+
details.serverId = tikaServerConfig.getId();
235236
details.serverStatus = serverStatus;
236237
return details;
237238
}

0 commit comments

Comments
 (0)