kinow commented on code in PR #1645:
URL: https://github.com/apache/jena/pull/1645#discussion_r1036464108


##########
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/system/DataUploader.java:
##########
@@ -113,29 +117,16 @@ public static UploadDetails incomingData(HttpAction 
action, StreamRDF dest) {
      * This function assumes it is inside a transaction.
      */
     private static UploadDetails fileUploadMultipart(HttpAction action, 
StreamRDF dest) {
-        String base = ActionLib.wholeRequestURL(action.getRequest());
-        ServletFileUpload upload = new ServletFileUpload();
+        HttpServletRequest request = action.getRequest();
+        String base = ActionLib.wholeRequestURL(request);
         StreamRDFCounting countingDest =  StreamRDFLib.count(dest);
-
+        if ( request.getAttribute(multipartAttributeName) == null )
+            request.setAttribute(multipartAttributeName, 
multipartConfigElement);
         try {
-            FileItemIterator iter = 
upload.getItemIterator(action.getRequest());
-            while (iter.hasNext()) {
-                FileItemStream fileStream = iter.next();
-                if (fileStream.isFormField()) {
-                    // Form field - this code only supports multipart file 
upload.
-                    String fieldName = fileStream.getFieldName();
-                    InputStream stream = fileStream.openStream();
-                    String value = Streams.asString(stream, "UTF-8");
-                    // This code is currently used to put multiple files into 
a single destination.
-                    // Additional field/values do not make sense.
-                    ServletOps.errorBadRequest(format("Only files accepted in 
multipart file upload (got %s=%s)", fieldName, value));
-                    // errorBadRequest does not return.
-                    return null;
-                }
-
-                InputStream input = fileStream.openStream();
+            for ( Part part : request.getParts() ) {
+                InputStream input = part.getInputStream();

Review Comment:
   :ok_man: that's some nice simplification!



##########
jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/system/DataUploader.java:
##########
@@ -102,6 +102,10 @@ public static UploadDetails incomingData(HttpAction 
action, StreamRDF dest) {
         }
     }
 
+    // Jetty requires a setting of this annotation object as a request 
attribute.
+     private static MultipartConfigElement multipartConfigElement = new 
MultipartConfigElement("");
+     private static String multipartAttributeName = 
org.eclipse.jetty.server.Request.__MULTIPART_CONFIG_ELEMENT;

Review Comment:
   Do you know if this `__MULTIPART_CONFIG_ELEMENT` attribute was created this 
way to discourage external use?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to