You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Andreas Sahlbach <an...@gmail.com> on 2009/11/05 19:17:30 UTC

REST CustomOutInterceptor.java actually working?

Hi!

I am trying to add an Interceptor to my REST service to add a custom header
field. I found in v.2.2.3 a systest called
apache-cxf-2.2.3/systests/src/test/java/org/apache/cxf/systest/jaxrs/CustomOutInterceptor.java.

I don't think that this systest is actually working, is it? My code is never
called. I don't think that an interceptor with Phase.MARSHAL is ever called
for a REST service.

Is this a planned feature or should it actually be working right now? 

Thanks for a short answer,

Andreas
-- 
View this message in context: http://old.nabble.com/REST-CustomOutInterceptor.java-actually-working--tp26216585p26216585.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: REST CustomOutInterceptor.java actually working?

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi,


>
> Thanks for the answer Sergey. I already found out my mistake. Just added my
> new interceptor to an existing interceptor and didn't noticed that it is an
> "inInterceptor" and not just "interceptor". And because of the Phase
> parameter it never came to my mind that there is a second list of
> interceptors.

I should've documented some examples showing how custom in/out or in/out fault CXF interceptors can be registered.

>
> I will check again tomorrow at work but I am sure it will work as expected.
> :-)

Hopefully it will :-)

>
> Thanks for the help!

you're welcome,

Sergey

>
>
> Sergey Beryozkin-2 wrote:
>>
>> Hi
>>
>> this interceptor is registered as an out interceptor in
>>
>> http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java
>>
>> and a number of tests in
>>
>> http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
>>
>> verify that a BookId header is available in the response
>>
>> How are you registering it ? By the way, another option is to register a
>> custom ResponseHandler and override a Response with a new
>> header being added
>>
>> cheers, Sergey
>>
>>>
>>> Hi!
>>>
>>> I am trying to add an Interceptor to my REST service to add a custom
>>> header
>>> field. I found in v.2.2.3 a systest called
>>> apache-cxf-2.2.3/systests/src/test/java/org/apache/cxf/systest/jaxrs/CustomOutInterceptor.java.
>>>
>>> I don't think that this systest is actually working, is it? My code is
>>> never
>>> called. I don't think that an interceptor with Phase.MARSHAL is ever
>>> called
>>> for a REST service.
>>>
>>> Is this a planned feature or should it actually be working right now?
>>>
>>> Thanks for a short answer,
>>>
>>> Andreas
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/REST-CustomOutInterceptor.java-actually-working--tp26216585p26216585.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> -- 
> View this message in context: http://old.nabble.com/REST-CustomOutInterceptor.java-actually-working--tp26216585p26220874.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 


Re: REST CustomOutInterceptor.java actually working?

Posted by Andreas Sahlbach <an...@gmail.com>.
Thanks for the answer Sergey. I already found out my mistake. Just added my
new interceptor to an existing interceptor and didn't noticed that it is an
"inInterceptor" and not just "interceptor". And because of the Phase
parameter it never came to my mind that there is a second list of
interceptors. 

I will check again tomorrow at work but I am sure it will work as expected.
:-)

Thanks for the help!


Sergey Beryozkin-2 wrote:
> 
> Hi
> 
> this interceptor is registered as an out interceptor in
> 
> http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java
> 
> and a number of tests in
> 
> http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
> 
> verify that a BookId header is available in the response
> 
> How are you registering it ? By the way, another option is to register a
> custom ResponseHandler and override a Response with a new 
> header being added
> 
> cheers, Sergey
> 
>>
>> Hi!
>>
>> I am trying to add an Interceptor to my REST service to add a custom
>> header
>> field. I found in v.2.2.3 a systest called
>> apache-cxf-2.2.3/systests/src/test/java/org/apache/cxf/systest/jaxrs/CustomOutInterceptor.java.
>>
>> I don't think that this systest is actually working, is it? My code is
>> never
>> called. I don't think that an interceptor with Phase.MARSHAL is ever
>> called
>> for a REST service.
>>
>> Is this a planned feature or should it actually be working right now?
>>
>> Thanks for a short answer,
>>
>> Andreas
>> -- 
>> View this message in context:
>> http://old.nabble.com/REST-CustomOutInterceptor.java-actually-working--tp26216585p26216585.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/REST-CustomOutInterceptor.java-actually-working--tp26216585p26220874.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: REST CustomOutInterceptor.java actually working?

Posted by Sergey Beryozkin <sb...@progress.com>.
Hi

this interceptor is registered as an out interceptor in

http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java

and a number of tests in

http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java

verify that a BookId header is available in the response

How are you registering it ? By the way, another option is to register a custom ResponseHandler and override a Response with a new 
header being added

cheers, Sergey

>
> Hi!
>
> I am trying to add an Interceptor to my REST service to add a custom header
> field. I found in v.2.2.3 a systest called
> apache-cxf-2.2.3/systests/src/test/java/org/apache/cxf/systest/jaxrs/CustomOutInterceptor.java.
>
> I don't think that this systest is actually working, is it? My code is never
> called. I don't think that an interceptor with Phase.MARSHAL is ever called
> for a REST service.
>
> Is this a planned feature or should it actually be working right now?
>
> Thanks for a short answer,
>
> Andreas
> -- 
> View this message in context: http://old.nabble.com/REST-CustomOutInterceptor.java-actually-working--tp26216585p26216585.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 


Re: REST CustomOutInterceptor.java actually working?

Posted by Andreas Sahlbach <an...@gmail.com>.
Ok, forget it. Sometimes it's good to stop working and take a rest for a
while. I injected the Interceptor into the wrong place (inInterceptors).
Couldn't work this way I guess :wistle:


Andreas Sahlbach wrote:
> 
> Hi!
> 
> I am trying to add an Interceptor to my REST service to add a custom
> header field. I found in v.2.2.3 a systest called
> apache-cxf-2.2.3/systests/src/test/java/org/apache/cxf/systest/jaxrs/CustomOutInterceptor.java.
> 
> I don't think that this systest is actually working, is it? My code is
> never called. I don't think that an interceptor with Phase.MARSHAL is ever
> called for a REST service.
> 
> Is this a planned feature or should it actually be working right now? 
> 
> Thanks for a short answer,
> 
> Andreas
> 

-- 
View this message in context: http://old.nabble.com/REST-CustomOutInterceptor.java-actually-working--tp26216585p26217791.html
Sent from the cxf-user mailing list archive at Nabble.com.