@POST
@Path("post")
@Consumes("multipart/form-data")
public Response postCategory(@FormDataParam("text1") String text1,
@FormDataParam("file1") InputStream file1,
@FormDataParam("text2") String text2,
@FormDataParam("file2") InputStream file2) {
System.out.println("CategoryService.postCategory()");
System.out.println("text1:" + text1);
System.out.println("text2:" + text2);
String uploadedFileLocation = "d://uploaded/test.jpg";
writeToFile(file1, uploadedFileLocation);
return Response.ok().build();
}
使用此代码,我可以获得HtmlInputFile作为InputStream,HtmlInputText作为String,但我想获得HtmlInputText的另一个属性,id, name, class
甚至更多:我的动态属性如下:
<input type='text' myattr='myattr-value' name='inpp'/>