Re: How can I change the content-type of a flow file in a script processor?

2017-12-08 Thread Eric Chaves
Thanks guys.

2017-12-08 13:27 GMT-02:00 Russell Bateman :

> 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 
> , 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?

2017-12-08 Thread Russell Bateman

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