cxf POST在ubuntu上失败

时间:2012-10-09 07:59:02

标签: post ubuntu cxf

我们有apache CXF应用程序在Windows上运行但在Ubuntu上不起作用。 GET请求有效,但POST请求不接收消息正文。 class上传接收消息:

@Path("/api/user/{userId}")
public class Upload {
  @POST
  @Path("upload")
  @Produces(MediaType.APPLICATION_JSON)
  @Consumes(MediaType.MULTIPART_FORM_DATA)
  public FileRecord upload(@PathParam("userId") String userId, 
                           @QueryParam("key") String accessKey,
                           @Multipart(value="FileRecord", type=MediaType.APPLICATION_JSON) FileRecord fileRecord,
                           @Multipart(value="BodyRecord", type=MediaType.APPLICATION_OCTET_STREAM) InputStream body) {    

在ubuntu上,fileRecord为null,但在Windows上没问题。

我们发送的消息: (标题)

POST http://192.168.1.71:9000/api/user/tdq/upload HTTP/1.1
Accept-Encoding: gzip,deflate
Accept: application/json
MIME-Version: 1.0
content-type: multipart/form-data;boundary="123"
Content-Length: 443
Host: 192.168.1.71:9000
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

(主体)

--123
Content-Disposition: form-data; name="FileRecord"
Content-Type: application/json
Content-ID: FileRecord

{"FileRecord":{"name":"UploadTest"}}
--123
Content-Disposition: form-data; name="BodyRecord"
Content-Type: application/octet-stream
Content-ID: BodyRecord

This is a body
--123

0 个答案:

没有答案