在ubuntu上cxf POST失败
我们有一个apache CXF应用程序,可以在windows上运行,但不能在Ubuntu上运行。GET请求起作用,但POST请求不接收消息正文。 接收消息的类上载:在ubuntu上cxf POST失败,post,ubuntu,cxf,Post,Ubuntu,Cxf,我们有一个apache CXF应用程序,可以在windows上运行,但不能在Ubuntu上运行。GET请求起作用,但POST请求不接收消息正文。 接收消息的类上载: @Path("/api/user/{userId}") public class Upload { @POST @Path("upload") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) public
@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) {
fileRecord在ubuntu上为空,但在windows上可以
我们发出的信息:
(标题)
(正文)
我们决定不使用@Multipart(value=“FileRecord”,type=MediaType.APPLICATION\u JSON)FileRecord FileRecord作为参数,而是使用String参数并解析此类的JSON字符串。
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