This is an automated email from the ASF dual-hosted git repository. tballison pushed a commit to branch TIKA-4809-stage-3 in repository https://gitbox.apache.org/repos/asf/tika.git
commit f06e2b958b83b169e6cd89328aa6590c0374308b Author: tallison <[email protected]> AuthorDate: Sun Aug 9 20:01:52 2026 -0400 TIKA-4809: Fix welcome-page links, and two bad URLs from the README commit --- tika-server/README.md | 7 ++--- .../tika/server/core/resource/TikaWelcome.java | 36 ++++++++++++++++++---- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/tika-server/README.md b/tika-server/README.md index ae37767733..591a421754 100644 --- a/tika-server/README.md +++ b/tika-server/README.md @@ -33,8 +33,7 @@ $ java -jar tika-server/target/tika-server.jar --help ``` Everything beyond host, port and id is configured in the tika-config JSON file -passed with `-c`, not on the command line. See -[Configuration](https://tika.apache.org/configuration/index.html). +passed with `-c`, not on the command line. Running via Docker ------------------ @@ -50,8 +49,8 @@ Note the `127.0.0.1:` prefix. Unlike the jar, which binds `localhost` by default the Docker images start the server with `-h 0.0.0.0`, so publishing the port without an explicit interface exposes it on every interface of the host. tika-server performs no authentication and parses untrusted files; only expose it -on a trusted, access-controlled network. See -[Security](https://tika.apache.org/security.html). +on a trusted, access-controlled network. See the +[Tika Security Model](https://tika.apache.org/security-model.html). You may also be interested in the https://github.com/apache/tika-docker project which provides prebuilt Docker images. diff --git a/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/TikaWelcome.java b/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/TikaWelcome.java index ef4edd21d3..498d98ec60 100644 --- a/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/TikaWelcome.java +++ b/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/TikaWelcome.java @@ -47,7 +47,12 @@ import org.apache.tika.server.core.HTMLHelper; */ @Path("/") public class TikaWelcome { - private static final String DOCS_URL = "https://wiki.apache.org/tika/TikaJAXRS"; + private static final String DOCS_URL = + "https://cwiki.apache.org/confluence/display/TIKA/TikaJAXRS"; + + /** Matches {@code {name : regex}} in a JAX-RS path, capturing the parameter name. */ + private static final Pattern PATH_TEMPLATE_REGEX = + Pattern.compile("\\{\\s*(\\w+)\\s*:[^}]*}"); private static final Map<Class<? extends Annotation>, String> HTTP_METHODS = new HashMap<>(); @@ -164,13 +169,21 @@ public class TikaWelcome { h.append("<ul>\n"); for (Endpoint e : identifyEndpoints()) { + String displayPath = simplifyPathTemplate(e.path); h.append("<li><b>"); h.append(e.httpMethod); - h.append("</b> <i><a href=\""); - h.append(e.path); - h.append("\">"); - h.append(e.path); - h.append("</a></i><br />"); + h.append("</b> <i>"); + // Only linkify concrete paths; one with a {param} is not fetchable as written. + if (displayPath.indexOf('{') < 0) { + h.append("<a href=\""); + h.append(displayPath); + h.append("\">"); + h.append(displayPath); + h.append("</a>"); + } else { + h.append(displayPath); + } + h.append("</i><br />"); h.append("Class: "); h.append(e.className); h.append("<br />Method: "); @@ -213,6 +226,17 @@ public class TikaWelcome { return text.toString(); } + /** + * Strips the regex from a JAX-RS path template so {@code /rmeta/{handler : (\w+)?}} + * renders as {@code /rmeta/{handler}}. + */ + static String simplifyPathTemplate(String path) { + if (path == null || path.indexOf('{') < 0) { + return path; + } + return PATH_TEMPLATE_REGEX.matcher(path).replaceAll("{$1}"); + } + protected static class Endpoint { public final String className; public final String methodName;
