|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.microedition.midlet.MIDlet
example.http.HttpExample
public class HttpExample
sample http example MIDlet.
Field Summary | |
---|---|
(package private) java.lang.StringBuffer |
buffer
string buffer for assembling HTTP requests. |
(package private) javax.microedition.lcdui.Form |
form
user interface screen for displaying progress gauge. |
(package private) javax.microedition.lcdui.Gauge |
gauge
user interface component for displaying network progress. |
(package private) java.lang.String |
url
example URL for HTTP GET |
Constructor Summary | |
---|---|
HttpExample()
Create the progress form and gauge. |
Method Summary | |
---|---|
void |
destroyApp(boolean unconditional)
Destroy must cleanup everything. |
(package private) void |
getViaContentConnection(java.lang.String url)
Simple read of a url using ContentConnection. |
(package private) void |
getViaHttpConnection(java.lang.String url)
Read the HTTP headers and the data using HttpConnection. |
(package private) void |
getViaStreamConnection(java.lang.String url)
Simple read of a url using StreamConnection. |
void |
pauseApp()
Pause, discontinue with the http tests |
(package private) void |
postViaHttpConnection(java.lang.String url)
Post a request with some headers and content to the server and process the headers and content. |
(package private) void |
process(byte b)
Process the data one character at a time. |
(package private) void |
process(byte[] b)
Process the data from the array. |
(package private) void |
processType(java.lang.String type)
Process the type. |
void |
run()
Run the examples. |
(package private) void |
setRequestHeaders(javax.microedition.io.HttpConnection c)
Add request properties for the configuration, profiles, and locale of this system. |
void |
startApp()
Start a thread to run the examples. |
Methods inherited from class javax.microedition.midlet.MIDlet |
---|
checkPermission, getAppProperty, notifyDestroyed, notifyPaused, platformRequest, resumeRequest |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
java.lang.String url
java.lang.StringBuffer buffer
javax.microedition.lcdui.Gauge gauge
javax.microedition.lcdui.Form form
Constructor Detail |
---|
public HttpExample()
Method Detail |
---|
public void startApp()
startApp
in class javax.microedition.midlet.MIDlet
public void run()
run
in interface java.lang.Runnable
public void pauseApp()
pauseApp
in class javax.microedition.midlet.MIDlet
public void destroyApp(boolean unconditional)
destroyApp
in class javax.microedition.midlet.MIDlet
unconditional
- true if forced shutdown.void getViaStreamConnection(java.lang.String url) throws java.io.IOException
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.
url
- the URL to process.
java.io.IOException
void getViaContentConnection(java.lang.String url) throws java.io.IOException
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.
url
- the URL to process.
java.io.IOException
void getViaHttpConnection(java.lang.String url) throws java.io.IOException
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.
url
- the URL to process.
java.io.IOException
void setRequestHeaders(javax.microedition.io.HttpConnection c) throws java.io.IOException
c
- current HttpConnection to apply request headers
java.io.IOException
void postViaHttpConnection(java.lang.String url) throws java.io.IOException
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.
url
- the URL to process.
java.io.IOException
void processType(java.lang.String type)
type
- that typevoid process(byte b)
b
- one byte of datavoid process(byte[] b)
b
- an array of bytes.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |