Giter Site home page Giter Site logo

android-httprequest's Introduction

HttpRequest

A Java based HttpRequest/Response library. This is currently only tested on the Android platform, but should work generally on any Java platform.

Why did I create this library? Mainly because I got tired of what was out there... Libraries that limit you in so many ways, or provide ugly API, or have bugs with encoding the multipart entities (like apache...). And one of the other reasons was that I just had to have a large request that does not fill up the device's memory, but prepares on disk and streams out to the connection.

I do not have the time yet for documentation, but it should be pretty self explanatory how to use this library. You have the HttpRequest class which, well, represents the HTTP request... You pass in parameters of any kind, headers, multi-parts, etc. and fire the connection. You can use the getResponse function synchronously on any thread you wish (except the UI thread!), or you can use the getResponseAsync which will internally use the AsyncTask mechanism.

Features:

  • Taking streams as request body or as multi-parts
  • Chunked encoding mode
  • Large requests will be created on disk first, to prevent wasting memory. (Content-Length must be calculated exactly, and so many libraries hold the whole request in memory and then calculate the length...)
  • Many helper functions to do stuff with the request and response.
  • Taking params with many types
  • Encoding Bitmap params
  • Adding files as parts without loading them to memory
  • Tracking progress of both request and response
  • Option to execute on a specific executor to prevent blocking the single Async thread
  • The HttpResponse class to wrap the response
  • HttpResponse will take care of caching the response to disk first if you work with getResponseAsync (or call prebuffer())
  • The connection is abortable at any stage of request of response
  • Most functions in HttpRequest are chainable

I strongly encourage getting involved in this project to make it better!

Have fun and a good luck with your projects!

Usage sample

TODO: :-)

Dependency

Download from Maven Central (.aar)

or

	dependencies {
    	compile 'com.github.danielgindi:httprequest:1.2.0'
	}

License

All the code here is under MIT license. Which means you could do virtually anything with the code. I will appreciate it very much if you keep an attribution where appropriate.

The MIT License (MIT)

Copyright (c) 2013 Daniel Cohen Gindi ([email protected])

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.

android-httprequest's People

Contributors

danielgindi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

android-httprequest's Issues

Sample?

Looks a great library

Any sample would be helpful
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.