Hi Sergey,
Yes, that worked by upgrading, thx.
So I am able to get the path params from URIInfo in the
ContainerRequestFilter, but I am also passing a single non-path "command"
parameter that encapsulates all the other params (passed as JSON) and has a
validate() method added to it.
I need to call that validate() method in the ContainerRequestFilter, but
can't see a way to grab the object.
The method signature is similar to:
public Response doSomething(@PathParam("pathParam1")long pathParam1,
MyCmdObject myCmdObject)
Can you point me in the right direction, please, to access myCmdObject in
the filter?
cheers,
David
On Mon, Sep 30, 2013 at 12:15 PM, Sergey Beryozkin <[email protected]>wrote:
> On 30/09/13 15:17, David Hay wrote:
>
>> Voted.
>>
>> One more question - if I throw an exception from the
>> ContainerRequestFilter, is there any way to get my ExceptionHandler to
>> catch it?
>>
>> Do you mean JAX-RS ExceptionMapper ? Definitely has to work, in latest
> CXF 2.7.7 for sure
>
> Sergey
>
>>
>>
>>
>> On Sun, Sep 29, 2013 at 2:07 PM, Sergey Beryozkin <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> Sorry,
>>
>>
>> https://issues.apache.org/__**jira/browse/CXF-4199<https://issues.apache.org/__jira/browse/CXF-4199>
>>
>>
>> <https://issues.apache.org/**jira/browse/CXF-4199<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
>> <[email protected] <mailto:david.hay@enstratius.**
>> com <[email protected]>>
>> <mailto:david.hay@enstratius._**_com
>>
>>
>> <mailto:david.hay@enstratius.**com<[email protected]>>>>
>> 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
>>
>> <http://cxf.apache.org/**bindings/xformat<http://cxf.apache.org/bindings/xformat>
>> >"><ns1:__**faultstring
>>
>> xmlns:ns1="http://cxf.apache._**_org/bindings/xformat
>>
>> <http://cxf.apache.org/**bindings/xformat<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
>> <[email protected] <mailto:david.hay@enstratius.**
>> com <[email protected]>>
>> <mailto:david.hay@enstratius._**_com
>>
>>
>> <mailto:david.hay@enstratius.**com<[email protected]>>>>
>> 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
>> <[email protected]
>> <mailto:[email protected]>
>> <mailto:[email protected]
>>
>> <mailto:[email protected]>>**> 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
>>
>>
>>
>
>