On 6/7/2014 5:51 PM, Heiko W.Rupp wrote:
> Hey Bill,
> thanks for your reply.
> Am 07.06.2014 um 22:08 schrieb Bill Burke <bbu...@redhat.com>:
>> Unfortunately, the JAX-RS TCK expects that the MBW is not matched until
>> after the WriterInterceptor is invoked.   We used to match prior to
> What a c$%@!
>> invoking the interceptor chain...
> Which makes so much sense
>> So, you have 2 options:
>> 1. In your WriterInterceptor buffer the json marshalling, change the
>> content header, flush the buffer.
> I have this block in aroundWriteTo:
>              try {
>                  context.proceed();
>              } finally {
>                  context.getHeaders().get("Content-Type").clear();
> context.getHeaders().putSingle("Content-Type",APPLICATION_JAVASCRIPT);
>              }

> But that header change is not recorded in the output.
> And when I understand you correctly above, this would be an issue anyway,
> because the changed header would influence the MBW matcher which runs after 
> the interceptor.

Headers get flushed and can't be changed after the entity has been 
written to the stream.

Again, you'll have to buffer the entity and rewrite it to the actual 
stream after you've changed the content-type header.

Bill Burke
JBoss, a division of Red Hat

HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
Resteasy-users mailing list

Reply via email to