Skip to main content

[jsr339-experts] Example 4: Why ReadInterceptors are cool

  • From: Bill Burke <bburke@...>
  • To: "jsr339-experts@..." <jsr339-experts@...>
  • Subject: [jsr339-experts] Example 4: Why ReadInterceptors are cool
  • Date: Fri, 27 Apr 2012 12:21:11 -0400

This next example has to do with generically post processing a unmarshaled Java Object. We have a @LinkHeader annotation that allows use to inject a link into an unmarshalled entity.

public class Customer

   Link image;

   String name;



We implement this as a a ReaderInterceptor as there is no way to do it within a filter. This ReaderInterceptor is re-usable on the client and the server.

Well, you *could* do it on the server-side, but it would depend on whether or not a setEntity() method existed on server-side filter context. This doesn't change the fact that you couldn't do it on the client side and that a ReaderInterceptor wasn't a cleaner solution to implement the feature.

Bill Burke
JBoss, a division of Red Hat

[jsr339-experts] Example 4: Why ReadInterceptors are cool

Bill Burke 04/27/2012
Please Confirm