exceptionfactory commented on code in PR #6163:
URL: https://github.com/apache/nifi/pull/6163#discussion_r908650655


##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java:
##########
@@ -166,367 +170,355 @@ public class InvokeHTTP extends AbstractProcessor {
 
     public static final String DEFAULT_CONTENT_TYPE = 
"application/octet-stream";
 
-    public static final String FORM_BASE = "post:form";
-
-    // Set of flowfile attributes which we generally always ignore during
-    // processing, including when converting http headers, copying attributes, 
etc.
-    // This set includes our strings defined above as well as some standard 
flowfile
-    // attributes.
-    public static final Set<String> IGNORED_ATTRIBUTES = 
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
-            STATUS_CODE, STATUS_MESSAGE, RESPONSE_BODY, REQUEST_URL, 
RESPONSE_URL, TRANSACTION_ID, REMOTE_DN,
-            EXCEPTION_CLASS, EXCEPTION_MESSAGE,
-            "uuid", "filename", "path")));
-
-    public static final String HTTP = "http";
-    public static final String HTTPS = "https";
-
-    public static final String GET_METHOD = "GET";
-    public static final String POST_METHOD = "POST";
-    public static final String PUT_METHOD = "PUT";
-    public static final String PATCH_METHOD = "PATCH";
-    public static final String DELETE_METHOD = "DELETE";
-    public static final String HEAD_METHOD = "HEAD";
-    public static final String OPTIONS_METHOD = "OPTIONS";
-
-    private static final Pattern DYNAMIC_FORM_PARAMETER_NAME = 
Pattern.compile("post:form:(?<formDataName>.*)$");
+    protected static final String FORM_DATA_NAME_BASE = "post:form";
+    private static final Pattern FORM_DATA_NAME_PARAMETER_PATTERN = 
Pattern.compile("post:form:(?<formDataName>.*)$");
     private static final String FORM_DATA_NAME_GROUP = "formDataName";
-    private static final String CONTENT_ENCODING_HEADER = "Content-Encoding";
 
-    // properties
-    public static final PropertyDescriptor PROP_METHOD = new 
PropertyDescriptor.Builder()
+    private static final Set<String> IGNORED_REQUEST_ATTRIBUTES = 
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(
+            STATUS_CODE,
+            STATUS_MESSAGE,
+            RESPONSE_BODY,
+            REQUEST_URL,
+            RESPONSE_URL,
+            TRANSACTION_ID,
+            REMOTE_DN,
+            EXCEPTION_CLASS,
+            EXCEPTION_MESSAGE,
+            CoreAttributes.UUID.key(),
+            CoreAttributes.FILENAME.key(),
+            CoreAttributes.PATH.key()
+    )));
+
+    public static final PropertyDescriptor HTTP_METHOD = new 
PropertyDescriptor.Builder()
             .name("HTTP Method")
             .description("HTTP request method (GET, POST, PUT, PATCH, DELETE, 
HEAD, OPTIONS). Arbitrary methods are also supported. "
                     + "Methods other than POST, PUT and PATCH will be sent 
without a message body.")
             .required(true)
-            .defaultValue(GET_METHOD)
+            .defaultValue(HttpMethod.GET.name())
             
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
             
.addValidator(StandardValidators.createAttributeExpressionLanguageValidator(AttributeExpression.ResultType.STRING))
             .build();
 
-    public static final PropertyDescriptor PROP_URL = new 
PropertyDescriptor.Builder()
+    public static final PropertyDescriptor HTTP_URL = new 
PropertyDescriptor.Builder()
             .name("Remote URL")
