}
public Response putContent(URI resource, String mimetype, HttpServletRequest request) throws HttpErrorException {
try {
if (request.getContentLength() == 0) {
throw new HttpErrorException(Status.BAD_REQUEST, resource.stringValue(), "content may not be empty for writing");
}
contentService.setContentStream(resource, request.getInputStream(), mimetype); // store content
if(configurationService.getBooleanConfiguration(ENHANCER_STANBOL_ENHANCER_ENABLED, false)) {
afterContentCreated.fire(new ContentCreatedEvent(resource)); //enhancer
}
return Response.ok().build();
} catch (IOException e) {
throw new HttpErrorException(Status.BAD_REQUEST, resource.stringValue(), "could not read request body");
} catch (WritingNotSupportedException e) {
throw new HttpErrorException(Status.FORBIDDEN, resource.stringValue(), "writting this content is not supported");
}
}