|
DCT Lightfoot v3 API specification | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.dctl.j2me.io.BaseConnection
|
+--com.dctl.j2me.io.http.BaseHttpConnection
|
+--com.dctl.j2me.io.http.Connection
An http connection allows information to be retrieved from a web server. Connections are created by using the Connector open method. e.g. Connector.open("http://www.javasoft.com/index.html");
| Field Summary |
| Fields inherited from class com.dctl.j2me.io.http.BaseHttpConnection |
ACCEPT_PROPERTY, ACCEPT_VALUE, ASCTIME, CHUNKED_ENCODING, CLOSED, COLON_SPACE, COMMA, CONNECTION_CLOSE, CONNECTION_KEEP_ALIVE, CONNECTION_PROPERTY, CONTENT_ENCODING_PROPERTY, CONTENT_LENGTH_PROPERTY, CONTENT_TYPE_PROPERTY, CRLF, DASH, DATE_PROPERTY, DAY, EXPIRES_PROPERTY, FIELDS, handle, HOST_PROPERTY, HOUR, inputNames, inputProperties, is, LAST_MODIFIED_PROPERTY, method, MIN, MONTH, MONTH_STRING, opens, os, outputProperties, PROTOCOL, RECEIVING, responseCode, responseMessage, RFC1123, RFC850, SEC, SENDING, SETUP, SPACE, state, TRANSFER_ENCODING_PROPERTY, USER_AGENT_PROPERTY, USER_AGENT_VALUE, VERSION, YEAR |
| Fields inherited from class com.dctl.j2me.io.BaseConnection |
protocol |
| Constructor Summary | |
Connection()
Default constructor |
|
Connection(int address,
int port)
Constructor taking an address and port |
|
| Method Summary | |
boolean |
equals(Object obj)
Equals method |
protected java.lang.String |
generateFirstOutput()
Generate the first output line |
long |
getDate()
Get the date header field |
java.lang.String |
getEncoding()
Get the encoding |
long |
getExpiration()
Get the expires header field |
java.lang.String |
getHeaderField(int index)
Get a header field indexed by the index |
java.lang.String |
getHeaderField(java.lang.String name)
Get the header field |
long |
getHeaderFieldDate(java.lang.String name,
long defaultValue)
Get a header field parsed as a date value |
int |
getHeaderFieldInt(java.lang.String name,
int defaultValue)
Get a header field parsed as a number |
java.lang.String |
getHeaderFieldKey(int index)
Get the header field key at the index |
long |
getLastModified()
Get the last modified date |
long |
getLength()
Get the length |
java.lang.String |
getRequestProperty(java.lang.String key)
Get the request property specified by the key |
int |
getResponseCode()
Get the response code |
java.lang.String |
getResponseMessage()
Get the response message |
java.lang.String |
getType()
Get the type |
protected boolean |
handleFirstInput(java.lang.String line)
handle the first input line |
int |
hashcode()
Hashcode method |
protected void |
openConnection()
Open the connection using the values in address, port and parameters |
InputStream |
openInputStream()
Open an input stream |
OutputStream |
openOutputStream()
Open an output stream if it was not already open. |
protected void |
parseResponse()
Parse the response |
void |
recycle()
Recycle the connection |
void |
setParameters(java.lang.String url,
int mode,
boolean timeouts)
Set the URL, mode and timeouts |
void |
setProtocol(ProtocolString protocol)
Set the protocol |
void |
setRequestMethod(java.lang.String method)
Set the request method - only valid until the request has been got |
void |
setRequestProperty(java.lang.String key,
java.lang.String value)
Set the request property for the key. |
| Methods inherited from class com.dctl.j2me.io.http.BaseHttpConnection |
close, getFieldDate, getFieldInt, getFile, getHost, getInputFieldKey, getPort, getProtocol, getQuery, getRef, getRequestMethod, getURL, invalidState, openDataInputStream, openDataOutputStream, parseInput, sendOutput |
| Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.microedition.io.HttpConnection |
getFile, getHost, getPort, getProtocol, getQuery, getRef, getRequestMethod, getURL |
| Methods inherited from interface javax.microedition.io.InputConnection |
openDataInputStream |
| Methods inherited from interface javax.microedition.io.Connection |
close |
| Methods inherited from interface javax.microedition.io.OutputConnection |
openDataOutputStream |
| Constructor Detail |
public Connection()
public Connection(int address,
int port)
address - The address to connect toport - The port to connect to| Method Detail |
protected void openConnection()
throws IOException
openConnection in class BaseHttpConnectionIOException - if there is an error or two connections already
exist to the given internet host address.public int hashcode()
public boolean equals(Object obj)
equals in class Objectobj - The other
public void recycle()
recycle in class BaseHttpConnectionpublic void setProtocol(ProtocolString protocol)
protocol - The protocol
public void setParameters(java.lang.String url,
int mode,
boolean timeouts)
throws IOException
setParameters in class BaseConnectionurl - The URL passed to connector.openmode - The mode passed to connector.open or DEFAULTtimeouts - true if timeout exceptions should occur
IOException - if there is a problem
public void setRequestMethod(java.lang.String method)
throws IOException
setRequestMethod in interface HttpConnectionsetRequestMethod in class BaseHttpConnectionmethod - The request method
IOException - if the request has already been sent or the method is not validprotected final java.lang.String generateFirstOutput()
generateFirstOutput in class BaseHttpConnection
protected final void parseResponse()
throws IOException
IOException - if there is an error
protected boolean handleFirstInput(java.lang.String line)
throws IOException
handleFirstInput in class BaseHttpConnectionline - The first input line
IOException - if the line is incorrect
public void setRequestProperty(java.lang.String key,
java.lang.String value)
throws IOException
setRequestProperty in interface HttpConnectionkey - The keyvalue - The value
IOException - if the state is wrongpublic java.lang.String getRequestProperty(java.lang.String key)
getRequestProperty in interface HttpConnectionkey - The request property to get
public int getResponseCode()
throws IOException
getResponseCode in interface HttpConnectionIOException - if there is an error
public java.lang.String getResponseMessage()
throws IOException
getResponseMessage in interface HttpConnectionIOException - if there is an error
public long getExpiration()
throws IOException
getExpiration in interface HttpConnectionIOException - if there is an error
public long getDate()
throws IOException
getDate in interface HttpConnectionIOException - if there is an error
public long getLastModified()
throws IOException
getLastModified in interface HttpConnectionIOException - if there is an error
public java.lang.String getHeaderField(java.lang.String name)
throws IOException
getHeaderField in interface HttpConnectionname - The name of the header field
IOException - if there is an errorpublic java.lang.String getType()
getType in interface ContentConnectionpublic java.lang.String getEncoding()
getEncoding in interface ContentConnectionpublic long getLength()
getLength in interface ContentConnection
public int getHeaderFieldInt(java.lang.String name,
int defaultValue)
throws IOException
getHeaderFieldInt in interface HttpConnectionname - The name of the fielddefaultValue - The default value to use if the field cannot be
parsed or if it does not exist
IOException - if there is an error
public long getHeaderFieldDate(java.lang.String name,
long defaultValue)
throws IOException
getHeaderFieldDate in interface HttpConnectionname - Thename of the fielddefaultValue - The default value to use if the field cannot be
parsed or if it does not exist
IOException - if there is an error
public java.lang.String getHeaderField(int index)
throws IOException
getHeaderField in interface HttpConnectionindex - The index
IOException - if there is an error
public java.lang.String getHeaderFieldKey(int index)
throws IOException
getHeaderFieldKey in interface HttpConnectionindex - the index
IOException - if there is an error
public InputStream openInputStream()
throws IOException
openInputStream in interface InputConnectionopenInputStream in class BaseHttpConnectionIOException - if there is an error
public OutputStream openOutputStream()
throws IOException
openOutputStream in interface OutputConnectionopenOutputStream in class BaseHttpConnectionIOException - if there is an error
|
DCT Lightfoot v3 API specification | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||