THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
The implementations can be registered like any other type of providers :
Code Block | ||||
---|---|---|---|---|
| ||||
<beans> <jaxrs:server id="customerService" address="/"> <jaxrs:serviceBeans> <bean class="org.CustomerService" /> </jaxrs:serviceBeans> <jaxrs:providers> <ref bean="authorizationFilter" /> </jaxrs:providers> <bean id="authorizationFilter" class="com.bar.providers.AuthorizationContainerRequestFilter"> <!-- authorization bean properties --> </bean> </jaxrs:server> </beans> |
Difference between JAXRS filters and CXF interceptors
...
Sometimes you may want to use CXF interceptors rather than writing JAXRS filters. For example, suppose you combine JAXWS and JAXRS and you need to log only inbound or outbound messages. You can reuse the existing CXF interceptors :
Code Block | ||||
---|---|---|---|---|
| ||||
<beans> <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/> <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/> <jaxrs:server> <jaxrs:inInterceptors> <ref bean="logInbound"/> </jaxrs:inInterceptors> <jaxrs:outInterceptors> <ref bean="logOutbound"/> </jaxrs:outInterceptors> </jaxrs:server> <jaxws:endpoint> <jaxws:inInterceptors> <ref bean="logInbound"/> </jaxws:inInterceptors> <jaxws:outInterceptors> <ref bean="logOutbound"/> </jaxws:outInterceptors> </jaxws:endpoint> </beans> |
...
Custom invokers can be registered like this :
Code Block | ||||
---|---|---|---|---|
| ||||
<beans> <jaxrs:server address="/"> <jaxrs:invoker> <bean class="org.apache.cxf.systest.jaxrs.CustomJAXRSInvoker"/> </jaxrs:invoker> </jaxrs:server> </beans> |