This is an automated email from the ASF dual-hosted git repository.

tballison pushed a commit to branch TIKA-4809-stage-9
in repository https://gitbox.apache.org/repos/asf/tika.git

commit 2661c531cec74a37c8f763ca78997a55247da30a
Author: tallison <[email protected]>
AuthorDate: Mon Aug 10 19:48:00 2026 -0400

    TIKA-4809: Collapse /detect/stream and /language/{stream,string}
---
 .../integration-testing/run-uat-script.adoc        |  4 +--
 .../advanced/integration-testing/tika-server.adoc  | 16 ++++++------
 .../migration-to-4x/migrating-tika-server-4x.adoc  | 12 +++++++++
 .../ROOT/pages/using-tika/server/index.adoc        |  8 +++---
 tika-server/README.md                              |  2 +-
 .../server/core/resource/DetectorResource.java     |  1 -
 .../server/core/resource/LanguageResource.java     | 29 ++++------------------
 .../tika/server/core/LanguageResourceTest.java     |  6 ++---
 .../apache/tika/server/core/TikaWelcomeTest.java   |  2 +-
 .../tika/server/standard/DetectorResourceTest.java |  2 +-
 10 files changed, 37 insertions(+), 45 deletions(-)

diff --git 
a/docs/modules/ROOT/pages/advanced/integration-testing/run-uat-script.adoc 
b/docs/modules/ROOT/pages/advanced/integration-testing/run-uat-script.adoc
index 66413af2f4..d697bc8538 100644
--- a/docs/modules/ROOT/pages/advanced/integration-testing/run-uat-script.adoc
+++ b/docs/modules/ROOT/pages/advanced/integration-testing/run-uat-script.adoc
@@ -44,12 +44,12 @@ Integration Testing], translated to bash + curl assertions.
 Coverage includes:
 
 * `/version`, `/parsers`, `/detectors`, `/mime-types` (introspection)
-* `/detect/stream` (mime detection)
+* `/detect` (mime detection)
 * `/tika`, `/tika/text`, `/tika/xml`, `/tika/json` (parse)
 * `/meta`, `/meta/\{field}` (metadata)
 * `/rmeta`, `/rmeta/text` (recursive metadata)
 * `/unpack/all` (embedded extraction; verifies the response is a valid zip)
