You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2026/01/29 14:19:06 UTC

(sling-org-apache-sling-starter-integration-tests) branch issue/SLING-13083 updated (33b64a5 -> 6142b2e)

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

rombert pushed a change to branch issue/SLING-13083
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-starter-integration-tests.git


 discard 33b64a5  SLING-13083 - Code acessing the "request-parts-iterator"  request attribute broken after migration to Jakarta
     new 6142b2e  SLING-13083 - Code acessing the "request-parts-iterator"  request attribute broken after migration to Jakarta

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (33b64a5)
            \
             N -- N -- N   refs/heads/issue/SLING-13083 (6142b2e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../starter/webapp/integrationtest/servlets/StreamedUploadTest.java    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


(sling-org-apache-sling-starter-integration-tests) 01/01: SLING-13083 - Code acessing the "request-parts-iterator" request attribute broken after migration to Jakarta

Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch issue/SLING-13083
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-starter-integration-tests.git

commit 6142b2e835c3d6c8d15f7f1b8738dba966afbd28
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Jan 29 15:18:54 2026 +0100

    SLING-13083 - Code acessing the "request-parts-iterator"  request attribute broken after migration to Jakarta
    
    Add a unit test exercising streamed multipart upload
---
 .../servlets/StreamedUploadTest.java               | 78 ++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/src/main/java/org/apache/sling/starter/webapp/integrationtest/servlets/StreamedUploadTest.java b/src/main/java/org/apache/sling/starter/webapp/integrationtest/servlets/StreamedUploadTest.java
new file mode 100644
index 0000000..1d6d862
--- /dev/null
+++ b/src/main/java/org/apache/sling/starter/webapp/integrationtest/servlets/StreamedUploadTest.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.starter.webapp.integrationtest.servlets;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.methods.multipart.FilePart;
+import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
+import org.apache.commons.httpclient.methods.multipart.Part;
+import org.apache.commons.httpclient.methods.multipart.StringPart;
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+
+public class StreamedUploadTest extends HttpTestBase {
+
+    private static final String SERVLET_PATH = "/bin/streamed-upload.txt";
+    private static final String UPLOAD_MODE_HEADER = "Sling-uploadmode";
+    private static final String STREAM_MODE = "stream";
+
+    // enable once SLING-13083 is fixed
+    public void disabledTestStreamedUploadWithJavaxPart() throws IOException {
+        final String url = HTTP_BASE_URL + SERVLET_PATH;
+
+        // Create a test file to upload
+        File testFile = createTestFile("streamed-upload-test.txt", "Test content for streamed upload");
+
+        try {
+            PostMethod post = new PostMethod(url);
+
+            // Set the streaming upload mode header
+            post.setRequestHeader(UPLOAD_MODE_HEADER, STREAM_MODE);
+
+            // Create multipart request with a file part
+            Part[] parts = {new StringPart("field1", "value1"), new FilePart("file", testFile)};
+            post.setRequestEntity(new MultipartRequestEntity(parts, post.getParams()));
+
+            int status = httpClient.executeMethod(post);
+            String response = post.getResponseBodyAsString();
+
+            // Check for success - the servlet returns "OK:" if casting worked
+            assertEquals("Expected 200 OK response. Response body: " + response, 200, status);
+            assertTrue(
+                    "Response should indicate success with javax.servlet.http.Part. Response: " + response,
+                    response.contains("OK:"));
+            assertTrue(
+                    "Response should show processed parts. Response: " + response,
+                    response.contains("Part 1:") || response.contains("Processed"));
+
+        } finally {
+            testFile.delete();
+        }
+    }
+
+    private File createTestFile(String name, String content) throws IOException {
+        Path tempPath = Files.createTempFile("streamed-upload-", ".txt");
+        Files.writeString(tempPath, content);
+        return tempPath.toFile();
+    }
+}