hubspot / horizon Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
@HiJon89 I would like to switch over to Horizon but I have one thing blocking me. I'm currently using certificates issued by StartSSL and had to add their CA cert to my local keystore. Ideally, I'd like to add my custom keystore to my project and configure the client to use it instead of doing what most people do and ignore SSL altogether by accepting all certs and defeat the purpose of TLS.
Is it possible already? I'd think we need something in HttpConfig to affect the part where we register a Scheme with the connection manager. I think something like this would be great ultimately if we could it through HttpConfig.
char[] kpass = "changeit".toCharArray();
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
File trustFile = new File(Resources.getResource(DefaultSSLSocketFactory.class, "/cacerts").toURI());
ks.load(new FileInputStream(trustFile), kpass);
KeyManagerFactory kmfactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmfactory.init(ks, kpass);
TrustManagerFactory tmfactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmfactory.init(ks);
SSLContext sslcontext = SSLContext.getInstance(TLS);
sslcontext.init(kmfactory.getKeyManagers(), tmfactory.getTrustManagers(), null);
return sslcontext;
@HiJon89 I'm running into a few SocketTimeoutException and I figured I reviewed my RetryStrategy and defaults and I found this: http://dev.bizo.com/2013/04/sensible-defaults-for-apache-httpclient.html just figured I shared it with you.
If the client does reach the MaxPerRoute or the MaxTotal connections, it will block until the connection manager timeout (ClientPNames.CONNMANAGERTIMEOUT) is reached. This timeout controls how long the client will wait for a connection from the connection manager. Fortunately, if this timeout is not set directly, it will default to the connection timeout if that is set, which will prevent the client from queuing up requests indefinitely.
LICENSE.txt missing, under what license is this project distributed ?
Would you be interested in adding this method to HttpRequest.Builder? This is to support a @QueryParam List<String> ids
in Jersey without having to create a variable for the Builder with a for loop to make a request. I guess we'd need this for other primitive types also, but I'd leave that up to you. @HiJon89
public Builder addQueryParam(@Nonnull String name, @Nullable Collection<String> values) {
Preconditions.checkNotNull(values);
for(String value : values) {
addQueryParam(name, value);
}
return this;
}
Here are the two examples:
HttpRequest.Builder builder = HttpRequest.newBuilder().setUrl(baseURL + "/users");
userNames.stream().forEach(u -> builder.addQueryParam("userName", u));
HttpResponse response = client.execute(builder.build());
vs
HttpResponse response = client.execute(HttpRequest
.newBuilder()
.setUrl(baseURL + "/users")
.addQueryParam("userName", userNames);
.build());
I'm using basepom and noticed this warning:
[WARNING] HorizonApache-0.0.11.jar, HorizonCore-0.0.11.jar define 623 overlappping classes:
[WARNING] - org.apache.shaded.http.impl.client.DefaultBackoffStrategy
[WARNING] - org.apache.shaded.http.client.entity.DeflateDecompressingEntity$DeflateStream
[WARNING] - com.hubspot.horizon.HttpRuntimeException
[WARNING] - org.apache.shaded.http.impl.conn.IdleConnectionHandler$TimeValues
[WARNING] - org.apache.shaded.http.impl.conn.SingleClientConnManager$PoolEntry
[WARNING] - org.apache.shaded.commons.codec.binary.BaseNCodecInputStream
[WARNING] - org.apache.shaded.http.client.utils.URIBuilder
[WARNING] - org.apache.shaded.http.conn.ssl.X509HostnameVerifier
[WARNING] - org.apache.shaded.http.client.protocol.RequestAcceptEncoding
[WARNING] - org.apache.shaded.http.ContentTooLongException
[WARNING] - 613 more...
and my dependency tree looks like this:
[INFO] +- com.hubspot:HorizonApache:jar:0.0.11:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] +- com.hubspot:HorizonNing:jar:0.0.11:compile
[INFO] | +- com.hubspot:HorizonCore:jar:0.0.11:compile
[INFO] | \- com.ning:async-http-client:jar:1.8.12:compile
[INFO] | \- io.netty:netty:jar:3.9.2.Final:compile
Any thoughts on how to structure the dependencies on Horizon so I don't get 623 repeated classes?
๐ฉ
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.