Skip to content

smartrics/RestClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Simple Java client for REST

The Rest Client offers a simplified interface to an underlying implementation of an HTTP client, specifically geared to operate REST resources.

Maven dependency

From Maven Central

<dependency>
	<groupId>smartrics.restfixture</groupId>
	<artifactId>smartrics-RestClient</artifactId>
	<version>{smartrics.restclient.version}</version>
</dependency>

Getting started

The current implementation of '''RestClient''' wraps Apache HttpClient 3.1.

    org.apache.commons.httpclient.HttpClient = new org.apache.commons.httpclient.HttpClient();
    RestClient client = new RestClientImpl(httpClient);
    client.setBaseUrl("http://mydomain.com:8080/orders");
    RestRequest request = new RestRequest().setMethod(RestRequest.Method.Get).setResource("/resource");
    RestResponse response = client.execute(request);
    String body = response.getBody();
    Header h = response.getHeader("Content-Type");
    // ...

That's it folks!

About

A simple RestClient in java (part of RestFixture)

Resources

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING

Stars

Watchers

Forks

Packages

No packages published

Languages