泽西多部分文件上传在grails-rs中不起作用

时间:2015-12-11 04:39:14

标签: grails jersey mule jax-rs multipart

我从Grails 2.5.1 400插件中的代码库通过Jersey Multipart上传文件时获得Bad Requestjaxrs:0.11

REST中的代码:



    @POST
    @Path("/uploadTemplate")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public void uploadFile(@FormDataParam("file") InputStream uploadedInputStream,
                           @FormDataParam("file") FormDataContentDisposition fileDetail) {

        println("Upload Template Called................................................"+uploadedInputStream)

    }




来自客户的电话:



final ClientConfig config = new DefaultClientConfig();
    
final Client client = Client.create(config);

final WebResource resource = client.resource("http://localhost:8090/ExportService/fa/templateManager/template").path("uploadTemplate");

println("URL............................" + resource.getURI());

final File fileToUpload = new File("/home/nsubedi/TestOneSheet.xlsx");

final FormDataMultiPart multiPart = new FormDataMultiPart();

FileDataBodyPart fileDataBodyPart = new FileDataBodyPart("file", fileToUpload, MediaType.MULTIPART_FORM_DATA_TYPE);

if (fileToUpload != null) {
    multiPart.bodyPart(fileDataBodyPart);
}

final ClientResponse clientResp = resource.type(MediaType.MULTIPART_FORM_DATA_TYPE).post(ClientResponse.class, multiPart);
println("Response: " + clientResp.getStatus() + " Info..........." + clientResp.getStatusInfo().getReasonPhrase());




我做了很多谷歌,在stackoverflow中找到了关于mule更改的内容,但不知道如何。 请有人帮我。感谢。

0 个答案:

没有答案