@PUT @Path("image.jpg") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response putImage(@FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataBodyPart body) { try { SelfServiceMetaDataUtils.ensureDataXmlExists(this.id); } catch (IOException e) { throw new WebApplicationException(e); } RepositoryFileReference ref = new RepositoryFileReference(this.id, "image.jpg"); Response response = RestUtils.putContentToFile(ref, uploadedInputStream, body.getMediaType()); if (StringUtils.isEmpty(this.application.getImageUrl())) { this.application.setImageUrl("image.jpg"); persist(); } return response; }