Package org.eclipse.ecf.filetransfer

Examples of org.eclipse.ecf.filetransfer.BrowseFileTransferException


    final IRemoteFile[] remoteFiles = event.getRemoteFiles();
    assertNull(remoteFiles);
    Exception e = event.getException();
    assertNotNull(e);
    if (e instanceof BrowseFileTransferException) {
      BrowseFileTransferException ifte = (BrowseFileTransferException) e;
      assertTrue(ifte.getCause() instanceof UnknownHostException);
    } else fail("Event exception is not instance of BrowseFileTransferException");
  }
View Full Code Here


      // Check for NTLM proxy in response headers
      // This check is to deal with bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=252002
      boolean ntlmProxyFound = NTLMProxyDetector.detectNTLMProxy(httpContext);
      if (ntlmProxyFound && !hasForceNTLMProxyOption())
        throw new BrowseFileTransferException("HttpClient Provider is not configured to support NTLM proxy authentication.", HttpClientOptions.NTLM_PROXY_RESPONSE_CODE); //$NON-NLS-1$

      if (NTLMProxyDetector.detectSPNEGOProxy(httpContext))
        throw new BrowseFileTransferException("HttpClient Provider does not support the use of SPNEGO proxy authentication."); //$NON-NLS-1$

      if (code == HttpURLConnection.HTTP_OK) {
        Header contentLength = httpResponse.getLastHeader(CONTENT_LENGTH_HEADER);
        if (contentLength != null) {
          fileLength = Integer.parseInt(contentLength.getValue());
        }

        lastModified = getLastModifiedTimeFromHeader();
      } else if (code == HttpURLConnection.HTTP_NOT_FOUND) {
        throw new BrowseFileTransferException(NLS.bind("File not found: {0}", urlString), code); //$NON-NLS-1$
      } else if (code == HttpURLConnection.HTTP_UNAUTHORIZED) {
        throw new BrowseFileTransferException(Messages.HttpClientRetrieveFileTransfer_Unauthorized, code);
      } else if (code == HttpURLConnection.HTTP_FORBIDDEN) {
        throw new BrowseFileTransferException("Forbidden", code); //$NON-NLS-1$
      } else if (code == HttpURLConnection.HTTP_PROXY_AUTH) {
        throw new BrowseFileTransferException(Messages.HttpClientRetrieveFileTransfer_Proxy_Auth_Required, code);
      } else {
        throw new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE, new Integer(code)), code);
      }
      remoteFiles = new IRemoteFile[1];
      remoteFiles[0] = new URLRemoteFile(lastModified, fileLength, fileID);
    } catch (Exception e) {
      Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, this.getClass(), "runRequest", e); //$NON-NLS-1$
      BrowseFileTransferException ex = (BrowseFileTransferException) ((e instanceof BrowseFileTransferException) ? e : new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT, urlString), e, code));
      throw ex;
    }
  }
View Full Code Here

      boolean ntlmProxyFound = NTLMProxyDetector.detectNTLMProxy(httpContext);
      if (ntlmProxyFound && !hasForceNTLMProxyOption())
        throw new IncomingFileTransferException("HttpClient Provider is not configured to support NTLM proxy authentication.", HttpClientOptions.NTLM_PROXY_RESPONSE_CODE); //$NON-NLS-1$

      if (NTLMProxyDetector.detectSPNEGOProxy(httpContext))
        throw new BrowseFileTransferException("HttpClient Provider does not support the use of SPNEGO proxy authentication."); //$NON-NLS-1$

      if (code == HttpURLConnection.HTTP_PARTIAL || code == HttpURLConnection.HTTP_OK) {
        getResponseHeaderValues();
        setInputStream(httpResponse.getEntity().getContent());
        fireReceiveStartEvent();
View Full Code Here

      code = getResponseCode(urlConnection);
      if (isHTTP()) {
        if (code == HttpURLConnection.HTTP_OK) {
          // do nothing
        } else if (code == HttpURLConnection.HTTP_NOT_FOUND) {
          throw new BrowseFileTransferException(NLS.bind("File not found: {0}", directoryOrFile.toString()), code); //$NON-NLS-1$
        } else if (code == HttpURLConnection.HTTP_UNAUTHORIZED) {
          throw new BrowseFileTransferException("Unauthorized", code); //$NON-NLS-1$
        } else if (code == HttpURLConnection.HTTP_FORBIDDEN) {
          throw new BrowseFileTransferException("Forbidden", code); //$NON-NLS-1$
        } else if (code == HttpURLConnection.HTTP_PROXY_AUTH) {
          throw new BrowseFileTransferException("Proxy auth required", code); //$NON-NLS-1$
        } else {
          throw new BrowseFileTransferException(NLS.bind("General connection error with response code={0}", new Integer(code)), code); //$NON-NLS-1$
        }
      }
      remoteFiles = new IRemoteFile[1];
      remoteFiles[0] = new URLRemoteFile(urlConnection.getLastModified(), urlConnection.getContentLength(), fileID);
    } catch (final FileNotFoundException e) {
      throw new IncomingFileTransferException(NLS.bind("File not found: {0}", directoryOrFile.toString()), 404); //$NON-NLS-1$
    } catch (Exception e) {
      Exception except = (e instanceof BrowseFileTransferException) ? e : new BrowseFileTransferException(NLS.bind("Could not connect to {0}", directoryOrFile), e, code); //$NON-NLS-1$
      throw except;
    }
  }
View Full Code Here

      // Check for NTLM proxy in response headers
      // This check is to deal with bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=252002
      boolean ntlmProxyFound = NTLMProxyDetector.detectNTLMProxy(headMethod);
      if (ntlmProxyFound && !hasForceNTLMProxyOption())
        throw new BrowseFileTransferException("HttpClient Provider is not configured to support NTLM proxy authentication.", HttpClientOptions.NTLM_PROXY_RESPONSE_CODE); //$NON-NLS-1$

      if (code == HttpURLConnection.HTTP_OK) {
        fileLength = headMethod.getResponseContentLength();
        lastModified = getLastModifiedTimeFromHeader();
      } else if (code == HttpURLConnection.HTTP_NOT_FOUND) {
        throw new BrowseFileTransferException(NLS.bind("File not found: {0}", urlString), code); //$NON-NLS-1$
      } else if (code == HttpURLConnection.HTTP_UNAUTHORIZED) {
        throw new BrowseFileTransferException(Messages.HttpClientRetrieveFileTransfer_Unauthorized, code);
      } else if (code == HttpURLConnection.HTTP_FORBIDDEN) {
        throw new BrowseFileTransferException("Forbidden", code); //$NON-NLS-1$
      } else if (code == HttpURLConnection.HTTP_PROXY_AUTH) {
        throw new BrowseFileTransferException(Messages.HttpClientRetrieveFileTransfer_Proxy_Auth_Required, code);
      } else {
        throw new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_ERROR_GENERAL_RESPONSE_CODE, new Integer(code)), code);
      }
      remoteFiles = new IRemoteFile[1];
      remoteFiles[0] = new URLRemoteFile(lastModified, fileLength, fileID);
    } catch (Exception e) {
      Trace.throwing(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_THROWING, this.getClass(), "runRequest", e); //$NON-NLS-1$
      BrowseFileTransferException ex = (BrowseFileTransferException) ((e instanceof BrowseFileTransferException) ? e : new BrowseFileTransferException(NLS.bind(Messages.HttpClientRetrieveFileTransfer_EXCEPTION_COULD_NOT_CONNECT, urlString), e, code));
      throw ex;
    } finally {
      headMethod.releaseConnection();
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.filetransfer.BrowseFileTransferException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.