FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [View Raw Code]   [Original HTTPS Page]

Android-HttpClient/Tophe-Ion at master · githubcs/Android-HttpClient · GitHub

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

#TOPHE Ion module

A module for TopheClient that uses Ion as the HTTP engine. You can also construct an HttpEngineIon yourself and use the requestBuilder field to do additional work on the Ion request, like using the query to load a picture.

##Sample Code

###Setup the Ion engine

Make Tophe use Ion by default for all HTTP requests. The Ion engine doesn't support HttpStream output so the default engine will be used in that case.

IonClient.setup(context);

###Get the Ion request to retrieve a Bitmap

BaseHttpRequest<InputStream, ServerException> request = new BaseHttpRequest.Builder<InputStream, ServerException>()
        .setUrl("https://ton.twitter.com/dmpics/somepic51215423.jpg")
        .setResponseHandler(new BaseResponseHandler<InputStream>(XferTransformResponseInputStream.INSTANCE))
        .setErrorParser(BodyToServerException.INSTANCE)
        .build();

IonHttpEngineFactory.getInstance(context);
HttpEngineIon<InputStream, ServerException> ionRequest = (HttpEngineIon<InputStream, ServerException>)
        new HttpEngine.Builder<InputStream, ServerException>()
        .setTypedRequest(request)
        .build();

ionRequest.requestBuilder.intoImageView(imageView);

Download

Download the latest JAR or grab via Maven

<dependency>
  <groupId>co.tophe</groupId>
  <artifactId>tophe-ion</artifactId>
  <version>1.0.0</version>
</dependency>

or Gradle:

compile 'co.tophe:tophe-ion:1.0.0'

License

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Back | FazBrowse Home | New Git URL