-            .description("Remote URL which will be connected to, including 
scheme, host, port, path.")
+            .displayName("HTTP URL")
+            .description("HTTP remote URL including a scheme of http or https, 
as well as a hostname or IP address with optional port and path elements.")
             .required(true)
             
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
             .addValidator(StandardValidators.URL_VALIDATOR)
             .build();
 
-    public static final PropertyDescriptor PROP_CONNECT_TIMEOUT = new 
PropertyDescriptor.Builder()
+    public static final PropertyDescriptor HTTP2_DISABLED = new 
PropertyDescriptor.Builder()
+            .name("disable-http2")
+            .displayName("HTTP/2 Disabled")
+            .description("Disable negotiation of HTTP/2 protocol. HTTP/2 
requires TLS. HTTP/1.1 protocol supported is required when HTTP/2 is disabled.")
+            .required(true)
+            .defaultValue("False")
+            .allowableValues("True", "False")
+            .build();
+
+    public static final PropertyDescriptor SSL_CONTEXT_SERVICE = new 
PropertyDescriptor.Builder()
+            .name("SSL Context Service")
+            .description("SSL Context Service provides trusted certificates 
and client certificates for TLS communication.")
+            .required(false)
+            .identifiesControllerService(SSLContextService.class)
+            .build();
+
+    public static final PropertyDescriptor SOCKET_CONNECT_TIMEOUT = new 
PropertyDescriptor.Builder()
             .name("Connection Timeout")
-            .description("Max wait time for connection to remote service.")
+            .displayName("Socket Connect Timeout")
+            .description("Maximum time to wait for initial socket connection 
to the HTTP URL.")
             .required(true)
             .defaultValue("5 secs")
             .addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
             .build();
 
-    public static final PropertyDescriptor PROP_READ_TIMEOUT = new 
PropertyDescriptor.Builder()
+    public static final PropertyDescriptor SOCKET_READ_TIMEOUT = new 
PropertyDescriptor.Builder()
             .name("Read Timeout")
-            .description("Max wait time for response from remote service.")
+            .displayName("Socket Read Timeout")
+            .description("Maximum time to wait for receiving responses from a 
socket connection to the HTTP URL.")
             .required(true)
             .defaultValue("15 secs")
             .addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
             .build();
 
-    public static final PropertyDescriptor PROP_IDLE_TIMEOUT = new 
PropertyDescriptor.Builder()
+    public static final PropertyDescriptor SOCKET_IDLE_TIMEOUT = new 
PropertyDescriptor.Builder()
             .name("idle-timeout")
-            .displayName("Idle Timeout")
-            .description("Max idle time before closing connection to the 
remote service.")
+            .displayName("Socket Idle Timeout")
+            .description("Maximum time to wait before closing idle connections 
to the HTTP URL.")
             .required(true)
             .defaultValue("5 mins")
             .addValidator(StandardValidators.createTimePeriodValidator(1, 
TimeUnit.MILLISECONDS, Integer.MAX_VALUE, TimeUnit.SECONDS))
             .build();
 
-    public static final PropertyDescriptor PROP_MAX_IDLE_CONNECTIONS = new 
PropertyDescriptor.Builder()
+    public static final PropertyDescriptor SOCKET_IDLE_CONNECTIONS = new 
PropertyDescriptor.Builder()
             .name("max-idle-connections")
-            .displayName("Max Idle Connections")
-            .description("Max number of idle connections to keep open.")
+            .displayName("Socket Idle Connections")
+            .description("Maximum number of idle connections to the HTTP URL.")
             .required(true)
             .defaultValue("5")
             .addValidator(StandardValidators.INTEGER_VALIDATOR)
             .build();
 
-    public static final PropertyDescriptor PROP_DATE_HEADER = new 
PropertyDescriptor.Builder()
-            .name("Include Date Header")
-            .description("Include an RFC-2616 Date header in the request.")
-            .required(true)
-            .defaultValue("True")
-            .allowableValues("True", "False")
-            .addValidator(StandardValidators.BOOLEAN_VALIDATOR)
-            .build();
-
-    public static final PropertyDescriptor PROP_FOLLOW_REDIRECTS = new 
PropertyDescriptor.Builder()
-            .name("Follow Redirects")
-            .description("Follow HTTP redirects issued by remote server.")
-            .required(true)
-            .defaultValue("True")
-            .allowableValues("True", "False")
-            .addValidator(StandardValidators.BOOLEAN_VALIDATOR)
-            .build();
-
-    public static final PropertyDescriptor PROP_ATTRIBUTES_TO_SEND = new 
PropertyDescriptor.Builder()
-            .name("Attributes to Send")
-            .description("Regular expression that defines which attributes to 
send as HTTP headers in the request. "
-                    + "If not defined, no attributes are sent as headers. Also 
any dynamic properties set will be sent as headers. "
-                    + "The dynamic property key will be the header key and the 
dynamic property value will be interpreted as expression "
-                    + "language will be the header value.")
-            .required(false)
-            .addValidator(StandardValidators.REGULAR_EXPRESSION_VALIDATOR)
-            .build();
-
-    public static final PropertyDescriptor PROP_USERAGENT = new 
PropertyDescriptor.Builder()
-            .name("Useragent")
-            .displayName("Useragent")
-            .description("The Useragent identifier sent along with each 
request")
+    @Deprecated
+    public static final PropertyDescriptor PROXY_HOST = new 
PropertyDescriptor.Builder()
+            .name("Proxy Host")
+            .description("Proxy Host and dependent properties are deprecated 
in favor of Proxy Configuration Service. Proxy Host can be configured using an 
IP address or DNS address.")
             .required(false)
-            
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .build();
 
-    public static final PropertyDescriptor PROP_SSL_CONTEXT_SERVICE = new 
PropertyDescriptor.Builder()
-            .name("SSL Context Service")
-            .description("The SSL Context Service used to provide client 
certificate information for TLS/SSL (https) connections."
-                    + " It is also used to connect to HTTPS Proxy.")
+    @Deprecated
+    public static final PropertyDescriptor PROXY_PORT = new 
PropertyDescriptor.Builder()
+            .name("Proxy Port")
+            .description("Proxy Port and dependent properties are deprecated 
in favor of Proxy Configuration Service. Port number for the configured Proxy 
Host address.")
             .required(false)
-            .identifiesControllerService(SSLContextService.class)
+            .addValidator(StandardValidators.PORT_VALIDATOR)
+            
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+            .dependsOn(PROXY_HOST)
             .build();
 
-    public static final PropertyDescriptor PROP_PROXY_TYPE = new 
PropertyDescriptor.Builder()
+    @Deprecated
+    public static final PropertyDescriptor PROXY_TYPE = new 
PropertyDescriptor.Builder()
             .name("Proxy Type")
             .displayName("Proxy Type")
-            .description("The type of the proxy we are connecting to. Must be 
either " + HTTP + " or " + HTTPS)
-            .defaultValue(HTTP)
+            .description("Proxy Type and dependent properties are deprecated 
in favor of Proxy Configuration Service. Proxy protocol type is not used")
+            .defaultValue("http")
             
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_EL_VALIDATOR)
+            .dependsOn(PROXY_HOST)
             .build();
 
-    public static final PropertyDescriptor PROP_PROXY_HOST = new 
PropertyDescriptor.Builder()
-            .name("Proxy Host")
-            .description("The fully qualified hostname or IP address of the 
proxy server")
+    @Deprecated
+    public static final PropertyDescriptor PROXY_USERNAME = new 
PropertyDescriptor.Builder()
+            .name("invokehttp-proxy-user")
+            .displayName("Proxy Username")
+            .description("Proxy Username and dependent properties are 
deprecated in favor of Proxy Configuration Service. Username to set when 
authenticating with a Proxy server.")
             .required(false)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+            .dependsOn(PROXY_HOST)
             .build();
 
-    public static final PropertyDescriptor PROP_PROXY_PORT = new 
PropertyDescriptor.Builder()
-            .name("Proxy Port")
-            .description("The port of the proxy server")
+    @Deprecated
+    public static final PropertyDescriptor PROXY_PASSWORD = new 
PropertyDescriptor.Builder()
+            .name("invokehttp-proxy-password")
+            .displayName("Proxy Password")
+            .description("Proxy Password and dependent properties are 
deprecated in favor of Proxy Configuration Service. Password to set when 
authenticating with a Proxy server.")
             .required(false)
-            .addValidator(StandardValidators.PORT_VALIDATOR)
+            .sensitive(true)
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+            .dependsOn(PROXY_HOST)
             .build();
 
-    public static final PropertyDescriptor PROP_PROXY_USER = new 
PropertyDescriptor.Builder()
-            .name("invokehttp-proxy-user")
-            .displayName("Proxy Username")
-            .description("Username to set when authenticating against proxy")
+    public static final PropertyDescriptor 
REQUEST_OAUTH2_ACCESS_TOKEN_PROVIDER = new PropertyDescriptor.Builder()
+            .name("oauth2-access-token-provider")
+            .displayName("Request OAuth2 Access Token Provider")
+            .description("Enables managed retrieval of OAuth2 Bearer Token 
applied to HTTP requests using the Authorization Header.")
+            .identifiesControllerService(OAuth2AccessTokenProvider.class)
             .required(false)
-            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-            
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .build();
 
-    public static final PropertyDescriptor PROP_PROXY_PASSWORD = new 
PropertyDescriptor.Builder()
-            .name("invokehttp-proxy-password")
-            .displayName("Proxy Password")
-            .description("Password to set when authenticating against proxy")
+    public static final PropertyDescriptor REQUEST_USERNAME = new 
PropertyDescriptor.Builder()
+            .name("Basic Authentication Username")
+            .displayName("Request Username")
+            .description("The username provided for authentication of HTTP 
requests. Encoded using Base64 for HTTP Basic Authentication as described in 
RFC 7617.")
+            .required(false)
+            
.addValidator(StandardValidators.createRegexMatchingValidator(Pattern.compile("^[\\x20-\\x39\\x3b-\\x7e\\x80-\\xff]+$")))
+            .build();
+
+    public static final PropertyDescriptor REQUEST_PASSWORD = new 
PropertyDescriptor.Builder()
+            .name("Basic Authentication Password")
+            .displayName("Request Password")
+            .description("The password provided for authentication of HTTP 
requests. Encoded using Base64 for HTTP Basic Authentication as described in 
RFC 7617.")
             .required(false)
             .sensitive(true)
-            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
-            
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+            
.addValidator(StandardValidators.createRegexMatchingValidator(Pattern.compile("^[\\x20-\\x7e\\x80-\\xff]+$")))
             .build();
 
-    public static final PropertyDescriptor PROP_CONTENT_ENCODING = new 
PropertyDescriptor.Builder()
-            .name("Content-Encoding")
-            .displayName("Content-Encoding")
-            .description("HTTP Content-Encoding applied to request body during 
transmission. The receiving server must support the selected encoding to avoid 
request failures.")
-            .required(true)
-            .defaultValue(ContentEncodingStrategy.DISABLED.getValue())
-            .allowableValues(ContentEncodingStrategy.class)
+    public static final PropertyDescriptor 
REQUEST_DIGEST_AUTHENTICATION_ENABLED = new PropertyDescriptor.Builder()
+            .name("Digest Authentication")
+            .displayName("Request Digest Authentication Enabled")
+            .description("Enable Digest Authentication on HTTP requests with 
Username and Password credentials as described in RFC 7616.")
+            .required(false)
+            .defaultValue("false")
+            .allowableValues("true", "false")
+            .dependsOn(REQUEST_USERNAME)
             .build();
 
-    public static final PropertyDescriptor PROP_CONTENT_TYPE = new 
PropertyDescriptor.Builder()
-            .name("Content-Type")
-            .description("The Content-Type to specify for when content is 
being transmitted through a PUT, POST or PATCH. "
-                    + "In the case of an empty value after evaluating an 
expression language expression, Content-Type defaults to " + 
DEFAULT_CONTENT_TYPE)
-            .required(true)
-            
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
-            .defaultValue("${" + CoreAttributes.MIME_TYPE.key() + "}")
-            
.addValidator(StandardValidators.createAttributeExpressionLanguageValidator(AttributeExpression.ResultType.STRING))
+    public static final PropertyDescriptor 
REQUEST_FAILURE_PENALIZATION_ENABLED = new PropertyDescriptor.Builder()
+            .name("Penalize on \"No Retry\"")
+            .displayName("Request Failure Penalization Enabled")
+            .description("Enable penalization of request FlowFiles when 
receiving HTTP response with a status code between 400 and 499.")
+            .required(false)
+            .defaultValue(Boolean.FALSE.toString())
+            .allowableValues(Boolean.TRUE.toString(), Boolean.FALSE.toString())
             .build();
 
-    public static final PropertyDescriptor PROP_SEND_BODY = new 
PropertyDescriptor.Builder()
+    public static final PropertyDescriptor REQUEST_BODY_ENABLED = new 
PropertyDescriptor.Builder()
             .name("send-message-body")
-            .displayName("Send Message Body")
-            .description("If true, sends the HTTP message body on 
POST/PUT/PATCH requests (default).  If false, suppresses the message body and 
content-type header for these requests.")
-            .defaultValue("true")
-            .allowableValues("true", "false")
+            .displayName("Request Body Enabled")
+            .description("Enable sending HTTP request payload body for PATCH, 
POST, or PUT methods.")
+            .defaultValue(Boolean.TRUE.toString())
+            .allowableValues(Boolean.TRUE.toString(), Boolean.FALSE.toString())
             .required(false)
+            .dependsOn(HTTP_METHOD, HttpMethod.PATCH.name(), 
HttpMethod.POST.name(), HttpMethod.PUT.name())
             .build();
 
-    public static final PropertyDescriptor PROP_FORM_BODY_FORM_NAME = new 
PropertyDescriptor.Builder()
+    public static final PropertyDescriptor REQUEST_FORM_DATA_NAME = new 
PropertyDescriptor.Builder()
             .name("form-body-form-name")
-            .displayName("FlowFile Form Data Name")
-            .description("When Send Message Body is true, and FlowFile Form 
Data Name is set, "
-                    + " the FlowFile will be sent as the message body in 
multipart/form format with this value "
-                    + "as the form data name.")
+            .displayName("Request Multipart Form-Data Name")

Review Comment:
   Thanks, good point, will expand to description to indicate that this enables 
and sets the form data name.



-- 
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]

Reply via email to