Java 类org.apache.commons.httpclient.HttpClientError 实例源码

项目:lib-commons-httpclient    文件:DigestScheme.java   
/**
 * Creates a random cnonce value based on the current time.
 * 
 * @return The cnonce value as String.
 * @throws HttpClientError if MD5 algorithm is not supported.
 */
public static String createCnonce() {
    LOG.trace("enter DigestScheme.createCnonce()");

    String cnonce;
    final String digAlg = "MD5";
    MessageDigest md5Helper;

    try {
        md5Helper = MessageDigest.getInstance(digAlg);
    } catch (NoSuchAlgorithmException e) {
        throw new HttpClientError(
          "Unsupported algorithm in HTTP Digest authentication: "
           + digAlg);
    }

    cnonce = Long.toString(System.currentTimeMillis());
    cnonce = encode(md5Helper.digest(EncodingUtil.getAsciiBytes(cnonce)));

    return cnonce;
}
项目:gluu    文件:EasyCASSLProtocolSocketFactory.java   
protected SSLContext createEasySSLContext(ApplicationConfiguration applicationConfiguration) {
    try {

        String password = applicationConfiguration.getCaCertsPassphrase();
        char[] passphrase = null;
        if (password != null) {
            passphrase = StringEncrypter.defaultInstance().decrypt(password, cryptoConfigurationSalt).toCharArray();
        }
        KeyStore cacerts = null;
        String cacertsFN = applicationConfiguration.getCaCertsLocation();
        if (cacertsFN != null) {
            cacerts = KeyStore.getInstance(KeyStore.getDefaultType());
            FileInputStream cacertsFile = new FileInputStream(cacertsFN);
            cacerts.load(cacertsFile, passphrase);
            cacertsFile.close();
        }

        SSLContext context = SSLContext.getInstance("SSL");
        context.init(null, new TrustManager[] { new EasyX509TrustManager(cacerts) }, null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:flex-blazeds    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext()
{
    try
    {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(null,
                new TrustManager[]{new EasyX509TrustManager(null)},
                null);
        return context;
    }
    catch (Exception e)
    {
        if (Trace.ssl)
        {
            Trace.trace(e.getMessage());
        }
        throw new HttpClientError(e.toString());
    }
}
项目:oxTrust    文件:EasyCASSLProtocolSocketFactory.java   
protected SSLContext createEasySSLContext(AppConfiguration appConfiguration) {
    try {

        String password = appConfiguration.getCaCertsPassphrase();
        char[] passphrase = null;
        if (password != null) {
            passphrase = encryptionService.decrypt(password).toCharArray();
        }
        KeyStore cacerts = null;
        String cacertsFN = appConfiguration.getCaCertsLocation();
        if (cacertsFN != null) {
            cacerts = KeyStore.getInstance(KeyStore.getDefaultType());
            FileInputStream cacertsFile = new FileInputStream(cacertsFN);
            cacerts.load(cacertsFile, passphrase);
            cacertsFile.close();
        }

        SSLContext context = SSLContext.getInstance("SSL");
        context.init(null, new TrustManager[] { new EasyX509TrustManager(cacerts) }, null);
        return context;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:swingx-ws    文件:SSLProtocolSocketFactory.java   
private SSLContext getSSLContext(String host) {
    if (this.sslcontext == null) {
        try {
            TrustManager tm = null;
            if (level == Session.SecurityLevel.Low) {
                tm = new LowSecurityX509TrustManager(null);
            } else if (level == Session.SecurityLevel.Medium) {
                tm = new MediumSecurityX509TrustManager(host, handler, null);
            } else {
                tm = new HighSecurityX509TrustManager(null);
            }
            SSLContext context = SSLContext.getInstance("SSL");
            context.init(
              null, 
              new TrustManager[] {tm}, 
              null);
            this.sslcontext = context;
        } catch (Exception e) {
            throw new HttpClientError(e.toString());
        }
    }
    return this.sslcontext;
}
项目:httpclient3-ntml    文件:DigestScheme.java   
/**
 * Creates a random cnonce value based on the current time.
 * 
 * @return The cnonce value as String.
 * @throws HttpClientError if MD5 algorithm is not supported.
 */
public static String createCnonce() {
    LOG.trace("enter DigestScheme.createCnonce()");

    String cnonce;
    final String digAlg = "MD5";
    MessageDigest md5Helper;

    try {
        md5Helper = MessageDigest.getInstance(digAlg);
    } catch (NoSuchAlgorithmException e) {
        throw new HttpClientError(
          "Unsupported algorithm in HTTP Digest authentication: "
           + digAlg);
    }

    cnonce = Long.toString(System.currentTimeMillis());
    cnonce = encode(md5Helper.digest(EncodingUtil.getAsciiBytes(cnonce)));

    return cnonce;
}
项目:griffon-swingx-ws-plugin    文件:SSLProtocolSocketFactory.java   
private SSLContext getSSLContext(String host) {
    if (this.sslcontext == null) {
        try {
            TrustManager tm = null;
            if (level == Session.SecurityLevel.Low) {
                tm = new LowSecurityX509TrustManager(null);
            } else if (level == Session.SecurityLevel.Medium) {
                tm = new MediumSecurityX509TrustManager(host, handler, null);
            } else {
                tm = new HighSecurityX509TrustManager(null);
            }
            SSLContext context = SSLContext.getInstance("SSL");
            context.init(
              null, 
              new TrustManager[] {tm}, 
              null);
            this.sslcontext = context;
        } catch (Exception e) {
            throw new HttpClientError(e.toString());
        }
    }
    return this.sslcontext;
}
项目:lib-commons-httpclient    文件:EncodingUtil.java   
/**
 * Converts the specified string to byte array of ASCII characters.
 *
 * @param data the string to be encoded
 * @return The string as a byte array.
 * 
 * @since 3.0
 */
public static byte[] getAsciiBytes(final String data) {

    if (data == null) {
        throw new IllegalArgumentException("Parameter may not be null");
    }

    try {
        return data.getBytes("US-ASCII");
    } catch (UnsupportedEncodingException e) {
        throw new HttpClientError("HttpClient requires ASCII support");
    }
}
项目:lib-commons-httpclient    文件:EncodingUtil.java   
/**
 * Converts the byte array of ASCII characters to a string. This method is
 * to be used when decoding content of HTTP elements (such as response
 * headers)
 *
 * @param data the byte array to be encoded
 * @param offset the index of the first byte to encode
 * @param length the number of bytes to encode 
 * @return The string representation of the byte array
 * 
 * @since 3.0
 */
public static String getAsciiString(final byte[] data, int offset, int length) {

    if (data == null) {
        throw new IllegalArgumentException("Parameter may not be null");
    }

    try {
        return new String(data, offset, length, "US-ASCII");
    } catch (UnsupportedEncodingException e) {
        throw new HttpClientError("HttpClient requires ASCII support");
    }
}
项目:lib-commons-httpclient    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
          null, 
          new TrustManager[] {new EasyX509TrustManager(null)}, 
          null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:GeoCrawler    文件:DummySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
  try {
    SSLContext context = SSLContext.getInstance("SSL");
    context.init(null,
        new TrustManager[] { new DummyX509TrustManager(null) }, null);
    return context;
  } catch (Exception e) {
    if (LOG.isErrorEnabled()) {
      LOG.error(e.getMessage(), e);
    }
    throw new HttpClientError(e.toString());
  }
}
项目:MyVirtualDirectory    文件:GetSSLCert.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
          null, 
          new TrustManager[] {new EasyX509TrustManager(null)}, 
          null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:MyVirtualDirectory    文件:GetSSLCert.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
          null, 
          new TrustManager[] {new EasyX509TrustManager(null)}, 
          null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:http4e    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
          null, 
          new TrustManager[] {new EasyX509TrustManager(null)}, 
          null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:Tank    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
                null,
                new TrustManager[] { new EasyX509TrustManager(null) },
                null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:Tank    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
                null,
                new TrustManager[] { new EasyX509TrustManager(null) },
                null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:anthelion    文件:DummySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
  try {
    SSLContext context = SSLContext.getInstance("SSL");
    context.init(null, new TrustManager[] { new DummyX509TrustManager(null) }, null);
    return context;
  } catch (Exception e) {
    if (LOG.isErrorEnabled()) { LOG.error(e.getMessage(), e); }
    throw new HttpClientError(e.toString());
  }
}
项目:sakai    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
          null, 
          new TrustManager[] {new EasyX509TrustManager(null)}, 
          null);
        return context;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:jpublish    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
                null,
                new TrustManager[]{new EasyX509TrustManager(null)},
                null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:kylin    文件:DefaultSslProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("TLS");
        context.init(null, new TrustManager[] { new DefaultX509TrustManager(null) }, null);

        return context;
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:wechat4j    文件:MySecureProtocolSocketFactory.java   
/**
 *
 * @return
 */
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(null, new TrustManager[] { new MyX509TrustManager() }, null);
        return context;
    } catch (Exception e) {
        throw new HttpClientError(e.toString());
    }
}
项目:cargo-wso2-container    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext()
{
    try
    {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(null, new TrustManager[] {new EasyX509TrustManager(null)}, null);
        return context;
    }
    catch (Exception e)
    {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:olat    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(null, new TrustManager[] { new EasyX509TrustManager(null) }, null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:olat    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(null, new TrustManager[] { new EasyX509TrustManager(null) }, null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:st-toolset    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
                null,
                new TrustManager[]{new EasyX509TrustManager(null)},
                null);
        return context;
    } catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:CardDAVSyncOutlook    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
          null, 
          new TrustManager[] {new EasyX509TrustManager(null)}, 
          null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:carbon-registry    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
          null, 
          new TrustManager[] {new EasyX509TrustManager(null)}, 
          null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:Kylin    文件:DefaultSslProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("TLS");
        context.init(null, new TrustManager[] { new DefaultX509TrustManager(null) }, null);

        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:Kylin    文件:DefaultSslProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("TLS");
        context.init(null, new TrustManager[] { new DefaultX509TrustManager(null) }, null);

        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:g3server    文件:SSLProtocolSocketFactory.java   
private SSLContext createSSLContext(String host) {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
                null,
                new TrustManager[]{new ClearspaceX509TrustManager(host, manager.getProperties(), SSLConfig.gets2sTrustStore())},
                null);
        return context;
    } catch (Exception e) {
        Log.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:oxCore    文件:EasySSLProtocolSocketFactory.java   
protected SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(null, new TrustManager[] { new EasyX509TrustManager(null) }, null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:todopl    文件:EwsSSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
          null, 
          new TrustManager[] {new EwsX509TrustManager(null, trustManager)}, 
          null);
        return context;
    } catch (Exception e) {
        System.out.println(e.getMessage()+e);
        throw new HttpClientError(e.toString());
    }
}
项目:sakai    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
          null, 
          new TrustManager[] {new EasyX509TrustManager(null)}, 
          null);
        return context;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:openfire    文件:SSLProtocolSocketFactory.java   
