In my blog I have introduced about aws-http
library.
Include your maven or gradle project as below:
maven:
<dependency>
<groupId>io.github.rishikeshdarandale</groupId>
<artifactId>aws-http</artifactId>
<version>1.0.1</version>
</dependency>
gradle:
dependencies {
compile 'io.github.rishikeshdarandale:aws-http:1.0.1'
}
A simple use of the library shown below:
MyClass myClassObject = new JdkRequest("https://www.somehost.com")
.method(RequestMethod.GET)
.path("/mypath")
.queryParams("message", "hello*world")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body("{}")
.sign(AwsSignParams("myAccessKey", "MySecretId", "es"))
.execute()
.getAs(MyClass.class);
SNAPSHOT
latest versionOne can find the latest code with SNAPSHOT version in snapshot artifactory
<repositories>
<repository>
<id>oss.sonatype.org</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
The documentation and latest release version is mentioned below:
String
:
String body = new JdkRequest("https://www.somehost.com")
.method(RequestMethod.GET)
.path("/mypath")
.queryParams("message", "hello*world")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body("{}")
.sign(AwsSignParams("myAccessKey", "MySecretId", "es"))
.execute()
.body();
Include the jersey-client
library along with aws-http
library.
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.26</version>
</dependency>
aws-http
library does not includejersey-client
as compile time dependency, thus you need to include it asprovided
scope.
String body = new JerseyRequest("https://www.somehost.com")
.method(RequestMethod.GET)
.path("/mypath")
.queryParams("message", "hello*world")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.body("{}")
.sign(AwsSignParams("myAccessKey", "MySecretId", "es"))
.execute()
.body();