|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.microedition.midlet.MIDlet
example.http.HttpView
public class HttpView
An example MIDlet to fetch a page using an HttpConnection. Refer to the startApp, pauseApp, and destroyApp methods so see how it handles each requested transition.
Field Summary | |
---|---|
(package private) javax.microedition.lcdui.Command |
aboutCommand
user interface command to request copyright information. |
(package private) javax.microedition.lcdui.Alert |
alert
user interface alert component. |
(package private) javax.microedition.lcdui.Command |
backCommand
user interface command to return back to previous screen. |
(package private) javax.microedition.lcdui.Command |
cancelCommand
user interface command to cancel the current screen. |
(package private) javax.microedition.lcdui.TextBox |
content
user interface text box for the contents of the fetched URL. |
(package private) javax.microedition.lcdui.Display |
display
current display. |
(package private) javax.microedition.lcdui.Command |
errorsCommand
user interface command to display errors from current request. |
(package private) javax.microedition.lcdui.Form |
errorsForm
form to display exceptions |
(package private) javax.microedition.lcdui.Command |
exitCommand
user interface command for indicating Exit request. |
(package private) javax.microedition.lcdui.Command |
getCommand
user interface command to request an HTTP GET transaction. |
(package private) javax.microedition.lcdui.Command |
headCommand
user interface command to request an HTTP HEAD transaction. |
(package private) javax.microedition.lcdui.Form |
headerForm
user interface screen for HTTP headers |
(package private) javax.microedition.lcdui.Command |
headersCommand
user interface command to request current HTTP headers. |
(package private) javax.microedition.lcdui.Command |
helpCommand
user interface command to display help message. |
(package private) javax.microedition.lcdui.Command |
newURLCommand
user interface command to enter a new URL |
(package private) javax.microedition.lcdui.Command |
okCommand
user interface command to confirm current screen. |
(package private) javax.microedition.lcdui.Command |
postCommand
user interface command to request an HTTP POST transaction. |
(package private) javax.microedition.lcdui.Form |
progressForm
user interface form to hold progress results. |
(package private) javax.microedition.lcdui.Gauge |
progressGauge
user interface progress indicator. |
(package private) javax.microedition.lcdui.Command |
reloadCommand
user interface command for indicating a page reload request. |
(package private) javax.microedition.lcdui.Command |
removeURLCommand
user interface command to remove the current URL |
(package private) javax.microedition.lcdui.Command |
requestCommand
current HTTP request type - GET, HEAD, or POST |
(package private) javax.microedition.lcdui.Form |
requestForm
form to display request including parsing |
(package private) javax.microedition.lcdui.Command |
requestsCommand
user interface command to display current HTTP request headers. |
(package private) java.lang.Thread |
thread
instance of a thread for asynchronous networking and user interface. |
(package private) java.lang.String |
url
current requested url. |
(package private) javax.microedition.lcdui.TextBox |
urlbox
data entry text box for inputting URLs |
(package private) javax.microedition.lcdui.List |
urlList
user interface component containing a list of URLs |
(package private) java.util.Vector |
urls
array of current URLs |
Constructor Summary | |
---|---|
HttpView()
initialize the MIDlet with the current display object. |
Method Summary | |
---|---|
(package private) void |
cleanUp(javax.microedition.io.HttpConnection conn,
java.io.InputStream input,
java.io.OutputStream output)
Clean up all objects used by the HttpConnection. |
(package private) void |
clearForm(javax.microedition.lcdui.Form form)
Clear out all items in a Form. |
void |
commandAction(javax.microedition.lcdui.Command c,
javax.microedition.lcdui.Displayable s)
Respond to commands, including exit |
void |
destroyApp(boolean unconditional)
Destroy must cleanup everything. |
(package private) void |
genErrorsForm(java.lang.String s,
java.lang.Throwable ex)
Set the Alert to the exception message and display it. |
(package private) void |
genHeaderForm(javax.microedition.io.HttpConnection c)
Generate and fill in the Form with the header fields. |
(package private) void |
genProgressForm(java.lang.String name,
java.lang.String url)
Generate the options form with URL title and progress gauge. |
(package private) void |
genRequestForm(javax.microedition.io.HttpConnection c)
Generate the form with the request attributes and values. |
(package private) javax.microedition.io.HttpConnection |
handleRedirects(javax.microedition.io.HttpConnection c)
Check for redirect response codes and handle the redirect by getting the new location and opening a new connection to it. |
void |
pauseApp()
Pause signals the thread to stop by clearing the thread field. |
void |
run()
Fetch the specified url in a separate thread and update the progress bar as it goes. |
(package private) void |
setConfig(javax.microedition.io.HttpConnection c)
Add request properties for the configuration, profiles, and locale of this system. |
(package private) void |
setupList()
Check the attributes in the descriptor that identify url's and titles and initialize the lists of urls and urlList. |
(package private) void |
showAlert(java.lang.String s,
javax.microedition.lcdui.Screen next)
Set the alert string and display it. |
void |
startApp()
Start creates the thread to do the timing. |
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 |
---|
javax.microedition.lcdui.Command exitCommand
javax.microedition.lcdui.Command reloadCommand
javax.microedition.lcdui.Command headCommand
javax.microedition.lcdui.Command postCommand
javax.microedition.lcdui.Command getCommand
javax.microedition.lcdui.Command aboutCommand
javax.microedition.lcdui.Command cancelCommand
javax.microedition.lcdui.Command backCommand
javax.microedition.lcdui.Command headersCommand
javax.microedition.lcdui.Command requestsCommand
javax.microedition.lcdui.Command errorsCommand
javax.microedition.lcdui.Command newURLCommand
javax.microedition.lcdui.Command removeURLCommand
javax.microedition.lcdui.Command okCommand
javax.microedition.lcdui.Command helpCommand
javax.microedition.lcdui.List urlList
java.util.Vector urls
javax.microedition.lcdui.Alert alert
javax.microedition.lcdui.TextBox content
javax.microedition.lcdui.Display display
java.lang.Thread thread
java.lang.String url
javax.microedition.lcdui.Command requestCommand
javax.microedition.lcdui.Form progressForm
javax.microedition.lcdui.Gauge progressGauge
javax.microedition.lcdui.Form headerForm
javax.microedition.lcdui.Form requestForm
javax.microedition.lcdui.Form errorsForm
javax.microedition.lcdui.TextBox urlbox
Constructor Detail |
---|
public HttpView()
Method Detail |
---|
public void startApp()
startApp
in class javax.microedition.midlet.MIDlet
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 a forced shutdown was requestedvoid setupList()
The attributes are named "ViewTitle-n" and "ViewURL-n". The value "n" must start at "1" and increment by 1.
public void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable s)
commandAction
in interface javax.microedition.lcdui.CommandListener
c
- user interface command requesteds
- screen object initiating the requestpublic void run()
run
in interface java.lang.Runnable
void cleanUp(javax.microedition.io.HttpConnection conn, java.io.InputStream input, java.io.OutputStream output)
conn
- the HttpConnectioninput
- the InputStream of the HttpConnection, may be null
if it's not yet opened.output
- the OutputStream the HttpConnection, may be null
if it's not yet opened.javax.microedition.io.HttpConnection handleRedirects(javax.microedition.io.HttpConnection c) throws java.io.IOException
c
- the initial HttpConnection
java.io.IOException
void setConfig(javax.microedition.io.HttpConnection c) throws java.io.IOException
c
- current HttpConnection to receive user agent header
java.io.IOException
void genHeaderForm(javax.microedition.io.HttpConnection c) throws java.io.IOException
c
- the open connection with the result headers.
java.io.IOException
void genRequestForm(javax.microedition.io.HttpConnection c) throws java.io.IOException
c
- the open connection with the request headers.
java.io.IOException
void genProgressForm(java.lang.String name, java.lang.String url)
name
- the title of the URL to be loaded.url
- label for the progress gaugevoid genErrorsForm(java.lang.String s, java.lang.Throwable ex)
s
- the Exception title stringex
- the Exceptionvoid showAlert(java.lang.String s, javax.microedition.lcdui.Screen next)
s
- the error messagenext
- the screen to be shown after the Alert.void clearForm(javax.microedition.lcdui.Form form)
form
- the Form to clear.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |