@Test public void isDirectory() throws IOException { assertTrue(mWebUfs.isDirectory(mWebUfsRoot)); }
@Override public boolean isDirectory(String path) throws IOException { String contentType = ""; Header[] headers = HttpUtils.head(path, mTimeout); if (headers == null) { return false; } for (Header header : headers) { if (header.getName().equalsIgnoreCase("Content-Type")) { contentType = header.getValue(); break; } } if (contentType.contains("text/html")) { Elements titleElements = Jsoup.connect(path).get().select("title"); if (titleElements.size() > 0) { String title = titleElements.get(0).text(); List<String> titles = mUfsConf.getList(PropertyKey.UNDERFS_WEB_TITLES, ","); for (final String t : titles) { if (title.contains(t)) { return true; } } } } return false; }
WebUnderFileSystem extends ConsistentUnderFileSystem { @Override public boolean isDirectory(String path) throws IOException { String contentType = ""; Header[] headers = HttpUtils.head(path, mTimeout); if (headers == null) { return false; } for (Header header : headers) { if (header.getName().equalsIgnoreCase("Content-Type")) { contentType = header.getValue(); break; } } if (contentType.contains("text/html")) { Elements titleElements = Jsoup.connect(path).get().select("title"); if (titleElements.size() > 0) { String title = titleElements.get(0).text(); List<String> titles = mUfsConf.getList(PropertyKey.UNDERFS_WEB_TITLES, ","); for (final String t : titles) { if (title.contains(t)) { return true; } } } } return false; } }
WebUnderFileSystem extends ConsistentUnderFileSystem { @Override public boolean isDirectory(String path) throws IOException { String contentType = ""; Header[] headers = HttpUtils.head(path, mTimeout); if (headers == null) { return false; } for (Header header : headers) { if (header.getName().equalsIgnoreCase("Content-Type")) { contentType = header.getValue(); break; } } if (contentType.contains("text/html")) { Elements titleElements = Jsoup.connect(path).get().select("title"); if (titleElements.size() > 0) { String title = titleElements.get(0).text(); List<String> titles = mUfsConf.getList(PropertyKey.UNDERFS_WEB_TITLES, ","); for (final String t : titles) { if (title.contains(t)) { return true; } } } } return false; } WebUnderFileSystem(AlluxioURI uri, UnderFileSystemConfiguration ufsConf); }
WebUnderFileSystem extends ConsistentUnderFileSystem { @Override public boolean isDirectory(String path) throws IOException { String contentType = ""; Header[] headers = HttpUtils.head(path, mTimeout); if (headers == null) { return false; } for (Header header : headers) { if (header.getName().equalsIgnoreCase("Content-Type")) { contentType = header.getValue(); break; } } if (contentType.contains("text/html")) { Elements titleElements = Jsoup.connect(path).get().select("title"); if (titleElements.size() > 0) { String title = titleElements.get(0).text(); List<String> titles = mUfsConf.getList(PropertyKey.UNDERFS_WEB_TITLES, ","); for (final String t : titles) { if (title.contains(t)) { return true; } } } } return false; } WebUnderFileSystem(AlluxioURI uri, UnderFileSystemConfiguration ufsConf); @Override String getUnderFSType(); @Override void cleanup(); @Override void close(); @Override OutputStream create(String path, CreateOptions options); @Override boolean deleteDirectory(String path, DeleteOptions options); @Override boolean deleteFile(String path); @Override boolean exists(String path); @Override long getBlockSizeByte(String path); @Override UfsDirectoryStatus getDirectoryStatus(String path); @Override List<String> getFileLocations(String path); @Override List<String> getFileLocations(String path, FileLocationOptions options); @Override UfsFileStatus getFileStatus(String path); @Override long getSpace(String path, SpaceType type); @Override UfsStatus getStatus(String path); @Override boolean isDirectory(String path); @Override boolean isFile(String path); @Override UfsStatus[] listStatus(String path); @Override boolean mkdirs(String path, MkdirsOptions options); @Override InputStream open(String path, OpenOptions options); @Override boolean renameDirectory(String src, String dst); @Override boolean renameFile(String src, String dst); @Override void setOwner(String path, String user, String group); @Override void setMode(String path, short mode); @Override void connectFromMaster(String hostname); @Override void connectFromWorker(String hostname); @Override boolean supportsFlush(); }
WebUnderFileSystem extends ConsistentUnderFileSystem { @Override public boolean isDirectory(String path) throws IOException { String contentType = ""; Header[] headers = HttpUtils.head(path, mTimeout); if (headers == null) { return false; } for (Header header : headers) { if (header.getName().equalsIgnoreCase("Content-Type")) { contentType = header.getValue(); break; } } if (contentType.contains("text/html")) { Elements titleElements = Jsoup.connect(path).get().select("title"); if (titleElements.size() > 0) { String title = titleElements.get(0).text(); List<String> titles = mUfsConf.getList(PropertyKey.UNDERFS_WEB_TITLES, ","); for (final String t : titles) { if (title.contains(t)) { return true; } } } } return false; } WebUnderFileSystem(AlluxioURI uri, UnderFileSystemConfiguration ufsConf); @Override String getUnderFSType(); @Override void cleanup(); @Override void close(); @Override OutputStream create(String path, CreateOptions options); @Override boolean deleteDirectory(String path, DeleteOptions options); @Override boolean deleteFile(String path); @Override boolean exists(String path); @Override long getBlockSizeByte(String path); @Override UfsDirectoryStatus getDirectoryStatus(String path); @Override List<String> getFileLocations(String path); @Override List<String> getFileLocations(String path, FileLocationOptions options); @Override UfsFileStatus getFileStatus(String path); @Override long getSpace(String path, SpaceType type); @Override UfsStatus getStatus(String path); @Override boolean isDirectory(String path); @Override boolean isFile(String path); @Override UfsStatus[] listStatus(String path); @Override boolean mkdirs(String path, MkdirsOptions options); @Override InputStream open(String path, OpenOptions options); @Override boolean renameDirectory(String src, String dst); @Override boolean renameFile(String src, String dst); @Override void setOwner(String path, String user, String group); @Override void setMode(String path, short mode); @Override void connectFromMaster(String hostname); @Override void connectFromWorker(String hostname); @Override boolean supportsFlush();  }