开发者

Testing @MultipartForm RestEasy Rest Based Web Service

开发者 https://www.devze.com 2023-03-01 03:02 出处:网络
Does anyone know how to test the below @MultipartForm RestEasy Webservice? I\'m unsure of how to setup the request to the below service, any ideas?

Does anyone know how to test the below @MultipartForm RestEasy Webservice? I'm unsure of how to setup the request to the below service, any ideas?

@POST
@Path("/upload")
@Consumes("multipart/form-data")
public Response create(@MultipartForm FileUploadForm form) {
    System.out.println("test");
    return null;
}


public class FileUploadForm {
    private byte[] filedata;

    public FileUploadForm() {}

    public byte[] getFileData() {
        return filedata;
 开发者_如何学Python   }

    @FormParam("filedata")
    @PartType("application/octet-stream")
    public void setFileData(final byte[] filedata) {
        this.filedata = filedata;
    }
}


Please see the following blog. Maybe this is what you are looking for: http://ankiewsky.blogspot.com/2008/07/resteasy-tips-part-1.html


This appears to be a duplicate of:

RestEasy client framework file upload

I just posted an answer with some general guidelines on how I just got this working over there.

0

精彩评论

暂无评论...
验证码 换一张
取 消