Simple example showing how to access the xmlstats API using Java
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main
.gitignore
LICENSE
README.md
build.gradle
pom.xml

README.md

Java Example

This is a simple example that accesses the xmlstats API using Java. Example program listings show two ways to create an HTTP request. One uses Apache HttpComponents and the other uses java.net packages. Both examples consume the HTTP response and deserialize the JSON data into a POJO using Jackson.

Requirements

To run this example, you will need JDK 8, either Maven or Gradle, and an xmlstats account.

Getting Started

Clone the repository.

Configure

Specify your API access token and e-mail address in src/main/resources/xmlstats.properties.

Compile

mvn compile

or

gradle build

Run

Using Apache HttpComponents (recommended)
mvn exec:java -Dexec.mainClass=com.xmlstats.example.ExampleApacheHttp

or

gradle run -PmainClass=com.xmlstats.example.ExampleApacheHttp
Using java.net
mvn exec:java -Dexec.mainClass=com.xmlstats.example.ExampleJavaNet

or

gradle run -PmainClass=com.xmlstats.example.ExampleJavaNet