kwin commented on code in PR #54:
URL: 
https://github.com/apache/sling-org-apache-sling-api/pull/54#discussion_r1776786773


##########
src/main/java/org/apache/sling/api/request/builder/Builders.java:
##########
@@ -69,27 +69,41 @@ private Builders() {}
     }
 
     /**
-     * Creates a new request parameter
+     * Creates a new {@code application/x-www-form-urlencoded} request 
parameter with UTF-8 encoding
      *
      * @param name the parameter name
      * @param value the parameter value
      * @return a request parameter
      * @since 1.2 (Sling API Bundle 2.26.2)
      */
-    public static @NotNull RequestParameter newRequestParameter(String name, 
String value) {
+    public static @NotNull RequestParameter newRequestParameter(@NotNull 
String name, @NotNull String value) {
         return new RequestParameterImpl(name, value);
     }
 
     /**
-     * Creates a new request parameter
+     * Creates a new {@code application/x-www-form-urlencoded} request 
parameter with the given encoding
      *
      * @param name the parameter name
      * @param value the parameter value
      * @param encoding the charset of the value
      * @return a request parameter
      * @since 1.2 (Sling API Bundle 2.26.2)
      */
-    public static @NotNull RequestParameter newRequestParameter(String name, 
String value, Charset encoding) {
+    public static @NotNull RequestParameter newRequestParameter(@NotNull 
String name, @NotNull String value, @NotNull Charset encoding) {
         return new RequestParameterImpl(name, value, encoding);
     }
+
+    /**
+     * Creates a new binary request parameter
+     *
+     * @param name the parameter name
+     * @param value the parameter value
+     * @param fileName the file name (may be {@code null})
+     * @param contentType the content type (may be {@code null})
+     * @return a request parameter
+     * @since 1.3 (Sling API Bundle 2.28.0)
+     */
+    public static @NotNull RequestParameter newRequestParameter(@NotNull 
String name, byte @NotNull[] value, String fileName, String contentType) {
+        return new RequestParameterImpl(name, value, fileName, contentType);

Review Comment:
   @cziegeler Is there a need for binary parameters also for 
https://github.com/apache/sling-org-apache-sling-api/blob/2f95145f469ae175adb3d82e4e3e361236f0f2a4/src/main/java/org/apache/sling/api/request/builder/SlingHttpServletRequestBuilder.java#L37?
 Its `withBody(String)` method only allows Strings and does not seem to end up 
in the returned RequestParameterMap 
(https://github.com/apache/sling-org-apache-sling-api/blob/2f95145f469ae175adb3d82e4e3e361236f0f2a4/src/main/java/org/apache/sling/api/request/builder/impl/SlingHttpServletRequestImpl.java#L493)
 



-- 
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: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to