1
我使用Postman在「form-data」選項下以附件形式發送xml文件。 我加入的請求標頭「內容類型」爲「多/表單數據」修改端點以接收XML文件
但我的終點是沒有得到的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();
}
}