chits

chita

License

License

GroupId

GroupId

com.clouway.http
ArtifactId

ArtifactId

chita
Last Version

Last Version

1.4
Release Date

Release Date

Type

Type

jar
Description

Description

chits
chita
Source Code Management

Source Code Management

https://github.com/clouway/chita

Download chita

How to add to project

<!-- https://jarcasting.com/artifacts/com.clouway.http/chita/ -->
<dependency>
    <groupId>com.clouway.http</groupId>
    <artifactId>chita</artifactId>
    <version>1.4</version>
</dependency>
// https://jarcasting.com/artifacts/com.clouway.http/chita/
implementation 'com.clouway.http:chita:1.4'
// https://jarcasting.com/artifacts/com.clouway.http/chita/
implementation ("com.clouway.http:chita:1.4")
'com.clouway.http:chita:jar:1.4'
<dependency org="com.clouway.http" name="chita" rev="1.4">
  <artifact name="chita" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.clouway.http', module='chita', version='1.4')
)
libraryDependencies += "com.clouway.http" % "chita" % "1.4"
[com.clouway.http/chita "1.4"]

Dependencies

compile (3)

Group / Artifact Type Version
com.google.inject : guice jar 3.0
javax.inject : javax.inject jar
com.google.guava : guava jar 27.1-jre

test (7)

Group / Artifact Type Version
junit : junit jar 4.11
org.jmock : jmock jar 2.6.0
org.jmock : jmock-junit4 jar 2.6.0
org.hamcrest : hamcrest-core jar 1.3
org.hamcrest : hamcrest-library jar 1.3
org.mortbay.jetty : jetty jar 6.1.18
com.google.code.gson : gson jar 2.3.1

Project Modules

There are no modules declared in this project.

CHITA

####Clouway Http Intelligent Transport Api

Join the chat at https://gitter.im/clouway/chita

The library represent a wrapper of the java.net.HttpURLConnection class. The main goal is to represent a builder style for construction of http requests and sending different objects by POST/GET/PUT/DELETE method using Sitebricks-like Transport.

Example:

GET

HttpRequest request = httpRequest(new TargetUrl("abv.bg")).build();
HttpClient chitaClient = new HttpClient();// in most cases chitaClient should be injected
HttpResponse response = chitaClient.execute(request);

POST

TargetUrl targetUrl = new TargetUrl("http://telcong.com", "/test/address");
HttpRequest request = httpRequest(targetUrl).post(person).as(GsonTransport.class).build();
HttpClient chitaClient = new HttpClient();// in most cases chitaClient should be injected
HttpResponse response = chitaClient.execute(request);

PUT with parameterized url

TargetUrl targetUrl = TargetUrl.urlTemplate("http://telcong.com", "/test/address/:address").setValue("address", "Veliko Turnovo").build();
HttpRequest request = httpRequest(targetUrl).put(person).as(GsonTransport.class).build();
HttpClient chitaClient = new HttpClient();// in most cases chitaClient should be injected
HttpResponse response = chitaClient.execute(request);

DELETE with parameterized url

TargetUrl targetUrl = TargetUrl.urlTemplate("http://telcong.com", "/test/device/:deviceId").setValue("deviceId", "12345").build();
HttpRequest request = httpRequest(targetUrl).delete().build();
HttpClient chitaClient = new HttpClient();// in most cases chitaClient should be injected
HttpResponse response = chitaClient.execute(request);

Also there is a way to read an object from the response or the whole response as byte array.

Result reply = response.read(Result.class).as(GsonTransport.class);
...
byte[] reply = response.readBytes();
The api works successfully with http and https, also is fully compatible with the Google App Engine platform.
com.clouway.http

clouWay ood

Versions

Version
1.4
1.2