Hi
On 14/10/14 13:53, Sergei Shisholik wrote:
Hi!
I want to get parameter name when InjectionUtils.handleBean throws
exception. For example:
@Path("/test1")
     @PUT
     public SuccessResult update(@QueryParam("testParam") Integer testParam)
{
         return new SuccessResult(true);
     }

PUT /test1?testParam=qwe

In server I get NumberFormatException, but I can't get name of parameter
for which this exception was.
How I can do this?

Right now the only way to get hold of the name of the parameter in case of NFE is to register a custom JAX-RS 2.0 ParamConverterProvider and manage the conversion there, catch NFE and check the parameter name.

I guess the other option is to introduce a CXF specific NumberFormatException extension - this will be wrapped as a cause in JAX-RS WebApplicationException - and a custom ExceptionMapper<WebApplicationException> mapper would get the parameter name from the cause. For now though using a converter is the only option.
Cheers, Sergey

Thanks.


Reply via email to