@Test public void testCheckFileInfo() throws IOException, JSONException { checkGetNotFound(); Map<String, String> toReplace = new HashMap<>(); toReplace.put(REPOSITORY_VAR, blobDoc.getRepositoryName()); toReplace.put(DOC_ID_VAR, blobDoc.getId()); toReplace.put(XPATH_VAR, FILE_CONTENT_PROPERTY); toReplace.put(FILENAME_VAR, "test-file.txt"); toReplace.put(CHANGE_TOKEN_VAR, "1-0"); toReplace.put(ITEM_VERSION_VAR, expectedFileBlob.getDigest()); try (CloseableClientResponse response = get(johnToken, blobDocFileId)) { checkJSONResponse(response, "json/CheckFileInfo-john-write.json", toReplace); } try (CloseableClientResponse response = get(joeToken, blobDocFileId)) { checkJSONResponse(response, "json/CheckFileInfo-joe-read.json", toReplace); } DocumentModel convertibleBlobDoc = session.createDocumentModel("/wopi", "convertibleBlobDoc", "File"); Blob convertibleBlob = Blobs.createBlob("binary content".getBytes()); String convertibleFilename = "convertibleFile.xls"; convertibleBlob.setFilename(convertibleFilename); convertibleBlobDoc.setPropertyValue(FILE_CONTENT_PROPERTY, (Serializable) convertibleBlob); convertibleBlobDoc = session.createDocument(convertibleBlobDoc); convertibleBlob = (Blob) convertibleBlobDoc.getPropertyValue(FILE_CONTENT_PROPERTY); String convertibleBlobDocFileId = FileInfo.computeFileId(convertibleBlobDoc, FILE_CONTENT_PROPERTY); transactionalFeature.nextTransaction(); toReplace.put(DOC_ID_VAR, convertibleBlobDoc.getId()); toReplace.put(FILENAME_VAR, convertibleFilename); toReplace.put(ITEM_VERSION_VAR, convertibleBlob.getDigest()); try (CloseableClientResponse response = get(johnToken, convertibleBlobDocFileId)) { checkJSONResponse(response, "json/CheckFileInfo-john-convert.json", toReplace); } }
@GET @Produces(MediaType.APPLICATION_JSON) public Response checkFileInfo() { logRequest(OPERATION_CHECK_FILE_INFO); Map<String, Serializable> checkFileInfoMap = buildCheckFileInfoMap(); logResponse(OPERATION_CHECK_FILE_INFO, OK.getStatusCode(), checkFileInfoMap); return Response.ok(checkFileInfoMap).build(); }
FilesEndpoint extends DefaultObject { @GET @Produces(MediaType.APPLICATION_JSON) public Response checkFileInfo() { logRequest(OPERATION_CHECK_FILE_INFO); Map<String, Serializable> checkFileInfoMap = buildCheckFileInfoMap(); logResponse(OPERATION_CHECK_FILE_INFO, OK.getStatusCode(), checkFileInfoMap); return Response.ok(checkFileInfoMap).build(); } }
FilesEndpoint extends DefaultObject { @GET @Produces(MediaType.APPLICATION_JSON) public Response checkFileInfo() { logRequest(OPERATION_CHECK_FILE_INFO); Map<String, Serializable> checkFileInfoMap = buildCheckFileInfoMap(); logResponse(OPERATION_CHECK_FILE_INFO, OK.getStatusCode(), checkFileInfoMap); return Response.ok(checkFileInfoMap).build(); }  }
FilesEndpoint extends DefaultObject { @GET @Produces(MediaType.APPLICATION_JSON) public Response checkFileInfo() { logRequest(OPERATION_CHECK_FILE_INFO); Map<String, Serializable> checkFileInfoMap = buildCheckFileInfoMap(); logResponse(OPERATION_CHECK_FILE_INFO, OK.getStatusCode(), checkFileInfoMap); return Response.ok(checkFileInfoMap).build(); }  @Override void initialize(Object... args); @GET @Produces(MediaType.APPLICATION_JSON) Response checkFileInfo(); @GET @Path("contents") Object getFile(@HeaderParam(MAX_EXPECTED_SIZE) String maxExpectedSizeHeader); @POST Object doPost(@HeaderParam(OVERRIDE) Operation operation); Object putRelativeFile(); Object renameFile(); Object getShareUrl(); @POST @Path("contents") Object doPostContents(@HeaderParam(OVERRIDE) Operation operation); Object putFile(); }
FilesEndpoint extends DefaultObject { @GET @Produces(MediaType.APPLICATION_JSON) public Response checkFileInfo() { logRequest(OPERATION_CHECK_FILE_INFO); Map<String, Serializable> checkFileInfoMap = buildCheckFileInfoMap(); logResponse(OPERATION_CHECK_FILE_INFO, OK.getStatusCode(), checkFileInfoMap); return Response.ok(checkFileInfoMap).build(); }  @Override void initialize(Object... args); @GET @Produces(MediaType.APPLICATION_JSON) Response checkFileInfo(); @GET @Path("contents") Object getFile(@HeaderParam(MAX_EXPECTED_SIZE) String maxExpectedSizeHeader); @POST Object doPost(@HeaderParam(OVERRIDE) Operation operation); Object putRelativeFile(); Object renameFile(); Object getShareUrl(); @POST @Path("contents") Object doPostContents(@HeaderParam(OVERRIDE) Operation operation); Object putFile();  }