I JAX-RS isn't working correctly. As illustrated in its websites, and other websites, it should be working correctly.
@POST
@Path("/foo")
@Produces("application/json")
@Consume("multipart/form-data")
public String foo(
@FormDataParam("file") InputStream stream,
@FormDataParam("file") FormDataContentDisposition fileDetail){
return fileDetail.getFileName();
}
The return is 404 Not Found. It seems like the file I was uploading didn't get recognized. Looking at examples at http://ift.tt/1tsCYip , it should have been working.
So, I tried another.
@POST
@Path("/foo")
@Produces("application/json")
@Consume("multipart/form-data")
public String foo(
@FormDataParam("file") String display){
return display;
}
The result in this case is form's all data, not only file's data.
I had following html:
<form name="Nirmal" action="webresources/gene" method="POST" enctype="multipart/form-data">
<input type="file" name="file"/>
<input type="submit" value="Submit" name="Submit" />
</form>
I uploaded a simple text file "okay.txt" with content "it doesn't work!!".
The result was this.
404 Not Found
It has to do something with parameters that I think is not suitable How to make it work?
Aucun commentaire:
Enregistrer un commentaire