@Override protected HttpClient getClient() { // make accessible return super.getClient(); }
protected HttpFileObject(final AbstractFileName name, final FS fileSystem, final HttpFileSystemConfigBuilder builder) { super(name, fileSystem); final FileSystemOptions fileSystemOptions = fileSystem.getFileSystemOptions(); urlCharset = builder.getUrlCharset(fileSystemOptions); userAgent = builder.getUserAgent(fileSystemOptions); followRedirect = builder.getFollowRedirect(fileSystemOptions); }
/** * Creates a {@link FileSystem}. */ @Override protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) throws FileSystemException { // Create the file system final GenericFileName rootName = (GenericFileName) name; UserAuthenticationData authData = null; HttpClient httpClient; try { authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, AUTHENTICATOR_TYPES); final String fileScheme = rootName.getScheme(); final char lastChar = fileScheme.charAt(fileScheme.length() - 1); final String internalScheme = (lastChar == 's' || lastChar == 'S') ? "https" : "http"; httpClient = HttpClientFactory.createConnection(internalScheme, rootName.getHostName(), rootName.getPort(), UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(rootName.getUserName()))), UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword()))), fileSystemOptions); } finally { UserAuthenticatorUtils.cleanup(authData); } return new HttpFileSystem(rootName, httpClient, fileSystemOptions); }
protected HttpFileObject(final AbstractFileName name, final FS fileSystem, final HttpFileSystemConfigBuilder builder) { super(name, fileSystem); final FileSystemOptions fileSystemOptions = fileSystem.getFileSystemOptions(); urlCharset = builder.getUrlCharset(fileSystemOptions); userAgent = builder.getUserAgent(fileSystemOptions); followRedirect = builder.getFollowRedirect(fileSystemOptions); }
/** * Creates a {@link FileSystem}. */ @Override protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) throws FileSystemException { // Create the file system final GenericFileName rootName = (GenericFileName) name; UserAuthenticationData authData = null; HttpClient httpClient; try { authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, AUTHENTICATOR_TYPES); httpClient = HttpClientFactory.createConnection(rootName.getScheme(), rootName.getHostName(), rootName.getPort(), UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(rootName.getUserName()))), UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword()))), fileSystemOptions); } finally { UserAuthenticatorUtils.cleanup(authData); } return new HttpFileSystem(rootName, httpClient, fileSystemOptions); }
@Override protected HttpClient getClient() { // make accessible return super.getClient(); }
protected HttpFileObject(final AbstractFileName name, final FS fileSystem, final HttpFileSystemConfigBuilder builder) { super(name, fileSystem); final FileSystemOptions fileSystemOptions = fileSystem.getFileSystemOptions(); urlCharset = builder.getUrlCharset(fileSystemOptions); userAgent = builder.getUserAgent(fileSystemOptions); followRedirect = builder.getFollowRedirect(fileSystemOptions); }
/** * Creates a {@link FileSystem}. */ @Override protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) throws FileSystemException { // Create the file system final GenericFileName rootName = (GenericFileName) name; UserAuthenticationData authData = null; HttpClient httpClient; try { authData = UserAuthenticatorUtils.authenticate(fileSystemOptions, AUTHENTICATOR_TYPES); httpClient = HttpClientFactory.createConnection(rootName.getScheme(), rootName.getHostName(), rootName.getPort(), UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(rootName.getUserName()))), UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(rootName.getPassword()))), fileSystemOptions); } finally { UserAuthenticatorUtils.cleanup(authData); } return new HttpFileSystem(rootName, httpClient, fileSystemOptions); }
@Override protected HttpClient getClient() { // make accessible return super.getClient(); }
HeadMethod getHeadMethod() throws IOException { if (method != null) { return method; } method = new HeadMethod(); setupMethod(method); final HttpClient client = getAbstractFileSystem().getClient(); client.executeMethod(method); method.releaseConnection(); return method; }
HeadMethod getHeadMethod() throws IOException { if (method != null) { return method; } method = new HeadMethod(); setupMethod(method); final HttpClient client = getAbstractFileSystem().getClient(); client.executeMethod(method); method.releaseConnection(); return method; }
HeadMethod getHeadMethod() throws IOException { if (method != null) { return method; } method = new HeadMethod(); setupMethod(method); final HttpClient client = getAbstractFileSystem().getClient(); client.executeMethod(method); method.releaseConnection(); return method; }
/** * Creates an input stream to read the file content from. Is only called if {@link #doGetType} returns * {@link FileType#FILE}. * <p> * It is guaranteed that there are no open output streams for this file when this method is called. * <p> * The returned stream does not have to be buffered. */ @Override protected InputStream doGetInputStream() throws Exception { final GetMethod getMethod = new GetMethod(); setupMethod(getMethod); final int status = getAbstractFileSystem().getClient().executeMethod(getMethod); if (status == HttpURLConnection.HTTP_NOT_FOUND) { throw new FileNotFoundException(getName()); } if (status != HttpURLConnection.HTTP_OK) { throw new FileSystemException("vfs.provider.http/get.error", getName(), Integer.valueOf(status)); } return new HttpInputStream(getMethod); }
/** * Creates an input stream to read the file content from. Is only called if {@link #doGetType} returns * {@link FileType#FILE}. * <p> * It is guaranteed that there are no open output streams for this file when this method is called. * <p> * The returned stream does not have to be buffered. */ @Override protected InputStream doGetInputStream() throws Exception { final GetMethod getMethod = new GetMethod(); setupMethod(getMethod); final int status = getAbstractFileSystem().getClient().executeMethod(getMethod); if (status == HttpURLConnection.HTTP_NOT_FOUND) { throw new FileNotFoundException(getName()); } if (status != HttpURLConnection.HTTP_OK) { throw new FileSystemException("vfs.provider.http/get.error", getName(), Integer.valueOf(status)); } return new HttpInputStream(getMethod); }
/** * Creates an input stream to read the file content from. Is only called if {@link #doGetType} returns * {@link FileType#FILE}. * <p> * It is guaranteed that there are no open output streams for this file when this method is called. * <p> * The returned stream does not have to be buffered. */ @Override protected InputStream doGetInputStream() throws Exception { final GetMethod getMethod = new GetMethod(); setupMethod(getMethod); final int status = getAbstractFileSystem().getClient().executeMethod(getMethod); if (status == HttpURLConnection.HTTP_NOT_FOUND) { throw new FileNotFoundException(getName()); } if (status != HttpURLConnection.HTTP_OK) { throw new FileSystemException("vfs.provider.http/get.error", getName(), Integer.valueOf(status)); } return new HttpInputStream(getMethod); }
fileObject.setupMethod(getMethod); getMethod.setRequestHeader("Range", "bytes=" + filePointer + "-"); final int status = fileSystem.getClient().executeMethod(getMethod); if (status != HttpURLConnection.HTTP_PARTIAL && status != HttpURLConnection.HTTP_OK) { throw new FileSystemException("vfs.provider.http/get-range.error", fileObject.getName(),
fileObject.setupMethod(getMethod); getMethod.setRequestHeader("Range", "bytes=" + filePointer + "-"); final int status = fileSystem.getClient().executeMethod(getMethod); if (status != HttpURLConnection.HTTP_PARTIAL && status != HttpURLConnection.HTTP_OK) { throw new FileSystemException("vfs.provider.http/get-range.error", fileObject.getName(),