properties.setContentType(request.getHeaderField(Constants.HeaderConstants.CONTENT_TYPE)); properties.setEtag(BaseResponse.getEtag(request)); properties.setCopyState(FileResponse.getCopyState(request));
properties.setContentType(request.getHeaderField(Constants.HeaderConstants.CONTENT_TYPE)); properties.setEtag(BaseResponse.getEtag(request)); properties.setCopyState(FileResponse.getCopyState(request));
public static void setFileProperties(CloudFile file) { file.getProperties().setCacheControl("no-transform"); file.getProperties().setContentDisposition("attachment"); file.getProperties().setContentEncoding("gzip"); file.getProperties().setContentLanguage("tr,en"); file.getProperties().setContentMD5("MDAwMDAwMDA="); file.getProperties().setContentType("text/html"); } }
file.getProperties().setContentLanguage("tr,en"); file.getProperties().setContentMD5("MDAwMDAwMDA="); file.getProperties().setContentType("text/html"); file.uploadProperties(); assertTrue(file.getProperties().getLastModified().after(lastModified));
/** * Test file resizing. * * @throws URISyntaxException * @throws StorageException */ @Test public void testCloudFileResize2() throws StorageException, URISyntaxException { CloudFile file = this.share.getRootDirectoryReference().getFileReference("file1"); CloudFile file2 = this.share.getRootDirectoryReference().getFileReference("file1"); file.create(1024); assertEquals(1024, file.getProperties().getLength()); file2.downloadAttributes(); assertEquals(1024, file2.getProperties().getLength()); file2.getProperties().setContentType("text/plain"); file2.uploadProperties(); file.resize(2048); assertEquals(2048, file.getProperties().getLength()); file.downloadAttributes(); assertEquals("text/plain", file.getProperties().getContentType()); file2.downloadAttributes(); assertEquals(2048, file2.getProperties().getLength()); }
/** * Test file resizing. * * @throws URISyntaxException * @throws StorageException */ @Test public void testCloudFileResize() throws URISyntaxException, StorageException { CloudFile file = this.share.getRootDirectoryReference().getFileReference("file1"); CloudFile file2 = this.share.getRootDirectoryReference().getFileReference("file1"); file.create(1024); assertEquals(1024, file.getProperties().getLength()); file2.downloadAttributes(); assertEquals(1024, file2.getProperties().getLength()); file2.getProperties().setContentType("text/plain"); file2.uploadProperties(); file.resize(2048); assertEquals(2048, file.getProperties().getLength()); file.downloadAttributes(); assertEquals("text/plain", file.getProperties().getContentType()); file2.downloadAttributes(); assertEquals(2048, file2.getProperties().getLength()); // Resize to 0 length file.resize(0); assertEquals(0, file.getProperties().getLength()); file.downloadAttributes(); assertEquals("text/plain", file.getProperties().getContentType()); file2.downloadAttributes(); assertEquals(0, file2.getProperties().getLength()); }