ottobackwards commented on a change in pull request #4234:
URL: https://github.com/apache/nifi/pull/4234#discussion_r416051173
##########
File path:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
##########
@@ -131,9 +135,19 @@
@WritesAttribute(attribute = "invokehttp.java.exception.message",
description = "The Java exception message raised when the processor fails"),
@WritesAttribute(attribute = "user-defined", description = "If the 'Put
Response Body In Attribute' property is set then whatever it is set to "
+ "will become the attribute key and the value would be the body of
the HTTP response.")})
-@DynamicProperty(name = "Header Name", value = "Attribute Expression
Language", expressionLanguageScope =
ExpressionLanguageScope.FLOWFILE_ATTRIBUTES,
- description = "Send request header with a key matching the
Dynamic Property Key and a value created by evaluating "
- + "the Attribute Expression Language set in the
value of the Dynamic Property.")
+@DynamicProperties ({
+ @DynamicProperty(name = "Header Name", value = "Attribute Expression
Language", expressionLanguageScope =
ExpressionLanguageScope.FLOWFILE_ATTRIBUTES,
+ description =
+ "Send request header with a key matching the Dynamic Property Key
and a value created by evaluating "
+ + "the Attribute Expression Language set in the value of the
Dynamic Property."),
+ @DynamicProperty(name = "post.form.<NAME>", value = "Attribute Expression
Language", expressionLanguageScope =
ExpressionLanguageScope.FLOWFILE_ATTRIBUTES,
+ description =
+ "When the HTTP Method is POST, dynamic properties with the
property name in the form of post.form.<NAME>,"
+ + " where the <NAME> will be the form data name, will be used
to fill out the multipart form parts."
+ + " If the value is the literal 'FLOWFILE_CONTENT', that form
part will have the flowfile's data."
Review comment:
I agree that this is more awkward than I would like, but that is a
general problem with the way that properties work.
A form can have an arbitrary number of fields or parts. It also may not be
for uploading a document. So to make it broadly useful you have to be able to
define multiple fields. Given the way that flowfiles work, I think only being
able to define 1 'file upload' field for the flow file is good enough.
I thought that using this technique, like I did for the ExecuteStreamCommand
to support arguments and fix the escaping issue, would allow for having _N_
parts, with EL support available. Now, new properties for the things that I
have as known constant values _is_ a better way to go, but I was hesitant to
add new properties.
I think the most flexible solution is to use the dynamic parameters, with
new parameters for the content Content form name, Content file 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.
For queries about this service, please contact Infrastructure at:
[email protected]