KO
|
EN
gitlite — search
Search
#python
#java
#python3
#arduino
#golang
#machine-learning
#rust
#html
#flask
#javascript
#seismology
#nodejs
Horizon
★ 26
Open GitHub ↗
No description available.
Download README (.md)
Explore Similar Repositories
hls-endless
:
HLS server that delivers live streams in a loop. It has four audio/video bitrates and one audio-only.
DynamoUnfold
:
Library for building topology from sets of surfaces and unfolding them using Protogeometry tools in Dynamo
Wordle
:
Generates English-like words
logstash-codec-json
:
No description available.
android-toolbar-with-drawer
:
Android AppCompat toolbar with material design and a menu drawer
// repository documentation
Was this content helpful?
★ 0
(0 ratings)
Select Rating:
★
★
★
★
★
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
Horizon
?
Download (.md)
# Horizon Java HTTP client interfaces designed to make interacting with REST services as user-friendly as possible. Horizon classes use intuitive, fluent APIs and leverage Jackson internally so that reading and writing JSON are first-class citizens. ## Features - Clean, simple interfaces - Designed to work with JSON - GZIP and Snappy support for compression/decompression - Built-in retry functionality with exponential backoff - Free to mix and match synchronous and asynchronous clients ## Usage The HorizonCore module contains all of the interfaces and domain objects. Horizon comes with two implementations, packaged in separate artifacts. The HorizonApache module contains an implementation of the synchronous `HttpClient` interface, built on top of Apache's httpclient 4. The HorizonNing module contains an implementation of both `HttpClient` and `AsyncHttpClient` built on top of org.asynchttpclient.shaded:async-http-client. So if you just want to use the Apache-based client, you would add the following Maven dependency: ```xml <dependency> <groupId>com.hubspot</groupId> <artifactId>HorizonApache</artifactId> <version>0.2.0</version> </dependency> ``` And then you can instantiate a new `HttpClient` by doing `HttpClient httpClient = new ApacheHttpClient();` ## Examples Using the synchronous `HttpClient` to retrieve a single `Widget` by ID: ```java public Widget getById(int id) { HttpRequest request = HttpRequest.newBuilder().setUrl("http://widgets/" + id).build(); // Jackson is used to convert JSON response to Widget object return httpClient.execute(request).getAs(Widget.class); } ``` Updating a widget: ```java public Widget update(Widget widget) { HttpRequest request = HttpRequest.newBuilder() .setMethod(Method.PUT) .setUrl("http://widgets/" + widget.getId()) .setBody(widget) // Jackson is used to convert Widget to JSON .build(); return httpClient.execute(request).getAs(Widget.class); } ```