private SSLContext createSSLContext(String host) {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
                null,
                new TrustManager[]{new ClearspaceX509TrustManager(host, manager.getProperties(), SSLConfig.gets2sTrustStore())},
                null);
        return context;
    } catch (Exception e) {
        Log.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:cloudstack    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLUtils.getSSLContext();
        context.init(null, new TrustManager[] {new EasyX509TrustManager(null)}, null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:po-mylyn-integration    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
          null,
          new TrustManager[] {new EasyX509TrustManager(null)},
          null);
        return context;
    } catch (Exception e) {
        throw new HttpClientError(e.toString());
    }
}
项目:httpclient3-ntml    文件:EncodingUtil.java   
/**
 * Converts the specified string to byte array of ASCII characters.
 *
 * @param data the string to be encoded
 * @return The string as a byte array.
 * 
 * @since 3.0
 */
public static byte[] getAsciiBytes(final String data) {

    if (data == null) {
        throw new IllegalArgumentException("Parameter may not be null");
    }

    try {
        return data.getBytes("US-ASCII");
    } catch (UnsupportedEncodingException e) {
        throw new HttpClientError("HttpClient requires ASCII support");
    }
}
项目:httpclient3-ntml    文件:EncodingUtil.java   
/**
 * Converts the byte array of ASCII characters to a string. This method is
 * to be used when decoding content of HTTP elements (such as response
 * headers)
 *
 * @param data the byte array to be encoded
 * @param offset the index of the first byte to encode
 * @param length the number of bytes to encode 
 * @return The string representation of the byte array
 * 
 * @since 3.0
 */
public static String getAsciiString(final byte[] data, int offset, int length) {

    if (data == null) {
        throw new IllegalArgumentException("Parameter may not be null");
    }

    try {
        return new String(data, offset, length, "US-ASCII");
    } catch (UnsupportedEncodingException e) {
        throw new HttpClientError("HttpClient requires ASCII support");
    }
}
项目:httpclient3-ntml    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
          null, 
          new TrustManager[] {new EasyX509TrustManager(null)}, 
          null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}
项目:ablaze    文件:EasySSLProtocolSocketFactory.java   
private static SSLContext createEasySSLContext() {
    try {
        SSLContext context = SSLContext.getInstance("SSL");
        context.init(
          null, 
          new TrustManager[] {new EasyX509TrustManager(null)}, 
          null);
        return context;
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
        throw new HttpClientError(e.toString());
    }
}