Java ApacheCamel-CXFRS:处理输入格式异常

Java ApacheCamel-CXFRS:处理输入格式异常,java,web-services,exception-handling,apache-camel,cxfrs,Java,Web Services,Exception Handling,Apache Camel,Cxfrs,我用ApacheCamel CXFRS创建了一个rest Web服务,我想控制输入格式 这是blueprint.xml: <cxf:rsServer id="rsServer" address="http://URL/" serviceClass="ngt.sas2sendsms.Getparams"/> <camelContext xmlns="http://camel.apache.org/schema/blueprint"> <route id="G

我用ApacheCamel CXFRS创建了一个rest Web服务,我想控制输入格式

这是blueprint.xml:

<cxf:rsServer id="rsServer" address="http://URL/" serviceClass="ngt.sas2sendsms.Getparams"/>

<camelContext xmlns="http://camel.apache.org/schema/blueprint">
    <route id="GET_DLR">
        <from uri="cxfrs://bean://rsServer"/>
         <setBody>
                <simple>${body[0]} ${body[2]} ${body[1]}</simple>
        </setBody>
    </route>
</camelContext>
当我在浏览器中通过此URL运行此路由时:
http://url/rxstatus?msgid=3&status=test&ts=44443

我收到以下错误消息:

java.lang.NumberFormatException: For input string: "test"
这是正常的,因为在状态参数中,我设置了一个字符串,而不是一个整数。所以我尝试处理这个异常

我试过这个:

 public class Getparams implements ExceptionMapper<NumberFormatException> {
            @GET
            @Path("rxstatus")
            @Produces("text/plain")
            public String getAssets(@QueryParam("msgid") String msgid,  
                                    @QueryParam("ts") int ts,
                                    @QueryParam("status") int status
                                    )
                    {
                     return null;
            }
  @Override 
  public Response toResponse(NumberFormatException arg0)
  {         
    return Response.serverError().build();
  }
}
公共类Getparams实现ExceptionMapper{
@得到
@路径(“rxstatus”)
@生成(“文本/纯文本”)
公共字符串getAssets(@QueryParam(“msgid”)字符串msgid,
@QueryParam(“ts”)int ts,
@QueryParam(“状态”)int status
)
{
返回null;
}
@凌驾
公众响应(NumberFormatException arg0)
{         
返回Response.serverError().build();
}
}
但我仍然得到:
java.lang.NumberFormatException用于输入字符串:“test”
我怎么办

 public class Getparams implements ExceptionMapper<NumberFormatException> {
            @GET
            @Path("rxstatus")
            @Produces("text/plain")
            public String getAssets(@QueryParam("msgid") String msgid,  
                                    @QueryParam("ts") int ts,
                                    @QueryParam("status") int status
                                    )
                    {
                     return null;
            }
  @Override 
  public Response toResponse(NumberFormatException arg0)
  {         
    return Response.serverError().build();
  }
}