[英]Modify endpoint to receive an XML file
我正在使用邮递员在“表单数据”选项下将xml文件作为附件发送。 我正在将“ Content-Type”的请求标头添加为“ multipart / form-data”
但是我的端点没有获取xml文件。 我的端点如何接收xml文件?
@PUT
@Path("/{param1}/{param2}")
@Consumes(MediaType.APPLICATION_XML)
@Produces(MediaType.APPLICATION_JSON)
public Response receiveXmlFile(List<Identifier> identifierList,
@PathParam("param1") String param1,
@PathParam("param2") String param2,
@FormParam("xmlFile") File xmlFile)
)
{
try {
return Response.status(Response.Status.OK).entity(readXmlFile(xmlFile)).build();
} catch (Exception e) {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).header("error", e.getMessage()).build();
}
}
解决方案是不发送来自邮递员的multipart/form-data
标头。
当发送相同的请求但没有任何标头时,则我的端点成功接收了该文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.