AI2 Component  (Version nb184)
com.google.appinventor.components.runtime.util.WebServiceUtil Class Reference

Public Member Functions

void postCommandReturningArray (String serviceURL, String commandName, List< NameValuePair > params, final AsyncCallbackPair< JSONArray > callback)
 
void postCommandReturningObject (final String serviceURL, final String commandName, List< NameValuePair > params, final AsyncCallbackPair< JSONObject > callback)
 
void postCommand (final String serviceURL, final String commandName, List< NameValuePair > params, AsyncCallbackPair< String > callback)
 

Static Public Member Functions

static WebServiceUtil getInstance ()
 

Detailed Description

These commands post to the Web and get responses that are assumed to be JSON structures: a string, a JSON array, or a JSON object. It's up to the caller of these routines to decide which version to use, and to decode the response.

Author
halab.nosp@m.elso.nosp@m.n@goo.nosp@m.gle..nosp@m.com (Hal Abelson)

Definition at line 45 of file WebServiceUtil.java.

Member Function Documentation

◆ getInstance()

static WebServiceUtil com.google.appinventor.components.runtime.util.WebServiceUtil.getInstance ( )
static

Returns the one WebServiceUtil instance

Returns
the one WebServiceUtil instance

Definition at line 59 of file WebServiceUtil.java.

◆ postCommand()

void com.google.appinventor.components.runtime.util.WebServiceUtil.postCommand ( final String  serviceURL,
final String  commandName,
List< NameValuePair >  params,
AsyncCallbackPair< String >  callback 
)

Make a post command to serviceURL with params and return the response String.

Parameters
serviceURLThe URL of the server to post to.
commandNameThe path to the command.
paramsA List of NameValuePairs to send as parameters with the post.
callbackA callback function that accepts a String on success.

Definition at line 147 of file WebServiceUtil.java.

◆ postCommandReturningArray()

void com.google.appinventor.components.runtime.util.WebServiceUtil.postCommandReturningArray ( String  serviceURL,
String  commandName,
List< NameValuePair >  params,
final AsyncCallbackPair< JSONArray >  callback 
)

Make a post command to serviceURL with params and return the response String as a JSON array.

Parameters
serviceURLThe URL of the server to post to.
commandNameThe path to the command.
paramsA List of NameValuePairs to send as parameters with the post.
callbackA callback function that accepts a JSON array on success.

Definition at line 91 of file WebServiceUtil.java.

◆ postCommandReturningObject()

void com.google.appinventor.components.runtime.util.WebServiceUtil.postCommandReturningObject ( final String  serviceURL,
final String  commandName,
List< NameValuePair >  params,
final AsyncCallbackPair< JSONObject >  callback 
)

Make a post command to serviceURL with paramaterss and return the response String as a JSON object.

Parameters
serviceURLThe URL of the server to post to.
commandNameThe path to the command.
paramsA List of NameValuePairs to send as parameters with the post.
callbackA callback function that accepts a JSON object on success.

Definition at line 119 of file WebServiceUtil.java.


The documentation for this class was generated from the following file: