You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Benson Margulies <be...@basistech.com> on 2014/10/22 20:55:29 UTC

Enumeration as REST param and errors

If I use an enum test as a restful parameter and someone sends in an
invalid value, the logging is pretty verbose.

Can I make my own exception manager to quiet this down? I want to avoid
ERROR-level logs when the client on the other end of the internet is the
responsible party. Of course, I could change to a string param and parse it
myself, but that's no fun.



0    [main] ERROR org.apache.cxf.jaxrs.utils.InjectionUtils  - Instance of
class
com.basistech.wsbus.webservice.servlet.RaasRsRblService$RblRequestDataType
can not be created using static valueOf(String) or fromString(String)
methods
6    [main] WARN  org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper
 - javax.ws.rs.WebApplicationException: HTTP 404 Not Found
at
org.apache.cxf.jaxrs.utils.InjectionUtils.evaluateFactoryMethods(InjectionUtils.java:492)
at
org.apache.cxf.jaxrs.utils.InjectionUtils.handleParameter(InjectionUtils.java:414)
at
org.apache.cxf.jaxrs.utils.InjectionUtils.createParameterObject(InjectionUtils.java:947)
at
org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromUriParam(JAXRSUtils.java:1168)
at
org.apache.cxf.jaxrs.utils.JAXRSUtils.createHttpParameterValue(JAXRSUtils.java:850)
at
org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:825)
at
org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:775)
at
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:212)

Re: Enumeration as REST param and errors

Posted by Benson Margulies <be...@basistech.com>.
That ParamConverterProvider looks interesting, thanks.

On Wed, Oct 22, 2014 at 4:39 PM, Sergey Beryozkin <sb...@gmail.com> wrote:
> Sure, a custom WebApplicationException mapper will do, or,
> NotFoundExceptionMapper. Another option is to use JAX-RS 2.0
> ParamConverterProvider (registered in jaxrs:providers) and control the
> conversion there
>
> Cheers, Sergey
>
> On 22/10/14 19:55, Benson Margulies wrote:
>>
>> If I use an enum test as a restful parameter and someone sends in an
>> invalid value, the logging is pretty verbose.
>>
>> Can I make my own exception manager to quiet this down? I want to avoid
>> ERROR-level logs when the client on the other end of the internet is the
>> responsible party. Of course, I could change to a string param and parse
>> it
>> myself, but that's no fun.
>>
>>
>>
>> 0    [main] ERROR org.apache.cxf.jaxrs.utils.InjectionUtils  - Instance of
>> class
>> com.basistech.wsbus.webservice.servlet.RaasRsRblService$RblRequestDataType
>> can not be created using static valueOf(String) or fromString(String)
>> methods
>> 6    [main] WARN  org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper
>>   - javax.ws.rs.WebApplicationException: HTTP 404 Not Found
>> at
>>
>> org.apache.cxf.jaxrs.utils.InjectionUtils.evaluateFactoryMethods(InjectionUtils.java:492)
>> at
>>
>> org.apache.cxf.jaxrs.utils.InjectionUtils.handleParameter(InjectionUtils.java:414)
>> at
>>
>> org.apache.cxf.jaxrs.utils.InjectionUtils.createParameterObject(InjectionUtils.java:947)
>> at
>>
>> org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromUriParam(JAXRSUtils.java:1168)
>> at
>>
>> org.apache.cxf.jaxrs.utils.JAXRSUtils.createHttpParameterValue(JAXRSUtils.java:850)
>> at
>>
>> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:825)
>> at
>>
>> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:775)
>> at
>>
>> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:212)
>>
>
>

Re: Enumeration as REST param and errors

Posted by Sergey Beryozkin <sb...@gmail.com>.
Sure, a custom WebApplicationException mapper will do, or, 
NotFoundExceptionMapper. Another option is to use JAX-RS 2.0 
ParamConverterProvider (registered in jaxrs:providers) and control the 
conversion there

Cheers, Sergey
On 22/10/14 19:55, Benson Margulies wrote:
> If I use an enum test as a restful parameter and someone sends in an
> invalid value, the logging is pretty verbose.
>
> Can I make my own exception manager to quiet this down? I want to avoid
> ERROR-level logs when the client on the other end of the internet is the
> responsible party. Of course, I could change to a string param and parse it
> myself, but that's no fun.
>
>
>
> 0    [main] ERROR org.apache.cxf.jaxrs.utils.InjectionUtils  - Instance of
> class
> com.basistech.wsbus.webservice.servlet.RaasRsRblService$RblRequestDataType
> can not be created using static valueOf(String) or fromString(String)
> methods
> 6    [main] WARN  org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper
>   - javax.ws.rs.WebApplicationException: HTTP 404 Not Found
> at
> org.apache.cxf.jaxrs.utils.InjectionUtils.evaluateFactoryMethods(InjectionUtils.java:492)
> at
> org.apache.cxf.jaxrs.utils.InjectionUtils.handleParameter(InjectionUtils.java:414)
> at
> org.apache.cxf.jaxrs.utils.InjectionUtils.createParameterObject(InjectionUtils.java:947)
> at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromUriParam(JAXRSUtils.java:1168)
> at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.createHttpParameterValue(JAXRSUtils.java:850)
> at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:825)
> at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:775)
> at
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:212)
>