-* `/language/stream`
+* `/language`
 * `/meta/form`, `/rmeta/form` (multipart variants)
 * `allowPerRequestConfig=false` gating, both enforcement points: the path-based
   filter (`/meta/config`, `/rmeta/config`, `/tika/config`, 
`/unpack/all/config` all
diff --git 
a/docs/modules/ROOT/pages/advanced/integration-testing/tika-server.adoc 
b/docs/modules/ROOT/pages/advanced/integration-testing/tika-server.adoc
index 47cf85353c..548d7dd3ae 100644
--- a/docs/modules/ROOT/pages/advanced/integration-testing/tika-server.adoc
+++ b/docs/modules/ROOT/pages/advanced/integration-testing/tika-server.adoc
@@ -57,11 +57,11 @@ curl -s http://localhost:9998/version
 
 *Expected:* `Apache Tika X.X.X`
 
-=== Test 2: PUT /detect/stream
+=== Test 2: PUT /detect
 
 [source,bash]
 ----
-curl -s -X PUT -T testPDF.pdf http://localhost:9998/detect/stream
+curl -s -X PUT -T testPDF.pdf http://localhost:9998/detect
 ----
 
 *Expected:* `application/pdf`
@@ -138,11 +138,11 @@ curl -s -X PUT -T test_recursive_embedded.docx 
http://localhost:9998/rmeta/text
 
 *Expected:* JSON array with ToTextContentHandler content.
 
-=== Test 11: PUT /language/stream
+=== Test 11: PUT /language
 
 [source,bash]
 ----
-curl -s -X PUT -T testPDF.pdf http://localhost:9998/language/stream
+curl -s -X PUT -T testPDF.pdf http://localhost:9998/language
 ----
 
 *Expected:* Two-letter language code (e.g., `en`, `th`).
@@ -406,7 +406,7 @@ The following endpoints were tested and verified working:
 |Endpoint |Method |Status
 
 |`/version` |GET |PASS
-|`/detect/stream` |PUT |PASS
+|`/detect` |PUT |PASS
 |`/tika` |PUT |PASS
 |`/tika/text` |PUT |PASS
 |`/tika/html` |PUT |PASS
@@ -416,7 +416,7 @@ The following endpoints were tested and verified working:
 |`/meta/\{field}` |PUT |PASS
 |`/rmeta` |PUT |PASS
 |`/rmeta/text` |PUT |PASS
-|`/language/stream` |PUT |PASS
+|`/language` |PUT |PASS
 |`/unpack/all` |PUT |PASS
 |`/parsers` |GET |PASS
 |`/detectors` |GET |PASS
@@ -445,7 +445,7 @@ The following endpoints were tested and verified working:
 
 === Issue 1: Language Detection Accuracy
 
-Short texts may not be detected reliably. The `/language/stream` endpoint 
works best with substantial text content.
+Short texts may not be detected reliably. The `/language` endpoint works best 
with substantial text content.
 
 == Quick Reference
 
@@ -478,7 +478,7 @@ curl -X PUT -T file.docx http://localhost:9998/rmeta/text
 === Detection
 [source,bash]
 ----
-curl -X PUT -T file.pdf http://localhost:9998/detect/stream
+curl -X PUT -T file.pdf http://localhost:9998/detect
 ----
 
 === Extract Embedded Files
diff --git 
a/docs/modules/ROOT/pages/migration-to-4x/migrating-tika-server-4x.adoc 
b/docs/modules/ROOT/pages/migration-to-4x/migrating-tika-server-4x.adoc
index e79dd92398..6ebd4f0302 100644
--- a/docs/modules/ROOT/pages/migration-to-4x/migrating-tika-server-4x.adoc
+++ b/docs/modules/ROOT/pages/migration-to-4x/migrating-tika-server-4x.adoc
@@ -97,6 +97,18 @@ These endpoints were never usable as shipped. Every request 
had to name a fully-
 
 **Migration:** Call the translation service you use directly, or invoke 
`tika-translate` from your own code. Tika's translation support is unaffected; 
only the server endpoints are gone.
 
+=== Renamed Endpoints
+
+==== `/detect/stream` is now `/detect`
+
+==== `/language/stream` and `/language/string` are now both `/language`
+
+The `/stream` and `/string` suffixes never described anything a caller could 
choose between. Every one of these endpoints has always taken the request body 
and `@Consumes("*/*")`; the two `/language` paths differed only in whether 
JAX-RS bound the body to a `String` or an `InputStream`, and both then ran the 
identical detection. The suffixes existed to disambiguate Java method 
signatures, not to offer an option.
+
+Collapsing them also removes the `/detect/stream` vs `/detectors` 
near-collision. `/detectors` is unchanged -- it lists the server's configured 
detectors and does not detect anything.
+
+**Migration:** drop the suffix. `PUT /detect/stream` becomes `PUT /detect`; 
`PUT /language/stream` and `PUT /language/string` both become `PUT /language`. 
Request bodies, headers, and responses are unchanged.
+
 === Error Response Bodies Are Now JSON
 
 In 3.x, error responses from `/tika`, `/rmeta`, and `/unpack` returned a 
plain-text
diff --git a/docs/modules/ROOT/pages/using-tika/server/index.adoc 
b/docs/modules/ROOT/pages/using-tika/server/index.adoc
index 181750c4b3..ee7502c34c 100644
--- a/docs/modules/ROOT/pages/using-tika/server/index.adoc
+++ b/docs/modules/ROOT/pages/using-tika/server/index.adoc
@@ -186,8 +186,8 @@ curl -T document.pdf 
http://localhost:9998/meta/Content-Type   # single field
 * `/parsers` and `/parsers/details` — registered parsers
 * `/detectors` — registered detectors
 * `/mime-types` — known MIME types
-* `/detect/stream` — type detection only (no parsing)
-* `/language/stream`, `/language/string` — language detection
+* `/detect` — type detection only (no parsing)
+* `/language` — language detection
 * `/pipes`, `/async` — Pipes-based bulk processing
 
 NOTE: `/pipes` and `/async` require `allowPipes` (they drive process-isolated 
fetching
@@ -197,7 +197,7 @@ is a plain opt-in endpoint — enable it simply by listing it 
under `endpoints`.
 
 WARNING: `/language` does its work *in the server's own JVM*, not in a forked 
pipes worker.
 It is therefore outside the process isolation that protects `/tika`, `/rmeta`, 
`/meta`,
-`/detect/stream`, and `/unpack` — a crash or memory exhaustion takes the 
server with it rather than
+`/detect`, and `/unpack` — a crash or memory exhaustion takes the server with 
it rather than
 one worker.
 
 `/language` caps detection at the first 100,000 characters, since accuracy 
saturates well
@@ -207,7 +207,7 @@ caller can still exhaust the heap with a large enough body, 
or with enough concu
 Treat it as available only to trusted callers, the same as the rest of the 
server — see
 xref:security.adoc[the security model]. If you do not need it, omit it from 
`endpoints`.
 
-NOTE: `/detect/stream` runs in a forked pipes worker like the parsing 
endpoints. Detection opens
+NOTE: `/detect` runs in a forked pipes worker like the parsing endpoints. 
Detection opens
 containers — zip, OPC, POIFS — over caller-supplied bytes, so it gets the same 
isolation,
 timeouts, and worker restart. It does not require `allowPipes`.
 
diff --git a/tika-server/README.md b/tika-server/README.md
index 591a421754..0db12ee92f 100644
--- a/tika-server/README.md
+++ b/tika-server/README.md
@@ -89,7 +89,7 @@ Usage examples from command line with `curl` utility:
 `curl -T price.xls http://localhost:9998/meta`
 
 * Detect media type from CSV format using file extension hint:  
-`curl -X PUT -H "Content-Disposition: attachment; filename=foo.csv" 
--upload-file foo.csv http://localhost:9998/detect/stream`
+`curl -X PUT -H "Content-Disposition: attachment; filename=foo.csv" 
--upload-file foo.csv http://localhost:9998/detect`
 
 
 HTTP Return Codes
diff --git 
a/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/DetectorResource.java
 
b/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/DetectorResource.java
index 65b096f276..577f7b7238 100644
--- 
a/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/DetectorResource.java
+++ 
b/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/DetectorResource.java
@@ -50,7 +50,6 @@ public class DetectorResource {
     }
 
     @PUT
-    @Path("stream")
     @Consumes("*/*")
     @Produces("text/plain")
     public String detect(final InputStream is, @Context HttpHeaders 
httpHeaders, @Context final UriInfo info) {
diff --git 
a/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/LanguageResource.java
 
b/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/LanguageResource.java
index 852f11dd2d..f9107c2b78 100644
--- 
a/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/LanguageResource.java
+++ 
b/tika-server/tika-server-core/src/main/java/org/apache/tika/server/core/resource/LanguageResource.java
@@ -41,48 +41,29 @@ public class LanguageResource {
 
     // TIKA-4510: handle @PUT and @POST separately to avoid nondeterministic 
failures
     @PUT
-    @Path("/stream")
     @Consumes("*/*")
     @Produces("text/plain")
-    public String detectPutStream(final InputStream is) throws IOException {
+    public String detectPut(final InputStream is) throws IOException {
         return detectStream(is);
     }
 
     @POST
-    @Path("/stream")
     @Consumes("*/*")
     @Produces("text/plain")
-    public String detectPostStream(final InputStream is) throws IOException {
+    public String detectPost(final InputStream is) throws IOException {
         return detectStream(is);
     }
 
-    @PUT
-    @Path("/string")
-    @Consumes("*/*")
-    @Produces("text/plain")
-    public String detectPutString(final String string) throws IOException {
-        return detectString(string);
-    }
-
-    @POST
-    @Path("/string")
-    @Consumes("*/*")
-    @Produces("text/plain")
-    public String detectPostString(final String string) throws IOException {
-        return detectString(string);
-    }
-
     /**
      * Detection accuracy saturates within the first few thousand characters, 
so anything
      * past this only buys work whose size the caller chooses. Input beyond it 
is ignored
      * rather than rejected: the answer is the same either way, and rejecting 
would break
      * callers who legitimately post whole documents.
      * <p>
-     * This bounds the detection, not the request. These endpoints hold the 
text in the
+     * This bounds the detection, not the request. This endpoint holds the 
text in the
      * server's own heap instead of a pipes child, so a large enough body 
still costs
-     * memory before this class sees it -- for the /string variants the body 
is already a
-     * String by then. Bounding the body itself needs a request-size limit, 
which the
-     * server does not currently have. See the DoS note in the server docs.
+     * memory before this class sees it. Bounding the body itself needs a 
request-size
+     * limit, which the server does not currently have. See the DoS note in 
the server docs.
      */
     public static final int MAX_DETECT_CHARS = 100_000;
 
diff --git 
a/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/LanguageResourceTest.java
 
b/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/LanguageResourceTest.java
index bf7bd83c3f..5d194ff4c2 100644
--- 
a/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/LanguageResourceTest.java
+++ 
b/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/LanguageResourceTest.java
@@ -39,8 +39,8 @@ import org.apache.tika.server.core.writer.ZipWriter;
 public class LanguageResourceTest extends CXFTestBase {
 
     private static final String LANG_PATH = "/language";
-    private static final String LANG_STREAM_PATH = LANG_PATH + "/stream";
-    private static final String LANG_STRING_PATH = LANG_PATH + "/string";
+    private static final String LANG_STREAM_PATH = LANG_PATH;
+    private static final String LANG_STRING_PATH = LANG_PATH;
     private static final String ENGLISH_STRING = "This is English!";
     private static final String FRENCH_STRING = "c'est comme ci comme ça";
 
@@ -158,7 +158,7 @@ public class LanguageResourceTest extends CXFTestBase {
     }
 
     private String detectViaResource(InputStream is) throws Exception {
-        return new LanguageResource().detectPutStream(is);
+        return new LanguageResource().detectPut(is);
     }
 
     private static class CountingInputStream extends java.io.FilterInputStream 
{
diff --git 
a/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/TikaWelcomeTest.java
 
b/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/TikaWelcomeTest.java
index 0a83a51e08..690058db88 100644
--- 
a/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/TikaWelcomeTest.java
+++ 
b/tika-server/tika-server-core/src/test/java/org/apache/tika/server/core/TikaWelcomeTest.java
@@ -35,7 +35,7 @@ import org.apache.tika.server.core.resource.TikaWelcome;
 
 public class TikaWelcomeTest extends CXFTestBase {
     protected static final String WELCOME_PATH = "/";
-    protected static final String PATH_RESOURCE = "/detect/stream"; // 
TIKA-1567
+    protected static final String PATH_RESOURCE = "/detect"; // TIKA-1567
     protected static final String PATH_RESOURCE_2 = "/meta/form"; //TIKA-1567
     private static final String VERSION_PATH = TikaVersionTest.VERSION_PATH;
 
diff --git 
a/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/DetectorResourceTest.java
 
b/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/DetectorResourceTest.java
index 6ba7d2ab1b..b02bcd25d3 100644
--- 
a/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/DetectorResourceTest.java
+++ 
b/tika-server/tika-server-standard/src/test/java/org/apache/tika/server/standard/DetectorResourceTest.java
@@ -39,7 +39,7 @@ import org.apache.tika.server.core.writer.ZipWriter;
 public class DetectorResourceTest extends CXFTestBase {
 
     private static final String DETECT_PATH = "/detect";
-    private static final String DETECT_STREAM_PATH = DETECT_PATH + "/stream";
+    private static final String DETECT_STREAM_PATH = DETECT_PATH;
     private static final String FOO_CSV = "test-documents/foo.csv";
     private static final String CDEC_CSV_NO_EXT = 
"test-documents/CDEC_WEATHER_2010_03_02";
 

Reply via email to