public IRemoteFileSystemRequest sendBrowseRequest(IFileID directoryOrFileId, IRemoteFileSystemListener listener) throws RemoteFileSystemException { Assert.isNotNull(directoryOrFileId); Assert.isNotNull(listener); URL url; try { url = directoryOrFileId.getURL(); } catch (final MalformedURLException e) { throw new RemoteFileSystemException(NLS.bind("Exception creating URL for {0}", directoryOrFileId)); //$NON-NLS-1$ } HttpClientFileSystemBrowser browser = new HttpClientFileSystemBrowser(new DefaultHttpClient(), directoryOrFileId, listener, url, connectContext, proxy); return browser.sendBrowseRequest(); }
public void cancel() { HttpClientFileSystemBrowser.this.cancel(); } }
protected Proxy getECFProxy() { return getProxy(); }
protected void runRequest() throws Exception { Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, this.getClass(), "runRequest"); //$NON-NLS-1$ setupProxies(); setupAuthentication(urlString); if (ntlmProxyFound && !hasForceNTLMProxyOption()) throw new BrowseFileTransferException("HttpClient Provider is not configured to support NTLM proxy authentication.", HttpClientOptions.NTLM_PROXY_RESPONSE_CODE); //$NON-NLS-1$ lastModified = getLastModifiedTimeFromHeader(); } else if (code == HttpURLConnection.HTTP_NOT_FOUND) { throw new BrowseFileTransferException(NLS.bind("File not found: {0}", urlString), code); //$NON-NLS-1$
protected void cancel() { if (isCanceled()) { return; // break job cancel recursion } setCanceled(getException()); super.cancel(); if (headMethod != null) { if (!headMethod.isAborted()) { headMethod.abort(); } } if (connectingSockets != null) { // Change for preventing CME from bug // https://bugs.eclipse.org/bugs/show_bug.cgi?id=430704 connectingSockets.closeSockets(); } }
protected Credentials getNTLMCredentials(Proxy lp) { if (hasForceNTLMProxyOption()) return HttpClientRetrieveFileTransfer.createNTLMCredentials(lp); return null; }
protected void setupAuthentication(String urlString) throws UnsupportedCallbackException, IOException { Credentials credentials = null; if (username == null) { credentials = getFileRequestCredentials(); } if (credentials != null && username != null) { final AuthScope authScope = new AuthScope(HttpClientRetrieveFileTransfer.getHostFromURL(urlString), HttpClientRetrieveFileTransfer.getPortFromURL(urlString), AuthScope.ANY_REALM); Trace.trace(Activator.PLUGIN_ID, "browse credentials=" + credentials); //$NON-NLS-1$ httpClient.getCredentialsProvider().setCredentials(authScope, credentials); } }
protected void cleanUp() { clearProxy(); super.cleanUp(); }
/** * @param directoryOrFileID * @param listener * @since 5.0 */ public HttpClientFileSystemBrowser(DefaultHttpClient httpClient, IFileID directoryOrFileID, IRemoteFileSystemListener listener, URL directoryOrFileURL, IConnectContext connectContext, Proxy proxy) { super(directoryOrFileID, listener, directoryOrFileURL, connectContext, proxy); Assert.isNotNull(httpClient); this.httpClient = httpClient; this.httpClient.setCredentialsProvider(new HttpClientProxyCredentialProvider() { protected Proxy getECFProxy() { return getProxy(); } protected Credentials getNTLMCredentials(Proxy lp) { if (hasForceNTLMProxyOption()) return HttpClientRetrieveFileTransfer.createNTLMCredentials(lp); return null; } }); this.proxyHelper = new JREProxyHelper(); this.connectingSockets = new ConnectingSocketMonitor(1); prepareAuth(); }
protected void runRequest() throws Exception { Trace.entering(Activator.PLUGIN_ID, DebugOptions.METHODS_ENTERING, this.getClass(), "runRequest"); //$NON-NLS-1$ setupProxies(); setupAuthentication(urlString); if (ntlmProxyFound && !hasForceNTLMProxyOption()) throw new BrowseFileTransferException("HttpClient Provider is not configured to support NTLM proxy authentication.", HttpClientOptions.NTLM_PROXY_RESPONSE_CODE); //$NON-NLS-1$ lastModified = getLastModifiedTimeFromHeader(); } else if (code == HttpURLConnection.HTTP_NOT_FOUND) { throw new BrowseFileTransferException(NLS.bind("File not found: {0}", urlString), code); //$NON-NLS-1$
protected void cancel() { if (isCanceled()) { return; // break job cancel recursion } setCanceled(getException()); super.cancel(); if (headMethod != null) { if (!headMethod.isAborted()) { headMethod.abort(); } } if (connectingSockets != null) { // Change for preventing CME from bug // https://bugs.eclipse.org/bugs/show_bug.cgi?id=430704 connectingSockets.closeSockets(); } }
protected Credentials getNTLMCredentials(Proxy lp) { if (hasForceNTLMProxyOption()) return HttpClientRetrieveFileTransfer.createNTLMCredentials(lp); return null; }
protected void setupAuthentication(String urlString) throws UnsupportedCallbackException, IOException { Credentials credentials = null; if (username == null) { credentials = getFileRequestCredentials(); } if (credentials != null && username != null) { final AuthScope authScope = new AuthScope(HttpClientRetrieveFileTransfer.getHostFromURL(urlString), HttpClientRetrieveFileTransfer.getPortFromURL(urlString), AuthScope.ANY_REALM); Trace.trace(Activator.PLUGIN_ID, "browse credentials=" + credentials); //$NON-NLS-1$ httpClient.getCredentialsProvider().setCredentials(authScope, credentials); } }
protected void cleanUp() { clearProxy(); super.cleanUp(); }
/** * @param httpClient http client * @param directoryOrFileID directory or file id * @param listener listener * @param directoryOrFileURL directory or file id * @param connectContext connect context * @param proxy proxy * @since 5.0 */ public HttpClientFileSystemBrowser(DefaultHttpClient httpClient, IFileID directoryOrFileID, IRemoteFileSystemListener listener, URL directoryOrFileURL, IConnectContext connectContext, Proxy proxy) { super(directoryOrFileID, listener, directoryOrFileURL, connectContext, proxy); Assert.isNotNull(httpClient); this.httpClient = httpClient; this.httpClient.setCredentialsProvider(new HttpClientProxyCredentialProvider() { protected Proxy getECFProxy() { return getProxy(); } protected Credentials getNTLMCredentials(Proxy lp) { if (hasForceNTLMProxyOption()) return HttpClientRetrieveFileTransfer.createNTLMCredentials(lp); return null; } }); this.proxyHelper = new JREProxyHelper(); this.connectingSockets = new ConnectingSocketMonitor(1); prepareAuth(); }
public IRemoteFileSystemRequest sendBrowseRequest(IFileID directoryOrFileId, IRemoteFileSystemListener listener) throws RemoteFileSystemException { Assert.isNotNull(directoryOrFileId); Assert.isNotNull(listener); URL url; try { url = directoryOrFileId.getURL(); } catch (final MalformedURLException e) { throw new RemoteFileSystemException(NLS.bind("Exception creating URL for {0}", directoryOrFileId)); //$NON-NLS-1$ } HttpClientFileSystemBrowser browser = new HttpClientFileSystemBrowser(new SNIAwareHttpClient(), directoryOrFileId, listener, url, connectContext, proxy); return browser.sendBrowseRequest(); }
protected Proxy getECFProxy() { return getProxy(); }
public void cancel() { HttpClientFileSystemBrowser.this.cancel(); } }