public class Web extends AndroidNonvisibleComponent implements Component
form
ACCELEROMETER_SENSITIVITY_MODERATE, ACCELEROMETER_SENSITIVITY_STRONG, ACCELEROMETER_SENSITIVITY_WEAK, ALIGNMENT_CENTER, ALIGNMENT_NORMAL, ALIGNMENT_OPPOSITE, ASSET_DIRECTORY, BUTTON_SHAPE_DEFAULT, BUTTON_SHAPE_OVAL, BUTTON_SHAPE_RECT, BUTTON_SHAPE_ROUNDED, COLOR_BLACK, COLOR_BLUE, COLOR_CYAN, COLOR_DEFAULT, COLOR_DKGRAY, COLOR_GRAY, COLOR_GREEN, COLOR_LTGRAY, COLOR_MAGENTA, COLOR_NONE, COLOR_ORANGE, COLOR_PINK, COLOR_RED, COLOR_WHITE, COLOR_YELLOW, DEFAULT_VALUE_COLOR_BLACK, DEFAULT_VALUE_COLOR_BLUE, DEFAULT_VALUE_COLOR_CYAN, DEFAULT_VALUE_COLOR_DEFAULT, DEFAULT_VALUE_COLOR_DKGRAY, DEFAULT_VALUE_COLOR_GRAY, DEFAULT_VALUE_COLOR_GREEN, DEFAULT_VALUE_COLOR_LTGRAY, DEFAULT_VALUE_COLOR_MAGENTA, DEFAULT_VALUE_COLOR_NONE, DEFAULT_VALUE_COLOR_ORANGE, DEFAULT_VALUE_COLOR_PINK, DEFAULT_VALUE_COLOR_RED, DEFAULT_VALUE_COLOR_WHITE, DEFAULT_VALUE_COLOR_YELLOW, DIRECTION_EAST, DIRECTION_MAX, DIRECTION_MIN, DIRECTION_NONE, DIRECTION_NORTH, DIRECTION_NORTHEAST, DIRECTION_NORTHWEST, DIRECTION_SOUTH, DIRECTION_SOUTHEAST, DIRECTION_SOUTHWEST, DIRECTION_WEST, FONT_DEFAULT_SIZE, LAYOUT_ORIENTATION_HORIZONTAL, LAYOUT_ORIENTATION_VERTICAL, LENGTH_FILL_PARENT, LENGTH_PREFERRED, LENGTH_UNKNOWN, SLIDER_MAX_VALUE, SLIDER_MIN_VALUE, SLIDER_THUMB_VALUE, TOAST_LENGTH_LONG, TOAST_LENGTH_SHORT, TYPEFACE_DEFAULT, TYPEFACE_MONOSPACE, TYPEFACE_SANSSERIF, TYPEFACE_SERIF
Modifier | Constructor and Description |
---|---|
protected |
Web()
This constructor is for testing purposes only.
|
|
Web(ComponentContainer container)
Creates a new Web component.
|
Modifier and Type | Method and Description |
---|---|
boolean |
AllowCookies()
Returns whether cookies should be allowed
|
void |
AllowCookies(boolean allowCookies)
Specifies whether cookies should be allowed
|
java.lang.String |
BuildRequestData(YailList list)
Converts a list of two-element sublists, representing name and value pairs, to a
string formatted as application/x-www-form-urlencoded media type, suitable to pass to
PostText.
|
void |
ClearCookies() |
void |
Delete()
Performs an HTTP DELETE request using the Url property and retrieves the
response.
If the SaveResponse property is true, the response will be saved in a file and the GotFile event will be triggered. |
void |
Get()
Performs an HTTP GET request using the Url property and retrieves the
response.
If the SaveResponse property is true, the response will be saved in a file and the GotFile event will be triggered. |
void |
GotFile(java.lang.String url,
int responseCode,
java.lang.String responseType,
java.lang.String fileName)
Event indicating that a request has finished.
|
void |
GotText(java.lang.String url,
int responseCode,
java.lang.String responseType,
java.lang.String responseContent)
Event indicating that a request has finished.
|
java.lang.String |
HtmlTextDecode(java.lang.String htmlText)
Decodes the given HTML text value.
|
java.lang.Object |
JsonTextDecode(java.lang.String jsonText)
Decodes the given JSON encoded value to produce a corresponding AppInventor value.
|
void |
PostFile(java.lang.String path)
Performs an HTTP POST request using the Url property and data from the
specified file, and retrieves the response.
|
void |
PostText(java.lang.String text)
Performs an HTTP POST request using the Url property and the specified text.
|
void |
PostTextWithEncoding(java.lang.String text,
java.lang.String encoding)
Performs an HTTP POST request using the Url property and the specified text.
|
void |
PutFile(java.lang.String path)
Performs an HTTP PUT request using the Url property and data from the
specified file, and retrieves the response.
|
void |
PutText(java.lang.String text)
Performs an HTTP PUT request using the Url property and the specified text.
|
void |
PutTextWithEncoding(java.lang.String text,
java.lang.String encoding)
Performs an HTTP PUT request using the Url property and the specified text.
|
YailList |
RequestHeaders()
Returns the request headers.
|
void |
RequestHeaders(YailList list)
Sets the request headers.
|
java.lang.String |
ResponseFileName()
Returns the name of the file where the response should be saved.
|
void |
ResponseFileName(java.lang.String responseFileName)
Specifies the name of the file where the response should be saved.
|
boolean |
SaveResponse()
Returns whether the response should be saved in a file.
|
void |
SaveResponse(boolean saveResponse)
Specifies whether the response should be saved in a file.
|
java.lang.String |
UriEncode(java.lang.String text)
Encodes the given text value so that it can be used in a URL.
|
java.lang.String |
Url()
Returns the URL.
|
void |
Url(java.lang.String url)
Specifies the URL.
|
java.lang.Object |
XMLTextDecode(java.lang.String XmlText)
Decodes the given XML string to produce a list structure.
|
getDispatchDelegate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDispatchDelegate
public Web(ComponentContainer container)
container
- the Form that this component is contained in.protected Web()
public java.lang.String Url()
public void Url(java.lang.String url)
public YailList RequestHeaders()
public void RequestHeaders(YailList list)
list
- a list of two-element sublists, each representing a header name and valuespublic boolean AllowCookies()
public void AllowCookies(boolean allowCookies)
public boolean SaveResponse()
public void SaveResponse(boolean saveResponse)
public java.lang.String ResponseFileName()
public void ResponseFileName(java.lang.String responseFileName)
public void ClearCookies()
public void Get()
public void PostText(java.lang.String text)
text
- the text data for the POST requestpublic void PostTextWithEncoding(java.lang.String text, java.lang.String encoding)
text
- the text data for the POST requestencoding
- the character encoding to use when sending the text. If
encoding is empty or null, UTF-8 encoding will be used.public void PostFile(java.lang.String path)
path
- the path of the file for the POST requestpublic void PutText(java.lang.String text)
text
- the text data for the PUT requestpublic void PutTextWithEncoding(java.lang.String text, java.lang.String encoding)
text
- the text data for the PUT requestencoding
- the character encoding to use when sending the text. If
encoding is empty or null, UTF-8 encoding will be used.public void PutFile(java.lang.String path)
path
- the path of the file for the PUT requestpublic void Delete()
public void GotText(java.lang.String url, int responseCode, java.lang.String responseType, java.lang.String responseContent)
url
- the URL used for the requestresponseCode
- the response code from the serverresponseType
- the mime type of the responseresponseContent
- the response content from the serverpublic void GotFile(java.lang.String url, int responseCode, java.lang.String responseType, java.lang.String fileName)
url
- the URL used for the requestresponseCode
- the response code from the serverresponseType
- the mime type of the responsefileName
- the full path name of the saved filepublic java.lang.String BuildRequestData(YailList list)
list
- a list of two-element sublists representing name and value pairspublic java.lang.String UriEncode(java.lang.String text)
text
- the text to encodepublic java.lang.Object JsonTextDecode(java.lang.String jsonText)
jsonText
- the JSON text to decodepublic java.lang.Object XMLTextDecode(java.lang.String XmlText)
jsonText
- the JSON text to decodepublic java.lang.String HtmlTextDecode(java.lang.String htmlText)
HTML Character Entities such as &, <, >, ', and " are changed to &, <, >, ', and ". Entities such as hhhh, and nnnn are changed to the appropriate characters.
htmlText
- the HTML text to decode