Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.
/ FoxHttp Public archive

FoxHttp provides a fast and easy http client for Java and Android.

License

Notifications You must be signed in to change notification settings

viascom/FoxHttp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FoxHttp

FoxHttp provides a fast and easy http client for Java and Android.

Maven central 204 KB project GroundWork license Apache 2.0 coverage


Build-Status & Metrics

master Build Status
develop Build Status

Request against httpbin which was installed on localhost:
get post Basic-Auth Post-Parsing

Functions

  • HTTP / HTTPS method support
  • GET, POST, PUT, DELETE, OPTIONS, HEAD, TRACE request support
  • Real logging of request and response
  • Builders for fast and easy request execution
  • Automatic request and response parsing
  • Integrated Object, URL-Encoded & Multipart-Body support
  • Custom and predefined interceptors
  • Powerful authorization strategy
  • Lambda support
  • Fully customizable cookie store
  • Host and SSL trust strategy
  • Easy proxy strategy
  • Android support
  • GroundWork ServiceResult support
  • Faster than other HttpClient-Frameworks (such as httpComponents,okhttp)
  • Gson and XStream support
  • OAuth2 support
  • Annotation application structure
  • URL placeholder support
  • Advanced cache strategy (coming soon)
  • GroundWork Server-Security support (coming soon)
  • HAL support (coming soon)

Quick Start:

Dependency

maven

<dependency>
    <groupId>ch.viascom.groundwork</groupId>
    <artifactId>foxhttp</artifactId>
    <version>1.3.6</version>
</dependency>

gradle

compile 'ch.viascom.groundwork:foxhttp:1.3.6'

Send a request with JSON response deserialization

To run this example you need to add Gson to your dependency management!

// Define Http-Client and set parser for serialization/deserialization
FoxHttpClient foxHttpClient = new FoxHttpClientBuilder(new GsonParser()).build();

// Define a System-Out logger on DEBUG level
foxHttpClient.setFoxHttpLogger(new SystemOutFoxHttpLogger(true, "FoxHttp-Logger", FoxHttpLoggerLevel.DEBUG));

// Create and Execute GET Request
FoxHttpResponse response = new FoxHttpRequestBuilder("http://httpbin.org/get?search=Viascom", RequestType.GET, foxHttpClient).buildAndExecute();

// Deserialization response
GetResponse object = response.getParsedBody(GetResponse.class);

// Print result
System.out.println("Parsed-Output: " + object);

To deserialize the response you need the following model:

public class GetResponse implements Serializable {

    public HashMap<String, String> args;
    public HashMap<String, String> headers;
    public String origin;
    public String url;

    @Override
    public String toString() {
        return "GetResponse{" +
                "args=" + args +
                ", headers=" + headers +
                ", origin='" + origin + '\'' +
                ", url='" + url + '\'' +
                '}';
    }
}

Licence

Apache License, Version 2.0, January 2004

About

FoxHttp provides a fast and easy http client for Java and Android.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages