/** * {@inheritDoc} */ @Override public boolean getPropertyAsFeature(String name) { Boolean v = (Boolean)getProperties().get(name); return (v != null) ? v : false; } }
/** * {@inheritDoc} */ @Override public boolean getPropertyAsFeature(String name) { Boolean v = (Boolean)getProperties().get(name); return (v != null) ? v : false; } }
public APIUtil(String projectId, String accessKey, String secretKey, String proxyURI, String proxyUsername, String proxyPassword) { this.accessKey = accessKey; this.secretKey = secretKey; this.projectId = projectId; if (proxyURI != null) { this.config.getProperties().put("com.sun.jersey.impl.client.httpclient.proxyURI", proxyURI); } if (proxyUsername != null) { this.config.getProperties().put("com.sun.jersey.impl.client.httpclient.proxyUsername", proxyUsername); } if (proxyPassword != null) { this.config.getProperties().put("com.sun.jersey.impl.client.httpclient.proxyPassword", proxyPassword); } this.featuresUrl = "https://bdd.assertthat.com/rest/api/1/project/" + projectId + "/features"; this.reportUrl = "https://bdd.assertthat.com/rest/api/1/project/" + projectId + "/report"; }
DefaultClientConfig config = new DefaultClientConfig(); config.getProperties().put(URLConnectionClientHandler.PROPERTY_HTTP_URL_CONNECTION _SET_METHOD_WORKAROUND, true); Client c = Client.create(config); WebResource r = c.resource("http://google.com"); String reponse = r.method("FOOBAR", String.class);
/** * @param connectionConfig config provided * @return initiated jersey client - ready to talk to ise * * @throws GeneralSecurityException in case when insecure certificate hack fails */ public static Client createIseClient(final ConnectionConfig connectionConfig) throws GeneralSecurityException { final DefaultClientConfig clientConfig = new DefaultClientConfig(); clientConfig.getProperties() .put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, connectionConfig.getConnectionTimeout()); clientConfig.getProperties() .put(ClientConfig.PROPERTY_READ_TIMEOUT, connectionConfig.getReadTimeout()); hackInsecureCertificate(clientConfig); return Client.create(clientConfig); }
public Client hostIgnoringClient() { try { SSLContext sslcontext = SSLContext.getInstance( "TLS" ); sslcontext.init( null, null, null ); DefaultClientConfig config = new DefaultClientConfig(); Map<String, Object> properties = config.getProperties(); HTTPSProperties httpsProperties = new HTTPSProperties( new HostnameVerifier() { @Override public boolean verify( String s, SSLSession sslSession ) { return true; } }, sslcontext ); properties.put( HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, httpsProperties ); config.getClasses().add( JacksonJsonProvider.class ); return Client.create( config ); } catch ( KeyManagementException | NoSuchAlgorithmException e ) { throw new RuntimeException( e ); } }
System.err.println("failed to initialize SSL context"); conf.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new HTTPSProperties(null, ctx)); HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
public static URLConnectionClientHandler getClientConnectionHandler(DefaultClientConfig config, org.apache.commons.configuration.Configuration clientConfig, String doAsUser, final UserGroupInformation ugi) { config.getProperties().put(URLConnectionClientHandler.PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND, true); Configuration conf = new Configuration(); conf.addResource(conf.get(SSLFactory.SSL_CLIENT_CONF_KEY, SecurityProperties.SSL_CLIENT_PROPERTIES));
public static URLConnectionClientHandler getClientConnectionHandler(DefaultClientConfig config, org.apache.commons.configuration.Configuration clientConfig, String doAsUser, final UserGroupInformation ugi) { config.getProperties().put(URLConnectionClientHandler.PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND, true); Configuration conf = new Configuration(); conf.addResource(conf.get(SSLFactory.SSL_CLIENT_CONF_KEY, SecurityProperties.SSL_CLIENT_PROPERTIES));
public static URLConnectionClientHandler getClientConnectionHandler(DefaultClientConfig config, org.apache.commons.configuration.Configuration clientConfig, String doAsUser, final UserGroupInformation ugi) { config.getProperties().put(URLConnectionClientHandler.PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND, true); Configuration conf = new Configuration(); conf.addResource(conf.get(SSLFactory.SSL_CLIENT_CONF_KEY, SecurityProperties.SSL_CLIENT_PROPERTIES));
sslContext.init(null, new javax.net.ssl.TrustManager[]{secureRestClientTrustManager}, null); defaultClientConfig .getProperties() .put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES, new HTTPSProperties(getHostnameVerifier(), sslContext)); client = Client.create(defaultClientConfig);