cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: Applying interceptor to only some methods
Date Sun, 29 Sep 2013 18:07:30 GMT
Sorry,

https://issues.apache.org/jira/browse/CXF-4199
On 29/09/13 19:06, Sergey Beryozkin wrote:
> Vote for this JIRA please...
> Sergey
> On 29/09/13 19:03, Sergey Beryozkin wrote:
>> Hi
>>
>> I've tried it on the trunk & CXF 2.7.8-SNAPSHOT, getPropertyNames does
>> not throw NPE and returns an initialized collection,
>>
>> Get UriInfo from the context and check path parameters from it.
>>
>> Re supporting @Provider - it is recognized, but no auto-discovery is
>> done - I'm hoping to spend some time on it, many providers do need to be
>> configured which the default auto-discovery would interfere with, but I
>> agree for some simple providers it can make sense...
>>
>> Sergey
>>
>> On 27/09/13 20:51, David Hay wrote:
>>> Hi again,
>>>
>>> It appears that 'props' is null.
>>>
>>> I'm trying to get hold of the path parameters.  What's the best way to
>>> do that?
>>>
>>>
>>> On Fri, Sep 27, 2013 at 3:32 PM, David Hay <david.hay@enstratius.com
>>> <mailto:david.hay@enstratius.com>> wrote:
>>>
>>>     Actually, I discovered that CXF doesn't support @Provider yet?
>>>
>>>     I went ahead and registered it in CXF, and in the filter tried to
>>> do:
>>>
>>>         Enumeration e = requestContext.getPropertyNames();
>>>
>>>     However, I get this:
>>>
>>>         <ns1:XMLFault
>>>     xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring
>>>
>>> xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.NullPointerException</ns1:faultstring></ns1:XMLFault>*
>>>
>>>
>>>
>>>     Thoughts?
>>>
>>>
>>>
>>>     On Fri, Sep 27, 2013 at 3:16 PM, David Hay <david.hay@enstratius.com
>>>     <mailto:david.hay@enstratius.com>> wrote:
>>>
>>>         Hi Sergey,
>>>
>>>         I added a ContainerRequestFilter with @Provider...but I don't
>>>         see it getting called at all.
>>>
>>>         What am I missing?
>>>
>>>
>>>         On Fri, Sep 6, 2013 at 4:51 AM, Sergey Beryozkin
>>>         <sberyozkin@gmail.com <mailto:sberyozkin@gmail.com>> wrote:
>>>
>>>             Hi
>>>
>>>             On 05/09/13 20:09, David Hay wrote:
>>>
>>>                 Hi,
>>>
>>>                 I have a group of RESTful endpoints that all require the
>>>                 same
>>>                 pre-validation (eg ensuring that the related domain
>>>                 object exists).
>>>
>>>                 Is it possibly to set up an interceptor that is somehow
>>>                 configured to
>>>                 perform such validation for a set of
>>> methods/classes/urls?
>>>
>>>                 If not, is there a suggested way to accomplish this?
>>>
>>>             Starting from CXF 2.7.x you can use JAX-RS 2.0 NameBinding
>>>             to attach ContainerRequestFilter to individual methods or
>>>             classes, and the filters can also check request URI and
>>>             ignore the validation if needed.
>>>
>>>             ContainerRequestFilter with a @PreMatch annotation can be
>>>             used to do the validation before the match has been done
>>>
>>>             Cheers, Sergey
>>>
>>>                 thanks!
>>>
>>>
>>>
>>>
>>>
>>
>>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Mime
View raw message