cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: name-binding validation across SOAP & REST
Date Thu, 27 Mar 2014 21:49:53 GMT
The following code in the interceptor will do:

BindingOperationInfo bop = m.getExchange().get(BindingOperationInfo.class);

        if (bop != null) {

            MethodDispatcher md = (MethodDispatcher)

 
m.getExchange().get(Service.class).get(MethodDispatcher.class.getName());

            return md.getMethod(bop);

        }

Cheers, Sergey
On 27/03/14 17:53, David Hay wrote:
> Ok, thanks.
>
> Is there a SOAP equivalent?
>
>
> On Thu, Mar 27, 2014 at 9:59 AM, Sergey Beryozkin <sberyozkin@gmail.com>wrote:
>
>> right I see,
>> I think you have to inject
>>
>> @Context ResourceInfo info;
>>
>> into the filter, this will give you the access to the matched Method from
>> where you can get the actual method-level annotations...
>>
>> Cheers, Sergey
>>
>>
>> On 27/03/14 13:51, David Hay wrote:
>>
>>> Actually, I'd like to pass a parameter in the annotation...which I could
>>> retrieve in the filter and use for that particular method.
>>>
>>> Something like:
>>>
>>> @Target({ ElementType.TYPE, ElementType.METHOD })
>>> @Retention(value = RetentionPolicy.RUNTIME)
>>> @NameBinding
>>> public @interface Authorize {
>>>       String somethingToCheck();
>>> }
>>>
>>> cheers
>>>
>>> David
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Thu, Mar 27, 2014 at 9:20 AM, Sergey Beryozkin <sberyozkin@gmail.com
>>>> wrote:
>>>
>>>   Hi
>>>>
>>>> On 27/03/14 13:10, David Hay wrote:
>>>>
>>>>   Hi Sergey,
>>>>>
>>>>> Ah, I saw it in the spec, but didn't realize it's not implemented.  I
>>>>> just
>>>>> saw a thread from Aug 2013 where you had an implementation on a branch?
>>>>>    It
>>>>> would be very useful...we have hundreds of methods...
>>>>>
>>>>>    I don't recall I was doing something around the method specific static
>>>>>
>>>> binding of CXF interceptors, but I agree it can make sense to do some
>>>> related enhancements, the only question is when, may be for 3.1 or
>>>> later...
>>>>
>>>>    Also, do you know if there is any way to pass a parameter in the filter
>>>>
>>>>> name binding?
>>>>>
>>>>>    You mean from ContainerRequestFilter to the application code ?
>>>>>
>>>> One way is to set a property on ContainerRequestContext and extract it
>>>> from the code using HttpServletRequest.getAttribute(), not cool, there's
>>>> an enhancement request to make it simpler.
>>>> Another option is may be to add a custom header to
>>>> ContainerRequestContext
>>>> and extract it as a header from the code, etc...
>>>>
>>>> Cheers. Sergey
>>>>
>>>>
>>>>    thanks!
>>>>
>>>>>
>>>>>
>>>>> On Thu, Mar 27, 2014 at 6:55 AM, Sergey Beryozkin <sberyozkin@gmail.com
>>>>>
>>>>>> wrote:
>>>>>>
>>>>>
>>>>>    Hi David,
>>>>>
>>>>>>
>>>>>> CXF does not have the support right now for statically binding CXF
>>>>>> interceptors to methods. I guess we can explore it going forward,
as
>>>>>> part
>>>>>> of the future CXF work.
>>>>>> For example, CXF has an @InInterceptors annotation - may we can support
>>>>>> binding it to individual methods, etc. May be we can have a CDI or
>>>>>> CDI-like
>>>>>> mechanism (as in JAX-RS 2.0) supported too.
>>>>>> At the moment the workaround is to have an interceptor checking for
the
>>>>>> Method, for example, check SimpleAuthorizingInterceptor in the core
>>>>>> package...
>>>>>>
>>>>>> HTH, Sergey
>>>>>>
>>>>>>
>>>>>> On 26/03/14 00:42, David Hay wrote:
>>>>>>
>>>>>>    Well, I didn't know that Interceptors can be applied using Name
>>>>>> Binding,
>>>>>>
>>>>>>> so
>>>>>>> I think I can just use that?
>>>>>>>
>>>>>>> However, I would really like to pass some data for each particular
>>>>>>> method
>>>>>>> that it's bound too (a list of things to check in each situation)
ie
>>>>>>> there
>>>>>>> would be a generic method that would take the things passed to
it for
>>>>>>> that
>>>>>>> method, and use them to check the call should be allowed.
>>>>>>>
>>>>>>> Any ideas on how I would accomplish that?
>>>>>>>
>>>>>>> thanks!
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Mar 25, 2014 at 2:54 PM, David Hay <david.hay@enstratius.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>     Hi,
>>>>>>>
>>>>>>>
>>>>>>>> I have set up some filters that extend ContainerRequestFilter
and are
>>>>>>>> name-bound to certain methods.
>>>>>>>>
>>>>>>>> I have a need to name-bind the same filter code across both
SOAP and
>>>>>>>> REST
>>>>>>>> methods...
>>>>>>>>
>>>>>>>> Is this possible?
>>>>>>>>
>>>>>>>> thanks!
>>>>>>>>
>>>>>>>> David
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>>
>


-- 
Sergey Beryozkin

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

Blog: http://sberyozkin.blogspot.com

Mime
View raw message