| |
|
| example.http.HttpExample
HttpExample | public class HttpExample extends MIDlet implements Runnable(Code) | | sample http example MIDlet.
|
Field Summary | |
StringBuffer | buffer string buffer for assembling HTTP requests. | Form | form user interface screen for displaying progress gauge. | Gauge | gauge user interface component for displaying network progress. | String | url |
Constructor Summary | |
public | HttpExample() Create the progress form and gauge. |
form | Form form(Code) | | user interface screen for displaying progress gauge.
|
gauge | Gauge gauge(Code) | | user interface component for displaying network progress.
|
HttpExample | public HttpExample()(Code) | | Create the progress form and gauge.
This program is not interactive, it will exit when done.
|
destroyApp | public void destroyApp(boolean unconditional)(Code) | | Destroy must cleanup everything. The thread is signaled
to stop and no result is produced.
Parameters: unconditional - true if forced shutdown. |
getViaContentConnection | void getViaContentConnection(String url) throws IOException(Code) | | Simple read of a url using ContentConnection.
No HTTP specific behavior is needed or used.
Connector.open is used to open url and a ContentConnection is returned.
The ContentConnection may be able to provide the length.
If the length is available, it is used to read the data in bulk.
From the StreamConnection the InputStream is opened.
It is used to read every character until end of file (-1).
If an exception is thrown the connection and stream is closed.
Parameters: url - the URL to process. |
getViaHttpConnection | void getViaHttpConnection(String url) throws IOException(Code) | | Read the HTTP headers and the data using HttpConnection.
Check the response code to insure successful retrieval.
Connector.open is used to open url and a HttpConnection is returned.
The HTTP headers are read and processed.
If the length is available, it is used to read the data in bulk.
From the HttpConnection the InputStream is opened.
It is used to read every character until end of file (-1).
If an exception is thrown the connection and stream is closed.
Parameters: url - the URL to process. |
getViaStreamConnection | void getViaStreamConnection(String url) throws IOException(Code) | | Simple read of a url using StreamConnection.
No HTTP specific behavior is needed or used.
Connector.open is used to open url and a StreamConnection is returned.
From the StreamConnection the InputStream is opened.
It is used to read every character until end of file (-1).
If an exception is thrown the connection and stream is closed.
Parameters: url - the URL to process. |
pauseApp | public void pauseApp()(Code) | | Pause, discontinue with the http tests
|
postViaHttpConnection | void postViaHttpConnection(String url) throws IOException(Code) | | Post a request with some headers and content to the server and
process the headers and content.
Connector.open is used to open url and a HttpConnection is returned.
The request method is set to POST and request headers set.
A simple command is written and flushed.
The HTTP headers are read and processed.
If the length is available, it is used to read the data in bulk.
From the StreamConnection the InputStream is opened.
It is used to read every character until end of file (-1).
If an exception is thrown the connection and stream is closed.
Parameters: url - the URL to process. |
process | void process(byte b)(Code) | | Process the data one character at a time.
Parameters: b - one byte of data |
process | void process(byte[] b)(Code) | | Process the data from the array.
Parameters: b - an array of bytes. |
processType | void processType(String type)(Code) | | Process the type.
Parameters: type - that type |
run | public void run()(Code) | | Run the examples.
|
setRequestHeaders | void setRequestHeaders(HttpConnection c) throws IOException(Code) | | Add request properties for the configuration, profiles,
and locale of this system.
Parameters: c - current HttpConnection to apply request headers |
startApp | public void startApp()(Code) | | Start a thread to run the examples.
|
|
|
|