@PUT
@Path("upload/{id}")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public void addBlob(@PathParam("id") Integer id,@FormDataParam("file") InputStream uploadedInputStream) throws IOException {
TheTempClient entityToMerge = find(id);
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
int read = 0;
byte[] bytes = new byte[1024];
while ((read = uploadedInputStream.read(bytes)) != -1) {
out.write(bytes,read);
}
entityToMerge.setTestBlob(out.toByteArray());
super.edit(entityToMerge);
}
catch (IOException e) {
e.printStackTrace();
}
}
它没有真正说明为什么,我得到的只是:
Severe: WebModule[/MavenProjectTest]StandardWrapper.Throwable
org.glassfish.jersey.server.model.ModelValidationException: Validation of the application resource model has Failed during application initialization.
我一定在这里做了一些非常错误的事,有没有专业的JPA爱好者可以在这里帮助我一点点?
编辑:我正在使用注释而不是web.xml,是否可以在没有web.xml的情况下执行此操作?
最佳答案