Skip to content
This repository has been archived by the owner on Sep 4, 2018. It is now read-only.
/ tisana4j Public archive

Yet another (but missing) simple JSON/XML HTTP RESTful client library for Java

License

Notifications You must be signed in to change notification settings

ClouDesire/tisana4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tisana4j

CircleCI Requirements Status maven latest release

Yet another (but missing for us) simple RESTful client Java library, that support both JSON and XML REST API, based on the great Apache HttpClient.

We begun writing this library when coding the first integration tests for ClouDesire backend.

Nowadays there are a lot of alternatives, like OkHttp, Unirest, but we are still in love with this.

Features

  • Internally use Apache HttpClient
  • Support for GET, POST, PUT, PATCH, DELETE methods
  • Standard java.net.URL to supply request URL and GET parameters
  • De/Serilization of Request/Response bodies via supplied .class (via Jackson and JAXB)
  • Errors always mapped to a RestException hierarchy
  • Ability to define a custom ExceptionTranslator to map your Exceptions or custom error handling

Usage

<dependency>
    <groupId>com.cloudesire</groupId>
    <artifactId>tisana4j</artifactId>
    <version>0.0.24</version>
</dependency>

Example

More examples in the integration tests package.

public class Test {
	private static class NetworkAddress {
		private String ip;

		public String getIp() {
			return ip;
		}

		public void setIp(String ip) {
			this.ip = ip;
		}
	}

	public static void main(String[] args) throws Exception {
		// default Client: no credentials
		RestClient client = new RestClient();
		NetworkAddress testClass = client.get(new URL("http://ip.jsontest.com/"), NetworkAddress.class);

		System.out.println("YOUR IP:" + testClass.getIp());
	}
}