You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Eric Chaves <er...@uolet.com> on 2017/12/08 02:09:58 UTC
How can I change the content-type of a flow file in a script processor?
Hi guys,
I'm trying to programatically set the content-type of a flow-file by
calling flowFile.putAttribute('content-type', 'application/json') but it's
not working.
How can I change my flow-file content-type?
Regards,
Eric
Re: How can I change the content-type of a flow file in a script processor?
Posted by Eric Chaves <er...@uolet.com>.
Thanks guys.
2017-12-08 13:27 GMT-02:00 Russell Bateman <ru...@windofkeltia.com>:
> Eric,
>
> Just a reminder not to forget that this modifies the flowfile and you must
> gather/carry that modification in a practical sense. Therefore, your code
> will be
>
> flowfile = session.putAttribute( flowfile, "content-type",
> "application/json" );
>
> and thence you'll use the updated flowfile the next time you need it (such
> as when you call session.transfer( flowfile, SUCCESS ) ).
>
> Hope this reminder is useful,
>
> Russ
>
> On 12/07/2017 07:12 PM, Chris Herrera wrote:
>
> Hi Eric,
>
> If its for the content viewer you might want to use mime.type.
> additionally you can use session.putAttribute(flowFile, “content-type”,
> "application/json”);
>
> Regards,
> Chris
>
>
> On Dec 7, 2017, 8:10 PM -0600, Eric Chaves <er...@uolet.com>
> <er...@uolet.com>, wrote:
>
> Hi guys,
>
> I'm trying to programatically set the content-type of a flow-file by
> calling flowFile.putAttribute('content-type', 'application/json') but
> it's not working.
>
> How can I change my flow-file content-type?
>
> Regards,
>
> Eric
>
>
>
Re: How can I change the content-type of a flow file in a script
processor?
Posted by Russell Bateman <ru...@windofkeltia.com>.
Eric,
Just a reminder not to forget that this modifies the flowfile and you
must gather/carry that modification in a practical sense. Therefore,
your code will be
flowfile = session.putAttribute( flowfile, "content-type",
"application/json" );
and thence you'll use the updated flowfile the next time you need it
(such as when you call session.transfer( flowfile, SUCCESS )).
Hope this reminder is useful,
Russ
On 12/07/2017 07:12 PM, Chris Herrera wrote:
> Hi Eric,
>
> If its for the content viewer you might want to use mime.type.
> additionally you can use session.putAttribute(flowFile,
> “content-type”, "application/json”);
>
> Regards,
> Chris
>
>
> On Dec 7, 2017, 8:10 PM -0600, Eric Chaves <er...@uolet.com>, wrote:
>> Hi guys,
>>
>> I'm trying to programatically set the content-type of a flow-file by
>> calling flowFile.putAttribute('content-type', 'application/json') but
>> it's not working.
>>
>> How can I change my flow-file content-type?
>>
>> Regards,
>>
>> Eric
Re: How can I change the content-type of a flow file in a
script processor?
Posted by Chris Herrera <ch...@gmail.com>.
Hi Eric,
If its for the content viewer you might want to use mime.type. additionally you can use session.putAttribute(flowFile, “content-type”, "application/json”);
Regards,
Chris
On Dec 7, 2017, 8:10 PM -0600, Eric Chaves <er...@uolet.com>, wrote:
> Hi guys,
>
> I'm trying to programatically set the content-type of a flow-file by calling flowFile.putAttribute('content-type', 'application/json') but it's not working.
>
> How can I change my flow-file content-type?
>
> Regards,
>
> Eric