nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James McMahon <>
Subject Re: How to send back a reply from HandleHTTPRequest
Date Wed, 08 Feb 2017 09:02:35 GMT
This is very helpful. Thank you very much Pierre. -Jim

On Wed, Feb 8, 2017 at 2:44 AM, Pierre Villard <>

> James,
> If you always want to return 200 as HTTP response whatever the request is,
> then you could have:
> HandleHttpRequest directly linked to HandleHttpResponse with property
> status code to 200, and HandleHttpRequest linked to your flow to perform
> the expected tasks.
> Now let's say that you want to return a response based on the request,
> then you can set processors between the HandleHttpRequest and the
> HandleHttpResponse and then use the expression language to set the response
> code to the value contained by an attribute of the flow file based on the
> previous processors. Note that the content of the flow file will be used as
> content of the HTTP response.
> One example could be to expose a web service to retrieve files from HDFS
> (a bit like WebHDFS): the user sends a request with the path of the file to
> retrieve, then you link HandleHttpRequest to a FetchHDFS processor, then if
> the file exists (success relationship) you can link to a HandleHttpResponse
> with code 200 and the user will be able to get the file from HDFS, and if
> the file does not exist (or if there is any kind of issue, failure
> relationship), you can link the FetchHDFS to a HandleHttpResponse with an
> error code 4xx. Obviously you could add some complexity to your workflow:
> you could also allow users to send data to HDFS, etc, etc.
> Hope this clarify a bit.
> -Pierre
> 2017-02-07 23:51 GMT+01:00 James McMahon <>:
>> Can the response be a standard http code that is automatically returned
>> by the HandleHTTPResponse processor? Also, is it the Handle processor that
>> is determining the correct response and sending it back, or a different
>> processor? I guess I am still confused because I did not see any provision
>> in the configuration for HandleHTTPResponse that sent back an http status.
>> -Jim
>> On Tue, Feb 7, 2017 at 4:08 PM, Aldrin Piri <> wrote:
>>> HI James,
>>> This would occur via the HandleHTTPResponse.  At a high level, the
>>> request flowfile is routed to the HandleHTTPResponse processor.  Of course,
>>> any kind of processing could occur between the two points.
>>> A simple example can be located on the sample templates page with the
>>> Hello_NiFi_Web_Service.xml [1].  In this case, it is performing a very
>>> simple replacement of text that is returned to the caller.
>>> Please let us know if you have any additional questions.
>>> --aldrin
>>> [1]
>>> +Dataflow+Templates
>>> On Tue, Feb 7, 2017 at 4:04 PM, James McMahon <>
>>> wrote:
>>>> Good evening. I have a number of customer applications that will be
>>>> posting content to a NiFi HandleHTTPRequest processor. These apps need an
>>>> http reply so that they know status. I can't find in the configuration any
>>>> way to do that. I know that I must be overlooking what must be a
>>>> commonplace requirement. Can anyone tell me how they configured their
>>>> workflow so that it provides a response and status to the request? Thanks
>>>> very much. -Jim

View raw message