The documentation for [Ignition][1] is rather sparse. I’m looking at the documentation for the HTTP classes, such as link here, but I’m confused.
My current code looks something like this (sanitized version):
client = AndroidHttpClient.newInstance(MyConstants.USER_AGENT);
String url = SaveConstants.MY_URL;
url += "?" + MyConstants.MY_PARAMETER + "=" + parameterValue;
HttpGet request = new HttpGet(url);
InputStream contentStream = null;
try {
HttpContext httpContext = new BasicHttpContext();
HttpResponse response = client.execute(request, httpContext);
contentStream = response.getEntity().getContent();
String content = Util.inputStreamToString(contentStream);
}
How can I change this over to use the Ignition classes? I have two problems:
- I don’t see how to initialize or use IgnitedHttpRequest. There are no constructors and no documentation that seems to explain the use of this class.
- Can IgnitedHttpRequest use GET requests, or only POST?
Use the IgnitedHttp class : link
So,
Will return IgnitedHttpRequest object that you can call the send() method on.
See for more info on IgnitedHttpRequest : link
This send() will return an IgnitedHttpResponse object that you can call the getResponseBodyAsString().
See for more info on IgnitedHttpResponse :
link
All in all,
Is the answer to your first question. Your 2nd question’s answer is that IgnitedHttp also has methods for posts, puts, etc.
here is the sample activity that does a lot of what you may want to do too : https://github.com/mttkay/ignition/blob/master/ignition-support/ignition-support-samples/src/com/github/ignition/samples/support/IgnitedHttpSampleActivity.java
Enjoy using the best piece of code I’ve found.