基于请求类型覆盖REST POST方法

问题描述 投票:0回答:1

我正在使用resteasy,我想有两个这样的发布方法-

@POST    
@Consumes("multipart/form-data")
public void post(   @PathParam("p1") String p1, 
                        @PathParam("p2") String p2,
                        @PathParam("p3") String p3,
                        @Suspended AsyncResponse asyncResponse, 
                        @Context HttpServletRequest httpServletRequest,
                        MultipartFormDataInput input)
@POST    
public void post(   @PathParam("p1") String p1, 
                            @PathParam("p2") String p2,
                            @PathParam("p3") String p3,
                            @Suspended AsyncResponse asyncResponse, 
                            @Context HttpServletRequest httpServletRequest)

首先处理文件上传的发布方法,以及其他处理文件上传以外的所有请求的发布方法。但是,当我测试这些方法时,文件上传可以正常工作,但文件上传以外的请求无法达到这些方法中的任何一个。我该如何实现?另外,如果我能以某种方式接收两种类型的请求,然后根据文件是否已上传有条件地处理请求,我也很好...

web-services jax-rs resteasy
1个回答
1
投票

哦。对不起,由于上面的方法签名工作正常,所以必须是构建问题。.:)

© www.soinside.com 2019 - 2024. All rights reserved.