You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "J. Fiala" <mo...@fwd.at> on 2016/10/24 13:47:11 UTC
Automatic client-side beanvalidation?
Hi there,
Is automatic client-side beanvalidation supported somehow (currently
this is not mentioned in the docs)?
Maybe it would make sense to add this to the configuration, so this has
not to be done manually before calling the server?
Best regards,
Johannes
Re: Automatic client-side beanvalidation?
Posted by "J. Fiala" <mo...@fwd.at>.
Hi,
Yes exactly, this would be a "cheap" feature and would prevent the
server from unnecessary requests (as long client SDKs are in synch...).
Best regards,
Johannes
Am 24.10.2016 um 17:04 schrieb Sergey Beryozkin:
> Hi
>
> I guess it can be interesting to support an optional client side bean
> validation for the proxy clients as they have all the bean validation
> annotations available...
>
> Cheers, Sergey
> On 24/10/16 14:47, J. Fiala wrote:
>> Hi there,
>>
>> Is automatic client-side beanvalidation supported somehow (currently
>> this is not mentioned in the docs)?
>>
>> Maybe it would make sense to add this to the configuration, so this has
>> not to be done manually before calling the server?
>>
>> Best regards,
>> Johannes
>>
>
>
Re: Automatic client-side beanvalidation?
Posted by "J. Fiala" <mo...@fwd.at>.
Dear Sergey,
p.s. can you make the constants public for easy referencing?
Best regards,
Johannes
Am 14.11.2016 um 22:35 schrieb J. Fiala:
> Dear Sergey,
>
> Can you please also add the Object o (from public Object invoke(Object
> o, Method m, Object[] params) throws Throwable) as "method.object" CXF
> Message property at ClientProxyImpl.java?
>
> Then the interceptor works straightforward like this:
>
> public class ClientBeanValidationOutInterceptor extends
> AbstractPhaseInterceptor<Message> {
>
>
> public ClientBeanValidationOutInterceptor() {
> super(Phase.PRE_LOGICAL);
> }
>
> public ClientBeanValidationOutInterceptor(String phase) {
> super(phase);
> }
>
> @Override
> public void handleMessage(Message message) throws Fault {
>
> Object objectToRunOn = (Object) message.get("method.object");
> Object[] parameterValues = (Object[])
> message.get("method.parameters");
>
> OperationResourceInfo info =
> message.getContent(OperationResourceInfo.class);
>
> try {
> ValidatorFactory factory =
> Validation.buildDefaultValidatorFactory();
> ExecutableValidator executableValidator =
> factory.getValidator().forExecutables();
>
>
> Method method = info.getMethodToInvoke();
> Set<ConstraintViolation<Object>> violations =
> executableValidator
> .validateParameters(objectToRunOn, method,
> parameterValues);
>
> if (violations.size() > 0) {
> Set<ConstraintViolation<Object>> violationsObj =
> (Set<ConstraintViolation<Object>>) violations;
> throw new BeanValidationException(violationsObj);
> }
>
> } catch (SecurityException e) {
> e.printStackTrace();
> }
>
> }
> }
>
> Pls let me know if I should add a PR for this (on separate branch
> client_beanvalidation) or if you are going to add it yourself ...
>
> Thank you & Best regards,
> Johannes
>
>
> Am 14.11.2016 um 13:08 schrieb Sergey Beryozkin:
>> Hi
>>
>> I've updated ClientProxyImpl to pass them as a "method.parameters" CXF
>> Message property
>>
>> Thanks, Sergey.
>> On 13/11/16 19:49, J. Fiala wrote:
>>> Dear Sergey,
>>>
>>> To be more specific, at ClientProxyImpl.java the Object[] params are
>>> available, but they are not passed onto the interceptor chain:
>>>
>>> return doChainedInvocation(uri, headers, ori, body, bodyIndex, null,
>>> null);
>>>
>>> Is there a another way I can access the Object[] params in an
>>> interceptor?
>>>
>>> Or do I have to subclass ClientProxyImpl.java?
>>>
>>> Best regards,
>>> Johannes
>>>
>>>
>>> Am 13.11.2016 um 20:45 schrieb J. Fiala:
>>>> Dear Sergey,
>>>>
>>>> I tried to implement the BeanValidation for the client for outgoing
>>>> operations in an OutInterceptor.
>>>>
>>>> I need to be able to validate the parameters for the method:
>>>> Set<ConstraintViolation<Object>> violations =
>>>> executableValidator.validateParameters(this, method,
>>>> parameterValues);
>>>>
>>>> Getting access to the method is no problem using
>>>> OperationResourceInfo.class.
>>>>
>>>> How can I access the parameter values (Object[] parameterValues) of
>>>> the method that has been invoked so I can validate them?
>>>>
>>>> I can get easily access to the json objects if passed to the method,
>>>> but I need access to the original method invocation, before the
>>>> message has been assembled to query/path/body params etc.
>>>>
>>>> Best regards,
>>>> Johannes
>>>>
>>>>
>>>> Am 24.10.2016 um 17:04 schrieb Sergey Beryozkin:
>>>>> Hi
>>>>>
>>>>> I guess it can be interesting to support an optional client side bean
>>>>> validation for the proxy clients as they have all the bean validation
>>>>> annotations available...
>>>>>
>>>>> Cheers, Sergey
>>>>> On 24/10/16 14:47, J. Fiala wrote:
>>>>>> Hi there,
>>>>>>
>>>>>> Is automatic client-side beanvalidation supported somehow (currently
>>>>>> this is not mentioned in the docs)?
>>>>>>
>>>>>> Maybe it would make sense to add this to the configuration, so
>>>>>> this has
>>>>>> not to be done manually before calling the server?
>>>>>>
>>>>>> Best regards,
>>>>>> Johannes
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>
Re: Automatic client-side beanvalidation?
Posted by "J. Fiala" <mo...@fwd.at>.
Hi Sergey,
Great, thank you! It would be interesting also to have an integration
test for the BeanValidationInterceptor. Of course we can also have a
simple junit-test with the beanvalidation annotations already there in
the service interface :), but I think integration tests could be worth
considering (Swagger-Codegen does this for every language generated).
Best regards,
Johannes
Am 18.11.2016 um 20:53 schrieb Sergey Beryozkin:
> Hi Johannes
>
> It was nice to meet you too and thanks for supporting our talk.
>
> As I promised to you before a talk I'll commit to adding the
> validation interceptor.
>
> However lets keep the whole wadl-to-java, Swagger, BeanValidation for
> a separate conversation. We've already had 2 iterations so far :-) but
> I'm ready for another one if you'd like.
>
> Many thanks
> Sergey
> On 18/11/16 18:57, J. Fiala wrote:
>> Hi Sergey,
>>
>> It was nice to meet you @ApacheCon, I lost you somehow after we talked!
>> pls let me know if I should provide a PR on this or if you want to
>> finish this yourself?
>> If I should do the PR can you give me a hint where I should
>> add/implement a test for this? In fact to test it we'd need a
>> client-module with wadl2java + jaxb-krasa-tools (to have at least
>> BeanValidation annotations for the Request/Response). Pls let me know if
>> I should add a separate module for this?
>>
>> Best regards,
>> Johannes
>>
>>
>> Am 15.11.2016 um 17:38 schrieb Sergey Beryozkin:
>>> Hi Johannes
>>>
>>> Sorry, was under a time pressure on Mon eve,
>>>
>>> Is Object really required to enable the validation of the method ?
>>> Sorry, I know the individual (entity) bean can be easily validated but
>>> not sure if providing the object in this case is a must
>>>
>>> Thanks, Sergey
>>> On 14/11/16 22:11, Sergey Beryozkin wrote:
>>>> I'll add a CXF Message property when I will start applying your
>>>> patch -
>>>> please open a CXF JIRA when you are ready.
>>>>
>>>> Please also work with the CXF BeanValidationProvider utility code
>>>> which
>>>> initializes the factory and add more utility code to it if needed for
>>>> validating the individual parameters, it def has a method for
>>>> validating
>>>> the entity only, .validateBean().
>>>>
>>>> Sergey
>>>>
>>>>
>>>> On 14/11/16 21:52, Sergey Beryozkin wrote:
>>>>> This Object is a proxy.
>>>>>
>>>>> Please focus on validating the request parameters only. And simply
>>>>> create a local final var with the same property
>>>>>
>>>>> Sergey
>>>>>
>>>>> On 14/11/16 21:35, J. Fiala wrote:
>>>>>> Dear Sergey,
>>>>>>
>>>>>> Can you please also add the Object o (from public Object
>>>>>> invoke(Object
>>>>>> o, Method m, Object[] params) throws Throwable) as
>>>>>> "method.object" CXF
>>>>>> Message property at ClientProxyImpl.java?
>>>>>>
>>>>>> Then the interceptor works straightforward like this:
>>>>>>
>>>>>> public class ClientBeanValidationOutInterceptor extends
>>>>>> AbstractPhaseInterceptor<Message> {
>>>>>>
>>>>>>
>>>>>> public ClientBeanValidationOutInterceptor() {
>>>>>> super(Phase.PRE_LOGICAL);
>>>>>> }
>>>>>>
>>>>>> public ClientBeanValidationOutInterceptor(String phase) {
>>>>>> super(phase);
>>>>>> }
>>>>>>
>>>>>> @Override
>>>>>> public void handleMessage(Message message) throws Fault {
>>>>>>
>>>>>> Object objectToRunOn = (Object)
>>>>>> message.get("method.object");
>>>>>> Object[] parameterValues = (Object[])
>>>>>> message.get("method.parameters");
>>>>>>
>>>>>> OperationResourceInfo info =
>>>>>> message.getContent(OperationResourceInfo.class);
>>>>>>
>>>>>> try {
>>>>>> ValidatorFactory factory =
>>>>>> Validation.buildDefaultValidatorFactory();
>>>>>> ExecutableValidator executableValidator =
>>>>>> factory.getValidator().forExecutables();
>>>>>>
>>>>>>
>>>>>> Method method = info.getMethodToInvoke();
>>>>>> Set<ConstraintViolation<Object>> violations =
>>>>>> executableValidator
>>>>>> .validateParameters(objectToRunOn, method,
>>>>>> parameterValues);
>>>>>>
>>>>>> if (violations.size() > 0) {
>>>>>> Set<ConstraintViolation<Object>> violationsObj =
>>>>>> (Set<ConstraintViolation<Object>>) violations;
>>>>>> throw new BeanValidationException(violationsObj);
>>>>>> }
>>>>>>
>>>>>> } catch (SecurityException e) {
>>>>>> e.printStackTrace();
>>>>>> }
>>>>>>
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> Pls let me know if I should add a PR for this (on separate branch
>>>>>> client_beanvalidation) or if you are going to add it yourself ...
>>>>>>
>>>>>> Thank you & Best regards,
>>>>>> Johannes
>>>>>>
>>>>>>
>>>>>> Am 14.11.2016 um 13:08 schrieb Sergey Beryozkin:
>>>>>>> Hi
>>>>>>>
>>>>>>> I've updated ClientProxyImpl to pass them as a "method.parameters"
>>>>>>> CXF
>>>>>>> Message property
>>>>>>>
>>>>>>> Thanks, Sergey.
>>>>>>> On 13/11/16 19:49, J. Fiala wrote:
>>>>>>>> Dear Sergey,
>>>>>>>>
>>>>>>>> To be more specific, at ClientProxyImpl.java the Object[]
>>>>>>>> params are
>>>>>>>> available, but they are not passed onto the interceptor chain:
>>>>>>>>
>>>>>>>> return doChainedInvocation(uri, headers, ori, body, bodyIndex,
>>>>>>>> null,
>>>>>>>> null);
>>>>>>>>
>>>>>>>> Is there a another way I can access the Object[] params in an
>>>>>>>> interceptor?
>>>>>>>>
>>>>>>>> Or do I have to subclass ClientProxyImpl.java?
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Johannes
>>>>>>>>
>>>>>>>>
>>>>>>>> Am 13.11.2016 um 20:45 schrieb J. Fiala:
>>>>>>>>> Dear Sergey,
>>>>>>>>>
>>>>>>>>> I tried to implement the BeanValidation for the client for
>>>>>>>>> outgoing
>>>>>>>>> operations in an OutInterceptor.
>>>>>>>>>
>>>>>>>>> I need to be able to validate the parameters for the method:
>>>>>>>>> Set<ConstraintViolation<Object>> violations =
>>>>>>>>> executableValidator.validateParameters(this, method,
>>>>>>>>> parameterValues);
>>>>>>>>>
>>>>>>>>> Getting access to the method is no problem using
>>>>>>>>> OperationResourceInfo.class.
>>>>>>>>>
>>>>>>>>> How can I access the parameter values (Object[]
>>>>>>>>> parameterValues) of
>>>>>>>>> the method that has been invoked so I can validate them?
>>>>>>>>>
>>>>>>>>> I can get easily access to the json objects if passed to the
>>>>>>>>> method,
>>>>>>>>> but I need access to the original method invocation, before the
>>>>>>>>> message has been assembled to query/path/body params etc.
>>>>>>>>>
>>>>>>>>> Best regards,
>>>>>>>>> Johannes
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Am 24.10.2016 um 17:04 schrieb Sergey Beryozkin:
>>>>>>>>>> Hi
>>>>>>>>>>
>>>>>>>>>> I guess it can be interesting to support an optional client side
>>>>>>>>>> bean
>>>>>>>>>> validation for the proxy clients as they have all the bean
>>>>>>>>>> validation
>>>>>>>>>> annotations available...
>>>>>>>>>>
>>>>>>>>>> Cheers, Sergey
>>>>>>>>>> On 24/10/16 14:47, J. Fiala wrote:
>>>>>>>>>>> Hi there,
>>>>>>>>>>>
>>>>>>>>>>> Is automatic client-side beanvalidation supported somehow
>>>>>>>>>>> (currently
>>>>>>>>>>> this is not mentioned in the docs)?
>>>>>>>>>>>
>>>>>>>>>>> Maybe it would make sense to add this to the configuration, so
>>>>>>>>>>> this has
>>>>>>>>>>> not to be done manually before calling the server?
>>>>>>>>>>>
>>>>>>>>>>> Best regards,
>>>>>>>>>>> Johannes
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>
>
Re: Automatic client-side beanvalidation?
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Johannes
It was nice to meet you too and thanks for supporting our talk.
As I promised to you before a talk I'll commit to adding the validation
interceptor.
However lets keep the whole wadl-to-java, Swagger, BeanValidation for a
separate conversation. We've already had 2 iterations so far :-) but I'm
ready for another one if you'd like.
Many thanks
Sergey
On 18/11/16 18:57, J. Fiala wrote:
> Hi Sergey,
>
> It was nice to meet you @ApacheCon, I lost you somehow after we talked!
> pls let me know if I should provide a PR on this or if you want to
> finish this yourself?
> If I should do the PR can you give me a hint where I should
> add/implement a test for this? In fact to test it we'd need a
> client-module with wadl2java + jaxb-krasa-tools (to have at least
> BeanValidation annotations for the Request/Response). Pls let me know if
> I should add a separate module for this?
>
> Best regards,
> Johannes
>
>
> Am 15.11.2016 um 17:38 schrieb Sergey Beryozkin:
>> Hi Johannes
>>
>> Sorry, was under a time pressure on Mon eve,
>>
>> Is Object really required to enable the validation of the method ?
>> Sorry, I know the individual (entity) bean can be easily validated but
>> not sure if providing the object in this case is a must
>>
>> Thanks, Sergey
>> On 14/11/16 22:11, Sergey Beryozkin wrote:
>>> I'll add a CXF Message property when I will start applying your patch -
>>> please open a CXF JIRA when you are ready.
>>>
>>> Please also work with the CXF BeanValidationProvider utility code which
>>> initializes the factory and add more utility code to it if needed for
>>> validating the individual parameters, it def has a method for validating
>>> the entity only, .validateBean().
>>>
>>> Sergey
>>>
>>>
>>> On 14/11/16 21:52, Sergey Beryozkin wrote:
>>>> This Object is a proxy.
>>>>
>>>> Please focus on validating the request parameters only. And simply
>>>> create a local final var with the same property
>>>>
>>>> Sergey
>>>>
>>>> On 14/11/16 21:35, J. Fiala wrote:
>>>>> Dear Sergey,
>>>>>
>>>>> Can you please also add the Object o (from public Object invoke(Object
>>>>> o, Method m, Object[] params) throws Throwable) as "method.object" CXF
>>>>> Message property at ClientProxyImpl.java?
>>>>>
>>>>> Then the interceptor works straightforward like this:
>>>>>
>>>>> public class ClientBeanValidationOutInterceptor extends
>>>>> AbstractPhaseInterceptor<Message> {
>>>>>
>>>>>
>>>>> public ClientBeanValidationOutInterceptor() {
>>>>> super(Phase.PRE_LOGICAL);
>>>>> }
>>>>>
>>>>> public ClientBeanValidationOutInterceptor(String phase) {
>>>>> super(phase);
>>>>> }
>>>>>
>>>>> @Override
>>>>> public void handleMessage(Message message) throws Fault {
>>>>>
>>>>> Object objectToRunOn = (Object) message.get("method.object");
>>>>> Object[] parameterValues = (Object[])
>>>>> message.get("method.parameters");
>>>>>
>>>>> OperationResourceInfo info =
>>>>> message.getContent(OperationResourceInfo.class);
>>>>>
>>>>> try {
>>>>> ValidatorFactory factory =
>>>>> Validation.buildDefaultValidatorFactory();
>>>>> ExecutableValidator executableValidator =
>>>>> factory.getValidator().forExecutables();
>>>>>
>>>>>
>>>>> Method method = info.getMethodToInvoke();
>>>>> Set<ConstraintViolation<Object>> violations =
>>>>> executableValidator
>>>>> .validateParameters(objectToRunOn, method,
>>>>> parameterValues);
>>>>>
>>>>> if (violations.size() > 0) {
>>>>> Set<ConstraintViolation<Object>> violationsObj =
>>>>> (Set<ConstraintViolation<Object>>) violations;
>>>>> throw new BeanValidationException(violationsObj);
>>>>> }
>>>>>
>>>>> } catch (SecurityException e) {
>>>>> e.printStackTrace();
>>>>> }
>>>>>
>>>>> }
>>>>> }
>>>>>
>>>>> Pls let me know if I should add a PR for this (on separate branch
>>>>> client_beanvalidation) or if you are going to add it yourself ...
>>>>>
>>>>> Thank you & Best regards,
>>>>> Johannes
>>>>>
>>>>>
>>>>> Am 14.11.2016 um 13:08 schrieb Sergey Beryozkin:
>>>>>> Hi
>>>>>>
>>>>>> I've updated ClientProxyImpl to pass them as a "method.parameters"
>>>>>> CXF
>>>>>> Message property
>>>>>>
>>>>>> Thanks, Sergey.
>>>>>> On 13/11/16 19:49, J. Fiala wrote:
>>>>>>> Dear Sergey,
>>>>>>>
>>>>>>> To be more specific, at ClientProxyImpl.java the Object[] params are
>>>>>>> available, but they are not passed onto the interceptor chain:
>>>>>>>
>>>>>>> return doChainedInvocation(uri, headers, ori, body, bodyIndex, null,
>>>>>>> null);
>>>>>>>
>>>>>>> Is there a another way I can access the Object[] params in an
>>>>>>> interceptor?
>>>>>>>
>>>>>>> Or do I have to subclass ClientProxyImpl.java?
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Johannes
>>>>>>>
>>>>>>>
>>>>>>> Am 13.11.2016 um 20:45 schrieb J. Fiala:
>>>>>>>> Dear Sergey,
>>>>>>>>
>>>>>>>> I tried to implement the BeanValidation for the client for outgoing
>>>>>>>> operations in an OutInterceptor.
>>>>>>>>
>>>>>>>> I need to be able to validate the parameters for the method:
>>>>>>>> Set<ConstraintViolation<Object>> violations =
>>>>>>>> executableValidator.validateParameters(this, method,
>>>>>>>> parameterValues);
>>>>>>>>
>>>>>>>> Getting access to the method is no problem using
>>>>>>>> OperationResourceInfo.class.
>>>>>>>>
>>>>>>>> How can I access the parameter values (Object[] parameterValues) of
>>>>>>>> the method that has been invoked so I can validate them?
>>>>>>>>
>>>>>>>> I can get easily access to the json objects if passed to the
>>>>>>>> method,
>>>>>>>> but I need access to the original method invocation, before the
>>>>>>>> message has been assembled to query/path/body params etc.
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Johannes
>>>>>>>>
>>>>>>>>
>>>>>>>> Am 24.10.2016 um 17:04 schrieb Sergey Beryozkin:
>>>>>>>>> Hi
>>>>>>>>>
>>>>>>>>> I guess it can be interesting to support an optional client side
>>>>>>>>> bean
>>>>>>>>> validation for the proxy clients as they have all the bean
>>>>>>>>> validation
>>>>>>>>> annotations available...
>>>>>>>>>
>>>>>>>>> Cheers, Sergey
>>>>>>>>> On 24/10/16 14:47, J. Fiala wrote:
>>>>>>>>>> Hi there,
>>>>>>>>>>
>>>>>>>>>> Is automatic client-side beanvalidation supported somehow
>>>>>>>>>> (currently
>>>>>>>>>> this is not mentioned in the docs)?
>>>>>>>>>>
>>>>>>>>>> Maybe it would make sense to add this to the configuration, so
>>>>>>>>>> this has
>>>>>>>>>> not to be done manually before calling the server?
>>>>>>>>>>
>>>>>>>>>> Best regards,
>>>>>>>>>> Johannes
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
Re: Automatic client-side beanvalidation?
Posted by "J. Fiala" <mo...@fwd.at>.
Hi Sergey,
It was nice to meet you @ApacheCon, I lost you somehow after we talked!
pls let me know if I should provide a PR on this or if you want to
finish this yourself?
If I should do the PR can you give me a hint where I should
add/implement a test for this? In fact to test it we'd need a
client-module with wadl2java + jaxb-krasa-tools (to have at least
BeanValidation annotations for the Request/Response). Pls let me know if
I should add a separate module for this?
Best regards,
Johannes
Am 15.11.2016 um 17:38 schrieb Sergey Beryozkin:
> Hi Johannes
>
> Sorry, was under a time pressure on Mon eve,
>
> Is Object really required to enable the validation of the method ?
> Sorry, I know the individual (entity) bean can be easily validated but
> not sure if providing the object in this case is a must
>
> Thanks, Sergey
> On 14/11/16 22:11, Sergey Beryozkin wrote:
>> I'll add a CXF Message property when I will start applying your patch -
>> please open a CXF JIRA when you are ready.
>>
>> Please also work with the CXF BeanValidationProvider utility code which
>> initializes the factory and add more utility code to it if needed for
>> validating the individual parameters, it def has a method for validating
>> the entity only, .validateBean().
>>
>> Sergey
>>
>>
>> On 14/11/16 21:52, Sergey Beryozkin wrote:
>>> This Object is a proxy.
>>>
>>> Please focus on validating the request parameters only. And simply
>>> create a local final var with the same property
>>>
>>> Sergey
>>>
>>> On 14/11/16 21:35, J. Fiala wrote:
>>>> Dear Sergey,
>>>>
>>>> Can you please also add the Object o (from public Object invoke(Object
>>>> o, Method m, Object[] params) throws Throwable) as "method.object" CXF
>>>> Message property at ClientProxyImpl.java?
>>>>
>>>> Then the interceptor works straightforward like this:
>>>>
>>>> public class ClientBeanValidationOutInterceptor extends
>>>> AbstractPhaseInterceptor<Message> {
>>>>
>>>>
>>>> public ClientBeanValidationOutInterceptor() {
>>>> super(Phase.PRE_LOGICAL);
>>>> }
>>>>
>>>> public ClientBeanValidationOutInterceptor(String phase) {
>>>> super(phase);
>>>> }
>>>>
>>>> @Override
>>>> public void handleMessage(Message message) throws Fault {
>>>>
>>>> Object objectToRunOn = (Object) message.get("method.object");
>>>> Object[] parameterValues = (Object[])
>>>> message.get("method.parameters");
>>>>
>>>> OperationResourceInfo info =
>>>> message.getContent(OperationResourceInfo.class);
>>>>
>>>> try {
>>>> ValidatorFactory factory =
>>>> Validation.buildDefaultValidatorFactory();
>>>> ExecutableValidator executableValidator =
>>>> factory.getValidator().forExecutables();
>>>>
>>>>
>>>> Method method = info.getMethodToInvoke();
>>>> Set<ConstraintViolation<Object>> violations =
>>>> executableValidator
>>>> .validateParameters(objectToRunOn, method,
>>>> parameterValues);
>>>>
>>>> if (violations.size() > 0) {
>>>> Set<ConstraintViolation<Object>> violationsObj =
>>>> (Set<ConstraintViolation<Object>>) violations;
>>>> throw new BeanValidationException(violationsObj);
>>>> }
>>>>
>>>> } catch (SecurityException e) {
>>>> e.printStackTrace();
>>>> }
>>>>
>>>> }
>>>> }
>>>>
>>>> Pls let me know if I should add a PR for this (on separate branch
>>>> client_beanvalidation) or if you are going to add it yourself ...
>>>>
>>>> Thank you & Best regards,
>>>> Johannes
>>>>
>>>>
>>>> Am 14.11.2016 um 13:08 schrieb Sergey Beryozkin:
>>>>> Hi
>>>>>
>>>>> I've updated ClientProxyImpl to pass them as a "method.parameters"
>>>>> CXF
>>>>> Message property
>>>>>
>>>>> Thanks, Sergey.
>>>>> On 13/11/16 19:49, J. Fiala wrote:
>>>>>> Dear Sergey,
>>>>>>
>>>>>> To be more specific, at ClientProxyImpl.java the Object[] params are
>>>>>> available, but they are not passed onto the interceptor chain:
>>>>>>
>>>>>> return doChainedInvocation(uri, headers, ori, body, bodyIndex, null,
>>>>>> null);
>>>>>>
>>>>>> Is there a another way I can access the Object[] params in an
>>>>>> interceptor?
>>>>>>
>>>>>> Or do I have to subclass ClientProxyImpl.java?
>>>>>>
>>>>>> Best regards,
>>>>>> Johannes
>>>>>>
>>>>>>
>>>>>> Am 13.11.2016 um 20:45 schrieb J. Fiala:
>>>>>>> Dear Sergey,
>>>>>>>
>>>>>>> I tried to implement the BeanValidation for the client for outgoing
>>>>>>> operations in an OutInterceptor.
>>>>>>>
>>>>>>> I need to be able to validate the parameters for the method:
>>>>>>> Set<ConstraintViolation<Object>> violations =
>>>>>>> executableValidator.validateParameters(this, method,
>>>>>>> parameterValues);
>>>>>>>
>>>>>>> Getting access to the method is no problem using
>>>>>>> OperationResourceInfo.class.
>>>>>>>
>>>>>>> How can I access the parameter values (Object[] parameterValues) of
>>>>>>> the method that has been invoked so I can validate them?
>>>>>>>
>>>>>>> I can get easily access to the json objects if passed to the
>>>>>>> method,
>>>>>>> but I need access to the original method invocation, before the
>>>>>>> message has been assembled to query/path/body params etc.
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Johannes
>>>>>>>
>>>>>>>
>>>>>>> Am 24.10.2016 um 17:04 schrieb Sergey Beryozkin:
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> I guess it can be interesting to support an optional client side
>>>>>>>> bean
>>>>>>>> validation for the proxy clients as they have all the bean
>>>>>>>> validation
>>>>>>>> annotations available...
>>>>>>>>
>>>>>>>> Cheers, Sergey
>>>>>>>> On 24/10/16 14:47, J. Fiala wrote:
>>>>>>>>> Hi there,
>>>>>>>>>
>>>>>>>>> Is automatic client-side beanvalidation supported somehow
>>>>>>>>> (currently
>>>>>>>>> this is not mentioned in the docs)?
>>>>>>>>>
>>>>>>>>> Maybe it would make sense to add this to the configuration, so
>>>>>>>>> this has
>>>>>>>>> not to be done manually before calling the server?
>>>>>>>>>
>>>>>>>>> Best regards,
>>>>>>>>> Johannes
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>
>
>
Re: Automatic client-side beanvalidation?
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Johannes
Sorry, was under a time pressure on Mon eve,
Is Object really required to enable the validation of the method ?
Sorry, I know the individual (entity) bean can be easily validated but
not sure if providing the object in this case is a must
Thanks, Sergey
On 14/11/16 22:11, Sergey Beryozkin wrote:
> I'll add a CXF Message property when I will start applying your patch -
> please open a CXF JIRA when you are ready.
>
> Please also work with the CXF BeanValidationProvider utility code which
> initializes the factory and add more utility code to it if needed for
> validating the individual parameters, it def has a method for validating
> the entity only, .validateBean().
>
> Sergey
>
>
> On 14/11/16 21:52, Sergey Beryozkin wrote:
>> This Object is a proxy.
>>
>> Please focus on validating the request parameters only. And simply
>> create a local final var with the same property
>>
>> Sergey
>>
>> On 14/11/16 21:35, J. Fiala wrote:
>>> Dear Sergey,
>>>
>>> Can you please also add the Object o (from public Object invoke(Object
>>> o, Method m, Object[] params) throws Throwable) as "method.object" CXF
>>> Message property at ClientProxyImpl.java?
>>>
>>> Then the interceptor works straightforward like this:
>>>
>>> public class ClientBeanValidationOutInterceptor extends
>>> AbstractPhaseInterceptor<Message> {
>>>
>>>
>>> public ClientBeanValidationOutInterceptor() {
>>> super(Phase.PRE_LOGICAL);
>>> }
>>>
>>> public ClientBeanValidationOutInterceptor(String phase) {
>>> super(phase);
>>> }
>>>
>>> @Override
>>> public void handleMessage(Message message) throws Fault {
>>>
>>> Object objectToRunOn = (Object) message.get("method.object");
>>> Object[] parameterValues = (Object[])
>>> message.get("method.parameters");
>>>
>>> OperationResourceInfo info =
>>> message.getContent(OperationResourceInfo.class);
>>>
>>> try {
>>> ValidatorFactory factory =
>>> Validation.buildDefaultValidatorFactory();
>>> ExecutableValidator executableValidator =
>>> factory.getValidator().forExecutables();
>>>
>>>
>>> Method method = info.getMethodToInvoke();
>>> Set<ConstraintViolation<Object>> violations =
>>> executableValidator
>>> .validateParameters(objectToRunOn, method,
>>> parameterValues);
>>>
>>> if (violations.size() > 0) {
>>> Set<ConstraintViolation<Object>> violationsObj =
>>> (Set<ConstraintViolation<Object>>) violations;
>>> throw new BeanValidationException(violationsObj);
>>> }
>>>
>>> } catch (SecurityException e) {
>>> e.printStackTrace();
>>> }
>>>
>>> }
>>> }
>>>
>>> Pls let me know if I should add a PR for this (on separate branch
>>> client_beanvalidation) or if you are going to add it yourself ...
>>>
>>> Thank you & Best regards,
>>> Johannes
>>>
>>>
>>> Am 14.11.2016 um 13:08 schrieb Sergey Beryozkin:
>>>> Hi
>>>>
>>>> I've updated ClientProxyImpl to pass them as a "method.parameters" CXF
>>>> Message property
>>>>
>>>> Thanks, Sergey.
>>>> On 13/11/16 19:49, J. Fiala wrote:
>>>>> Dear Sergey,
>>>>>
>>>>> To be more specific, at ClientProxyImpl.java the Object[] params are
>>>>> available, but they are not passed onto the interceptor chain:
>>>>>
>>>>> return doChainedInvocation(uri, headers, ori, body, bodyIndex, null,
>>>>> null);
>>>>>
>>>>> Is there a another way I can access the Object[] params in an
>>>>> interceptor?
>>>>>
>>>>> Or do I have to subclass ClientProxyImpl.java?
>>>>>
>>>>> Best regards,
>>>>> Johannes
>>>>>
>>>>>
>>>>> Am 13.11.2016 um 20:45 schrieb J. Fiala:
>>>>>> Dear Sergey,
>>>>>>
>>>>>> I tried to implement the BeanValidation for the client for outgoing
>>>>>> operations in an OutInterceptor.
>>>>>>
>>>>>> I need to be able to validate the parameters for the method:
>>>>>> Set<ConstraintViolation<Object>> violations =
>>>>>> executableValidator.validateParameters(this, method,
>>>>>> parameterValues);
>>>>>>
>>>>>> Getting access to the method is no problem using
>>>>>> OperationResourceInfo.class.
>>>>>>
>>>>>> How can I access the parameter values (Object[] parameterValues) of
>>>>>> the method that has been invoked so I can validate them?
>>>>>>
>>>>>> I can get easily access to the json objects if passed to the method,
>>>>>> but I need access to the original method invocation, before the
>>>>>> message has been assembled to query/path/body params etc.
>>>>>>
>>>>>> Best regards,
>>>>>> Johannes
>>>>>>
>>>>>>
>>>>>> Am 24.10.2016 um 17:04 schrieb Sergey Beryozkin:
>>>>>>> Hi
>>>>>>>
>>>>>>> I guess it can be interesting to support an optional client side
>>>>>>> bean
>>>>>>> validation for the proxy clients as they have all the bean
>>>>>>> validation
>>>>>>> annotations available...
>>>>>>>
>>>>>>> Cheers, Sergey
>>>>>>> On 24/10/16 14:47, J. Fiala wrote:
>>>>>>>> Hi there,
>>>>>>>>
>>>>>>>> Is automatic client-side beanvalidation supported somehow
>>>>>>>> (currently
>>>>>>>> this is not mentioned in the docs)?
>>>>>>>>
>>>>>>>> Maybe it would make sense to add this to the configuration, so
>>>>>>>> this has
>>>>>>>> not to be done manually before calling the server?
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Johannes
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Automatic client-side beanvalidation?
Posted by Sergey Beryozkin <sb...@gmail.com>.
I'll add a CXF Message property when I will start applying your patch -
please open a CXF JIRA when you are ready.
Please also work with the CXF BeanValidationProvider utility code which
initializes the factory and add more utility code to it if needed for
validating the individual parameters, it def has a method for validating
the entity only, .validateBean().
Sergey
On 14/11/16 21:52, Sergey Beryozkin wrote:
> This Object is a proxy.
>
> Please focus on validating the request parameters only. And simply
> create a local final var with the same property
>
> Sergey
>
> On 14/11/16 21:35, J. Fiala wrote:
>> Dear Sergey,
>>
>> Can you please also add the Object o (from public Object invoke(Object
>> o, Method m, Object[] params) throws Throwable) as "method.object" CXF
>> Message property at ClientProxyImpl.java?
>>
>> Then the interceptor works straightforward like this:
>>
>> public class ClientBeanValidationOutInterceptor extends
>> AbstractPhaseInterceptor<Message> {
>>
>>
>> public ClientBeanValidationOutInterceptor() {
>> super(Phase.PRE_LOGICAL);
>> }
>>
>> public ClientBeanValidationOutInterceptor(String phase) {
>> super(phase);
>> }
>>
>> @Override
>> public void handleMessage(Message message) throws Fault {
>>
>> Object objectToRunOn = (Object) message.get("method.object");
>> Object[] parameterValues = (Object[])
>> message.get("method.parameters");
>>
>> OperationResourceInfo info =
>> message.getContent(OperationResourceInfo.class);
>>
>> try {
>> ValidatorFactory factory =
>> Validation.buildDefaultValidatorFactory();
>> ExecutableValidator executableValidator =
>> factory.getValidator().forExecutables();
>>
>>
>> Method method = info.getMethodToInvoke();
>> Set<ConstraintViolation<Object>> violations =
>> executableValidator
>> .validateParameters(objectToRunOn, method,
>> parameterValues);
>>
>> if (violations.size() > 0) {
>> Set<ConstraintViolation<Object>> violationsObj =
>> (Set<ConstraintViolation<Object>>) violations;
>> throw new BeanValidationException(violationsObj);
>> }
>>
>> } catch (SecurityException e) {
>> e.printStackTrace();
>> }
>>
>> }
>> }
>>
>> Pls let me know if I should add a PR for this (on separate branch
>> client_beanvalidation) or if you are going to add it yourself ...
>>
>> Thank you & Best regards,
>> Johannes
>>
>>
>> Am 14.11.2016 um 13:08 schrieb Sergey Beryozkin:
>>> Hi
>>>
>>> I've updated ClientProxyImpl to pass them as a "method.parameters" CXF
>>> Message property
>>>
>>> Thanks, Sergey.
>>> On 13/11/16 19:49, J. Fiala wrote:
>>>> Dear Sergey,
>>>>
>>>> To be more specific, at ClientProxyImpl.java the Object[] params are
>>>> available, but they are not passed onto the interceptor chain:
>>>>
>>>> return doChainedInvocation(uri, headers, ori, body, bodyIndex, null,
>>>> null);
>>>>
>>>> Is there a another way I can access the Object[] params in an
>>>> interceptor?
>>>>
>>>> Or do I have to subclass ClientProxyImpl.java?
>>>>
>>>> Best regards,
>>>> Johannes
>>>>
>>>>
>>>> Am 13.11.2016 um 20:45 schrieb J. Fiala:
>>>>> Dear Sergey,
>>>>>
>>>>> I tried to implement the BeanValidation for the client for outgoing
>>>>> operations in an OutInterceptor.
>>>>>
>>>>> I need to be able to validate the parameters for the method:
>>>>> Set<ConstraintViolation<Object>> violations =
>>>>> executableValidator.validateParameters(this, method,
>>>>> parameterValues);
>>>>>
>>>>> Getting access to the method is no problem using
>>>>> OperationResourceInfo.class.
>>>>>
>>>>> How can I access the parameter values (Object[] parameterValues) of
>>>>> the method that has been invoked so I can validate them?
>>>>>
>>>>> I can get easily access to the json objects if passed to the method,
>>>>> but I need access to the original method invocation, before the
>>>>> message has been assembled to query/path/body params etc.
>>>>>
>>>>> Best regards,
>>>>> Johannes
>>>>>
>>>>>
>>>>> Am 24.10.2016 um 17:04 schrieb Sergey Beryozkin:
>>>>>> Hi
>>>>>>
>>>>>> I guess it can be interesting to support an optional client side bean
>>>>>> validation for the proxy clients as they have all the bean validation
>>>>>> annotations available...
>>>>>>
>>>>>> Cheers, Sergey
>>>>>> On 24/10/16 14:47, J. Fiala wrote:
>>>>>>> Hi there,
>>>>>>>
>>>>>>> Is automatic client-side beanvalidation supported somehow (currently
>>>>>>> this is not mentioned in the docs)?
>>>>>>>
>>>>>>> Maybe it would make sense to add this to the configuration, so
>>>>>>> this has
>>>>>>> not to be done manually before calling the server?
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Johannes
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Automatic client-side beanvalidation?
Posted by Sergey Beryozkin <sb...@gmail.com>.
This Object is a proxy.
Please focus on validating the request parameters only. And simply
create a local final var with the same property
Sergey
On 14/11/16 21:35, J. Fiala wrote:
> Dear Sergey,
>
> Can you please also add the Object o (from public Object invoke(Object
> o, Method m, Object[] params) throws Throwable) as "method.object" CXF
> Message property at ClientProxyImpl.java?
>
> Then the interceptor works straightforward like this:
>
> public class ClientBeanValidationOutInterceptor extends
> AbstractPhaseInterceptor<Message> {
>
>
> public ClientBeanValidationOutInterceptor() {
> super(Phase.PRE_LOGICAL);
> }
>
> public ClientBeanValidationOutInterceptor(String phase) {
> super(phase);
> }
>
> @Override
> public void handleMessage(Message message) throws Fault {
>
> Object objectToRunOn = (Object) message.get("method.object");
> Object[] parameterValues = (Object[])
> message.get("method.parameters");
>
> OperationResourceInfo info =
> message.getContent(OperationResourceInfo.class);
>
> try {
> ValidatorFactory factory =
> Validation.buildDefaultValidatorFactory();
> ExecutableValidator executableValidator =
> factory.getValidator().forExecutables();
>
>
> Method method = info.getMethodToInvoke();
> Set<ConstraintViolation<Object>> violations =
> executableValidator
> .validateParameters(objectToRunOn, method,
> parameterValues);
>
> if (violations.size() > 0) {
> Set<ConstraintViolation<Object>> violationsObj =
> (Set<ConstraintViolation<Object>>) violations;
> throw new BeanValidationException(violationsObj);
> }
>
> } catch (SecurityException e) {
> e.printStackTrace();
> }
>
> }
> }
>
> Pls let me know if I should add a PR for this (on separate branch
> client_beanvalidation) or if you are going to add it yourself ...
>
> Thank you & Best regards,
> Johannes
>
>
> Am 14.11.2016 um 13:08 schrieb Sergey Beryozkin:
>> Hi
>>
>> I've updated ClientProxyImpl to pass them as a "method.parameters" CXF
>> Message property
>>
>> Thanks, Sergey.
>> On 13/11/16 19:49, J. Fiala wrote:
>>> Dear Sergey,
>>>
>>> To be more specific, at ClientProxyImpl.java the Object[] params are
>>> available, but they are not passed onto the interceptor chain:
>>>
>>> return doChainedInvocation(uri, headers, ori, body, bodyIndex, null,
>>> null);
>>>
>>> Is there a another way I can access the Object[] params in an
>>> interceptor?
>>>
>>> Or do I have to subclass ClientProxyImpl.java?
>>>
>>> Best regards,
>>> Johannes
>>>
>>>
>>> Am 13.11.2016 um 20:45 schrieb J. Fiala:
>>>> Dear Sergey,
>>>>
>>>> I tried to implement the BeanValidation for the client for outgoing
>>>> operations in an OutInterceptor.
>>>>
>>>> I need to be able to validate the parameters for the method:
>>>> Set<ConstraintViolation<Object>> violations =
>>>> executableValidator.validateParameters(this, method,
>>>> parameterValues);
>>>>
>>>> Getting access to the method is no problem using
>>>> OperationResourceInfo.class.
>>>>
>>>> How can I access the parameter values (Object[] parameterValues) of
>>>> the method that has been invoked so I can validate them?
>>>>
>>>> I can get easily access to the json objects if passed to the method,
>>>> but I need access to the original method invocation, before the
>>>> message has been assembled to query/path/body params etc.
>>>>
>>>> Best regards,
>>>> Johannes
>>>>
>>>>
>>>> Am 24.10.2016 um 17:04 schrieb Sergey Beryozkin:
>>>>> Hi
>>>>>
>>>>> I guess it can be interesting to support an optional client side bean
>>>>> validation for the proxy clients as they have all the bean validation
>>>>> annotations available...
>>>>>
>>>>> Cheers, Sergey
>>>>> On 24/10/16 14:47, J. Fiala wrote:
>>>>>> Hi there,
>>>>>>
>>>>>> Is automatic client-side beanvalidation supported somehow (currently
>>>>>> this is not mentioned in the docs)?
>>>>>>
>>>>>> Maybe it would make sense to add this to the configuration, so
>>>>>> this has
>>>>>> not to be done manually before calling the server?
>>>>>>
>>>>>> Best regards,
>>>>>> Johannes
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Automatic client-side beanvalidation?
Posted by "J. Fiala" <mo...@fwd.at>.
Dear Sergey,
Can you please also add the Object o (from public Object invoke(Object
o, Method m, Object[] params) throws Throwable) as "method.object" CXF
Message property at ClientProxyImpl.java?
Then the interceptor works straightforward like this:
public class ClientBeanValidationOutInterceptor extends
AbstractPhaseInterceptor<Message> {
public ClientBeanValidationOutInterceptor() {
super(Phase.PRE_LOGICAL);
}
public ClientBeanValidationOutInterceptor(String phase) {
super(phase);
}
@Override
public void handleMessage(Message message) throws Fault {
Object objectToRunOn = (Object) message.get("method.object");
Object[] parameterValues = (Object[])
message.get("method.parameters");
OperationResourceInfo info =
message.getContent(OperationResourceInfo.class);
try {
ValidatorFactory factory =
Validation.buildDefaultValidatorFactory();
ExecutableValidator executableValidator =
factory.getValidator().forExecutables();
Method method = info.getMethodToInvoke();
Set<ConstraintViolation<Object>> violations =
executableValidator
.validateParameters(objectToRunOn, method,
parameterValues);
if (violations.size() > 0) {
Set<ConstraintViolation<Object>> violationsObj =
(Set<ConstraintViolation<Object>>) violations;
throw new BeanValidationException(violationsObj);
}
} catch (SecurityException e) {
e.printStackTrace();
}
}
}
Pls let me know if I should add a PR for this (on separate branch
client_beanvalidation) or if you are going to add it yourself ...
Thank you & Best regards,
Johannes
Am 14.11.2016 um 13:08 schrieb Sergey Beryozkin:
> Hi
>
> I've updated ClientProxyImpl to pass them as a "method.parameters" CXF
> Message property
>
> Thanks, Sergey.
> On 13/11/16 19:49, J. Fiala wrote:
>> Dear Sergey,
>>
>> To be more specific, at ClientProxyImpl.java the Object[] params are
>> available, but they are not passed onto the interceptor chain:
>>
>> return doChainedInvocation(uri, headers, ori, body, bodyIndex, null,
>> null);
>>
>> Is there a another way I can access the Object[] params in an
>> interceptor?
>>
>> Or do I have to subclass ClientProxyImpl.java?
>>
>> Best regards,
>> Johannes
>>
>>
>> Am 13.11.2016 um 20:45 schrieb J. Fiala:
>>> Dear Sergey,
>>>
>>> I tried to implement the BeanValidation for the client for outgoing
>>> operations in an OutInterceptor.
>>>
>>> I need to be able to validate the parameters for the method:
>>> Set<ConstraintViolation<Object>> violations =
>>> executableValidator.validateParameters(this, method,
>>> parameterValues);
>>>
>>> Getting access to the method is no problem using
>>> OperationResourceInfo.class.
>>>
>>> How can I access the parameter values (Object[] parameterValues) of
>>> the method that has been invoked so I can validate them?
>>>
>>> I can get easily access to the json objects if passed to the method,
>>> but I need access to the original method invocation, before the
>>> message has been assembled to query/path/body params etc.
>>>
>>> Best regards,
>>> Johannes
>>>
>>>
>>> Am 24.10.2016 um 17:04 schrieb Sergey Beryozkin:
>>>> Hi
>>>>
>>>> I guess it can be interesting to support an optional client side bean
>>>> validation for the proxy clients as they have all the bean validation
>>>> annotations available...
>>>>
>>>> Cheers, Sergey
>>>> On 24/10/16 14:47, J. Fiala wrote:
>>>>> Hi there,
>>>>>
>>>>> Is automatic client-side beanvalidation supported somehow (currently
>>>>> this is not mentioned in the docs)?
>>>>>
>>>>> Maybe it would make sense to add this to the configuration, so
>>>>> this has
>>>>> not to be done manually before calling the server?
>>>>>
>>>>> Best regards,
>>>>> Johannes
>>>>>
>>>>
>>>>
>>>
>>
>
>
Re: Automatic client-side beanvalidation?
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
I've updated ClientProxyImpl to pass them as a "method.parameters" CXF
Message property
Thanks, Sergey.
On 13/11/16 19:49, J. Fiala wrote:
> Dear Sergey,
>
> To be more specific, at ClientProxyImpl.java the Object[] params are
> available, but they are not passed onto the interceptor chain:
>
> return doChainedInvocation(uri, headers, ori, body, bodyIndex, null, null);
>
> Is there a another way I can access the Object[] params in an interceptor?
>
> Or do I have to subclass ClientProxyImpl.java?
>
> Best regards,
> Johannes
>
>
> Am 13.11.2016 um 20:45 schrieb J. Fiala:
>> Dear Sergey,
>>
>> I tried to implement the BeanValidation for the client for outgoing
>> operations in an OutInterceptor.
>>
>> I need to be able to validate the parameters for the method:
>> Set<ConstraintViolation<Object>> violations =
>> executableValidator.validateParameters(this, method,
>> parameterValues);
>>
>> Getting access to the method is no problem using
>> OperationResourceInfo.class.
>>
>> How can I access the parameter values (Object[] parameterValues) of
>> the method that has been invoked so I can validate them?
>>
>> I can get easily access to the json objects if passed to the method,
>> but I need access to the original method invocation, before the
>> message has been assembled to query/path/body params etc.
>>
>> Best regards,
>> Johannes
>>
>>
>> Am 24.10.2016 um 17:04 schrieb Sergey Beryozkin:
>>> Hi
>>>
>>> I guess it can be interesting to support an optional client side bean
>>> validation for the proxy clients as they have all the bean validation
>>> annotations available...
>>>
>>> Cheers, Sergey
>>> On 24/10/16 14:47, J. Fiala wrote:
>>>> Hi there,
>>>>
>>>> Is automatic client-side beanvalidation supported somehow (currently
>>>> this is not mentioned in the docs)?
>>>>
>>>> Maybe it would make sense to add this to the configuration, so this has
>>>> not to be done manually before calling the server?
>>>>
>>>> Best regards,
>>>> Johannes
>>>>
>>>
>>>
>>
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Re: Automatic client-side beanvalidation?
Posted by "J. Fiala" <mo...@fwd.at>.
Dear Sergey,
To be more specific, at ClientProxyImpl.java the Object[] params are
available, but they are not passed onto the interceptor chain:
return doChainedInvocation(uri, headers, ori, body, bodyIndex, null, null);
Is there a another way I can access the Object[] params in an interceptor?
Or do I have to subclass ClientProxyImpl.java?
Best regards,
Johannes
Am 13.11.2016 um 20:45 schrieb J. Fiala:
> Dear Sergey,
>
> I tried to implement the BeanValidation for the client for outgoing
> operations in an OutInterceptor.
>
> I need to be able to validate the parameters for the method:
> Set<ConstraintViolation<Object>> violations =
> executableValidator.validateParameters(this, method,
> parameterValues);
>
> Getting access to the method is no problem using
> OperationResourceInfo.class.
>
> How can I access the parameter values (Object[] parameterValues) of
> the method that has been invoked so I can validate them?
>
> I can get easily access to the json objects if passed to the method,
> but I need access to the original method invocation, before the
> message has been assembled to query/path/body params etc.
>
> Best regards,
> Johannes
>
>
> Am 24.10.2016 um 17:04 schrieb Sergey Beryozkin:
>> Hi
>>
>> I guess it can be interesting to support an optional client side bean
>> validation for the proxy clients as they have all the bean validation
>> annotations available...
>>
>> Cheers, Sergey
>> On 24/10/16 14:47, J. Fiala wrote:
>>> Hi there,
>>>
>>> Is automatic client-side beanvalidation supported somehow (currently
>>> this is not mentioned in the docs)?
>>>
>>> Maybe it would make sense to add this to the configuration, so this has
>>> not to be done manually before calling the server?
>>>
>>> Best regards,
>>> Johannes
>>>
>>
>>
>
Re: Automatic client-side beanvalidation?
Posted by "J. Fiala" <mo...@fwd.at>.
Dear Sergey,
I tried to implement the BeanValidation for the client for outgoing
operations in an OutInterceptor.
I need to be able to validate the parameters for the method:
Set<ConstraintViolation<Object>> violations =
executableValidator.validateParameters(this, method,
parameterValues);
Getting access to the method is no problem using
OperationResourceInfo.class.
How can I access the parameter values (Object[] parameterValues) of the
method that has been invoked so I can validate them?
I can get easily access to the json objects if passed to the method, but
I need access to the original method invocation, before the message has
been assembled to query/path/body params etc.
Best regards,
Johannes
Am 24.10.2016 um 17:04 schrieb Sergey Beryozkin:
> Hi
>
> I guess it can be interesting to support an optional client side bean
> validation for the proxy clients as they have all the bean validation
> annotations available...
>
> Cheers, Sergey
> On 24/10/16 14:47, J. Fiala wrote:
>> Hi there,
>>
>> Is automatic client-side beanvalidation supported somehow (currently
>> this is not mentioned in the docs)?
>>
>> Maybe it would make sense to add this to the configuration, so this has
>> not to be done manually before calling the server?
>>
>> Best regards,
>> Johannes
>>
>
>
Re: Automatic client-side beanvalidation?
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
I guess it can be interesting to support an optional client side bean
validation for the proxy clients as they have all the bean validation
annotations available...
Cheers, Sergey
On 24/10/16 14:47, J. Fiala wrote:
> Hi there,
>
> Is automatic client-side beanvalidation supported somehow (currently
> this is not mentioned in the docs)?
>
> Maybe it would make sense to add this to the configuration, so this has
> not to be done manually before calling the server?
>
> Best regards,
> Johannes
>
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/