HatcHttp is a very simple and straightforward library for performing HTTP call inside your
Android app. This library is based on Netty
We were facing an issue related with 65k+ method issue. So now this library uses Volley.
1. Based on Java NIO (thanks to netty and asynchttp)
- Asynchronous API calls, runs on a separate thread pool (ExecutorService)
- Uses network library used inside the Android framework.
## What is different ?
### Based on Netty
This version of HatchHttp is based on Netty and leverage the advantage of NIO.
- Add the repository
maven {
url 'https://github.com/RainingClouds/hatchttp_maven_repo/raw/master/'
}
- Add the dependency
compile 'hatchttp:library:1.3.7'
Add following permissions in your AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Example code for getting Google Home Page
HatcHttpRequest.GET("http://www.google.com")
.addHeader("Accept", "text/html")
.execute(new HatcHttpRequestListener() {
@Override
public void onComplete(int status, final String response) {
}
@Override
public void onException(Throwable throwable) {
}
});
If you want encoded json response use HatcHttpJSONListener which has following listener design.
public interface HatcHttpJSONListener {
void onComplete(final int status, final JSONObject response);
void onException(final Throwable throwable);
}
Akshay Deo ([email protected]) RainingClouds Technologies Pvt Ltd
The MIT License (MIT)
Copyright (c) 2014 Akshay Deo Copyright (c) 2014 RainingClouds Technologies Private Limited
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.