com.todoroo.andlib.service
Class HttpRestClient
java.lang.Object
com.todoroo.andlib.service.HttpRestClient
- All Implemented Interfaces:
- RestClient
public class HttpRestClient
- extends java.lang.Object
- implements RestClient
RestClient allows Android to consume web requests.
Portions by Praeda:
http://senior.ceng.metu.edu.tr/2009/praeda/2009/01/11/a-simple
-restful-client-at-android/
- Author:
- Tim Su
Method Summary |
java.lang.String |
get(java.lang.String url)
Issue an HTTP GET for the given URL, return the response |
java.lang.String |
post(java.lang.String url,
org.apache.http.HttpEntity data)
Issue an HTTP POST for the given URL, return the response |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HttpRestClient
public HttpRestClient()
HttpRestClient
public HttpRestClient(int timeout)
get
public java.lang.String get(java.lang.String url)
throws java.io.IOException
- Issue an HTTP GET for the given URL, return the response
- Specified by:
get
in interface RestClient
- Parameters:
url
- url with url-encoded params
- Returns:
- response, or null if there was no response
- Throws:
java.io.IOException
post
public java.lang.String post(java.lang.String url,
org.apache.http.HttpEntity data)
throws java.io.IOException
- Issue an HTTP POST for the given URL, return the response
- Specified by:
post
in interface RestClient
- Parameters:
url
- data
- url-encoded data
- Throws:
java.io.IOException