cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "芷樱~" <>
Subject Question about Interceptor setup
Date Thu, 01 Aug 2013 02:54:43 GMT
Dear CXF Support,
 I am trying to add a name-binding interceptor in JAX-RS 2.0, but the name binding does not
work, the interceptor operates as a global interceptor. I have writen a name binding filter
in the same way successfully. I am not sure what the problem is. 
 Could you please give me some advice? Thank you very much!!!
 I use apache-cxf-2.7.5,apache-tomcat-6.0.37, and Java 6.
 I setup namebinding in this way:
@Target({ ElementType.TYPE, ElementType.METHOD })
public @interface NamesBinding {
public class NameInterceptor implements WriterInterceptor{
 public void aroundWriteTo(WriterInterceptorContext arg0)
   throws IOException, WebApplicationException {
  arg0.getHeaders().add("MyInterceptorHeader", "From NameBinding Interceptor");
  arg0.setEntity("This is from Name Binding Example.");
public class Server {
 public String getAString(){
  return ".......";
 And in the Spring file, Bean.xml, I write the Interceptor as Provider:
 <jaxrs:server id="InterceptorServlet" address="/rest">
   <ref bean="InterceptorService" />
   <ref bean="GlobalInterceptor" />
   <ref bean="NameInterceptor" />
   <entry key="json" value="application/json" />
   <entry key="xml" value="application/xml" />
   <entry key="en" value="en-gb" />
 Thank you very much!
 Di Ma
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message