例如,同一端点的两个有效负载,在这种情况下,“/ payment / purchase”将json请求映射到正确的方法。有可能用jaxws吗?
payload one
{
name:test,
field1:test1
}
payload two
{
name:test,
field2:test2,
field3:test3
}
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Path("/payment/purchase")
public Response someMethod(Request1 orderRequest1) {
}
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Path("/payment/purchase")
public Response someMethod2(Request2 orderRequest2) {
}
答案 0 :(得分:0)
我使用bean验证的组功能
创建了一个包含所有属性和validade的大对象http://www.jroller.com/eyallupu/entry/jsr_303_beans_validation_using
并且工作正常