DCT Lightfoot v3 API specification

javax.microedition.io
Interface HttpConnection

All Superinterfaces:
Connection, ContentConnection, InputConnection, OutputConnection, StreamConnection
All Known Implementing Classes:
Connection

public interface HttpConnection
extends ContentConnection

This interface defines an HTTP connection


Field Summary
static java.lang.String GET
          The string for a get method
static java.lang.String HEAD
          The string for a head method
static int HTTP_ACCEPTED
          The request has been accepted for processing but has not been completed
static int HTTP_BAD_GATEWAY
          The server received an invalid response that it was acting as a gateway for
static int HTTP_BAD_METHOD
          The method specified is not allowed
static int HTTP_BAD_REQUEST
          The request could not be understood by the server
static int HTTP_CLIENT_TIMEOUT
          The client did not produce a request within the time that the server was prepared to wait
static int HTTP_CONFLICT
          The server could not complete the request due to a conflict with the current state of the resource
static int HTTP_CREATED
          The request has been fulfilled and resulted in a new resource being created
static int HTTP_ENTITY_TOO_LARGE
          The server cannot process the request because the request is larger than the server can process
static int HTTP_EXPECT_FAILED
          The value in the expect request-header field could not be met by the server
static int HTTP_FORBIDDEN
          The server understood the request but is refusing to fulfill it
static int HTTP_GATEWAY_TIMEOUT
          The server acting as a gateway timedout
static int HTTP_GONE
          The resource is no longer available at the server
static int HTTP_INTERNAL_ERROR
          The server had an internal error
static int HTTP_LENGTH_REQUIRED
          The server needs a content length field
static int HTTP_MOVED_PERM
          The resource has been permanently moved to another location
static int HTTP_MOVED_TEMP
          The resource has been temporarily moved to another location
static int HTTP_MULT_CHOICE
          The resource has been moved to another one of many locations
static int HTTP_NO_CONTENT
          There is no content
static int HTTP_NOT_ACCEPTABLE
          The request is not acceptable to the server
static int HTTP_NOT_AUTHORITATIVE
          The returned entity header is not the definitive information
static int HTTP_NOT_FOUND
          The server has not found anything
static int HTTP_NOT_IMPLEMENTED
          The server does not implement the functionality to fulfill the request
static int HTTP_NOT_MODIFIED
          The server has allowed a get request, but has not modified the document
static int HTTP_OK
          The request has suceeded
static int HTTP_PARTIAL
          The server has fulfilled a partial get request
static int HTTP_PAYMENT_REQUIRED
          Reserved
static int HTTP_PRECON_FAILED
          The precondition of a request header failed
static int HTTP_PROXY_AUTH
          The client must authenticate itself to a proxy
static int HTTP_REQ_TOO_LONG
          The request is too long
static int HTTP_RESET
          The request has suceeded but the client should reset the document view
static int HTTP_SEE_OTHER
          The response can be found under a different URI
static int HTTP_TEMP_REDIRECT
          The resource is temporarily somewhere else
static int HTTP_UNAUTHORIZED
          The request requires user authentication
static int HTTP_UNAVAILABLE
          The server cannot handle the request due to an overload
static int HTTP_UNSUPPORTED_RANGE
          A range specified by a range request-header field is out of range
static int HTTP_UNSUPPORTED_TYPE
          The server does not support the type
static int HTTP_USE_PROXY
          The resource must be accessed via a proxy
static int HTTP_VERSION
          The server does not support the HTTP protocol version
static java.lang.String POST
          The string for a post method
static java.lang.String PUT
          The string for a put method
 
Method Summary
 long getDate()
          Get the date header field
 long getExpiration()
          Get the expires header field
 java.lang.String getFile()
          Get the file portion of the URL
 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
 java.lang.String getHost()
          Get the host to connect to
 long getLastModified()
          Get the last modified date
 int getPort()
          Get the port of the URL
 java.lang.String getProtocol()
          Get the protocol used for the connection
 java.lang.String getQuery()
          Get the query portion of the URL - after the last question mark
 java.lang.String getRef()
          Get the ref portion of the URL
 java.lang.String getRequestMethod()
          Get the request method
 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 getURL()
          Get the URL
 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 thekey
 
Methods inherited from interface javax.microedition.io.ContentConnection
getEncoding, getLength, getType
 
Methods inherited from interface javax.microedition.io.InputConnection
openDataInputStream, openInputStream
 
Methods inherited from interface javax.microedition.io.Connection
close
 
Methods inherited from interface javax.microedition.io.OutputConnection
openDataOutputStream, openOutputStream
 

Field Detail

GET

public static final java.lang.String GET
The string for a get method

See Also:
Constant Field Values

HEAD

public static final java.lang.String HEAD
The string for a head method

See Also:
Constant Field Values

POST

public static final java.lang.String POST
The string for a post method

See Also:
Constant Field Values

PUT

public static final java.lang.String PUT
The string for a put method

See Also:
Constant Field Values

HTTP_ACCEPTED

public static final int HTTP_ACCEPTED
The request has been accepted for processing but has not been completed

See Also:
Constant Field Values

HTTP_BAD_GATEWAY

public static final int HTTP_BAD_GATEWAY
The server received an invalid response that it was acting as a gateway for

See Also:
Constant Field Values

HTTP_BAD_METHOD

public static final int HTTP_BAD_METHOD
The method specified is not allowed

See Also:
Constant Field Values

HTTP_BAD_REQUEST

public static final int HTTP_BAD_REQUEST
The request could not be understood by the server

See Also:
Constant Field Values

HTTP_CLIENT_TIMEOUT

public static final int HTTP_CLIENT_TIMEOUT
The client did not produce a request within the time that the server was prepared to wait

See Also:
Constant Field Values

HTTP_CONFLICT

public static final int HTTP_CONFLICT
The server could not complete the request due to a conflict with the current state of the resource

See Also:
Constant Field Values

HTTP_CREATED

public static final int HTTP_CREATED
The request has been fulfilled and resulted in a new resource being created

See Also:
Constant Field Values

HTTP_ENTITY_TOO_LARGE

public static final int HTTP_ENTITY_TOO_LARGE
The server cannot process the request because the request is larger than the server can process

See Also:
Constant Field Values

HTTP_EXPECT_FAILED

public static final int HTTP_EXPECT_FAILED
The value in the expect request-header field could not be met by the server

See Also:
Constant Field Values

HTTP_FORBIDDEN

public static final int HTTP_FORBIDDEN
The server understood the request but is refusing to fulfill it

See Also:
Constant Field Values

HTTP_GATEWAY_TIMEOUT

public static final int HTTP_GATEWAY_TIMEOUT
The server acting as a gateway timedout

See Also:
Constant Field Values

HTTP_GONE

public static final int HTTP_GONE
The resource is no longer available at the server

See Also:
Constant Field Values

HTTP_INTERNAL_ERROR

public static final int HTTP_INTERNAL_ERROR
The server had an internal error

See Also:
Constant Field Values

HTTP_LENGTH_REQUIRED

public static final int HTTP_LENGTH_REQUIRED
The server needs a content length field

See Also:
Constant Field Values

HTTP_MOVED_PERM

public static final int HTTP_MOVED_PERM
The resource has been permanently moved to another location

See Also:
Constant Field Values

HTTP_MOVED_TEMP

public static final int HTTP_MOVED_TEMP
The resource has been temporarily moved to another location

See Also:
Constant Field Values

HTTP_MULT_CHOICE

public static final int HTTP_MULT_CHOICE
The resource has been moved to another one of many locations

See Also:
Constant Field Values

HTTP_NO_CONTENT

public static final int HTTP_NO_CONTENT
There is no content

See Also:
Constant Field Values

HTTP_NOT_ACCEPTABLE

public static final int HTTP_NOT_ACCEPTABLE
The request is not acceptable to the server

See Also:
Constant Field Values

HTTP_NOT_AUTHORITATIVE

public static final int HTTP_NOT_AUTHORITATIVE
The returned entity header is not the definitive information

See Also:
Constant Field Values

HTTP_NOT_FOUND

public static final int HTTP_NOT_FOUND
The server has not found anything

See Also:
Constant Field Values

HTTP_NOT_IMPLEMENTED

public static final int HTTP_NOT_IMPLEMENTED
The server does not implement the functionality to fulfill the request

See Also:
Constant Field Values

HTTP_NOT_MODIFIED

public static final int HTTP_NOT_MODIFIED
The server has allowed a get request, but has not modified the document

See Also:
Constant Field Values

HTTP_OK

public static final int HTTP_OK
The request has suceeded

See Also:
Constant Field Values

HTTP_PARTIAL

public static final int HTTP_PARTIAL
The server has fulfilled a partial get request

See Also:
Constant Field Values

HTTP_PAYMENT_REQUIRED

public static final int HTTP_PAYMENT_REQUIRED
Reserved

See Also:
Constant Field Values

HTTP_PRECON_FAILED

public static final int HTTP_PRECON_FAILED
The precondition of a request header failed

See Also:
Constant Field Values

HTTP_PROXY_AUTH

public static final int HTTP_PROXY_AUTH
The client must authenticate itself to a proxy

See Also:
Constant Field Values

HTTP_REQ_TOO_LONG

public static final int HTTP_REQ_TOO_LONG
The request is too long

See Also:
Constant Field Values

HTTP_RESET

public static final int HTTP_RESET
The request has suceeded but the client should reset the document view

See Also:
Constant Field Values

HTTP_SEE_OTHER

public static final int HTTP_SEE_OTHER
The response can be found under a different URI

See Also:
Constant Field Values

HTTP_TEMP_REDIRECT

public static final int HTTP_TEMP_REDIRECT
The resource is temporarily somewhere else

See Also:
Constant Field Values

HTTP_UNAUTHORIZED

public static final int HTTP_UNAUTHORIZED
The request requires user authentication

See Also:
Constant Field Values

HTTP_UNAVAILABLE

public static final int HTTP_UNAVAILABLE
The server cannot handle the request due to an overload

See Also:
Constant Field Values

HTTP_UNSUPPORTED_RANGE

public static final int HTTP_UNSUPPORTED_RANGE
A range specified by a range request-header field is out of range

See Also:
Constant Field Values

HTTP_UNSUPPORTED_TYPE

public static final int HTTP_UNSUPPORTED_TYPE
The server does not support the type

See Also:
Constant Field Values

HTTP_USE_PROXY

public static final int HTTP_USE_PROXY
The resource must be accessed via a proxy

See Also:
Constant Field Values

HTTP_VERSION

public static final int HTTP_VERSION
The server does not support the HTTP protocol version

See Also:
Constant Field Values
Method Detail

getFile

public java.lang.String getFile()
Get the file portion of the URL

Returns:
the file portion of the URL

getURL

public java.lang.String getURL()
Get the URL

Returns:
the url

getProtocol

public java.lang.String getProtocol()
Get the protocol used for the connection

Returns:
the protocol

getHost

public java.lang.String getHost()
Get the host to connect to

Returns:
the host name or IP address

getRef

public java.lang.String getRef()
Get the ref portion of the URL

Returns:
the ref

getQuery

public java.lang.String getQuery()
Get the query portion of the URL - after the last question mark

Returns:
the query

getPort

public int getPort()
Get the port of the URL

Returns:
the port or default 80 if none specified

getRequestMethod

public java.lang.String getRequestMethod()
Get the request method

Returns:
the request method

setRequestMethod

public void setRequestMethod(java.lang.String method)
                      throws IOException
Set the request method - only valid until the request has been got

Parameters:
method - The request method
Throws:
IOException - if the request has already been sent or the method is not valid

getRequestProperty

public java.lang.String getRequestProperty(java.lang.String key)
Get the request property specified by the key

Parameters:
key - The request property to get
Returns:
the property

setRequestProperty

public void setRequestProperty(java.lang.String key,
                               java.lang.String value)
                        throws IOException
Set the request property for thekey

Parameters:
key - The key
value - The value
Throws:
IOException - if there is an error

getResponseCode

public int getResponseCode()
                    throws IOException
Get the response code

Returns:
the response code (ie. 200, 400 ...)
Throws:
IOException - if there is an error

getResponseMessage

public java.lang.String getResponseMessage()
                                    throws IOException
Get the response message

Returns:
the response message (ie Not found)
Throws:
IOException - if there is an error

getExpiration

public long getExpiration()
                   throws IOException
Get the expires header field

Returns:
the value of the expires header field or 0
Throws:
IOException - if there is an error

getDate

public long getDate()
             throws IOException
Get the date header field

Returns:
the value of the date header field or 0
Throws:
IOException - if there is an error

getLastModified

public long getLastModified()
                     throws IOException
Get the last modified date

Returns:
the last modified or 0
Throws:
IOException - if there is an error

getHeaderField

public java.lang.String getHeaderField(java.lang.String name)
                                throws IOException
Get the header field

Parameters:
name - The name of the header field
Returns:
the value or null
Throws:
IOException - if there is an error

getHeaderFieldInt

public int getHeaderFieldInt(java.lang.String name,
                             int defaultValue)
                      throws IOException
Get a header field parsed as a number

Parameters:
name - The name of the field
defaultValue - The default value to use if the field cannot be parsed or if it does not exist
Returns:
the value of the field or the default value if it cannot be parsed
Throws:
IOException - if there is an error

getHeaderFieldDate

public long getHeaderFieldDate(java.lang.String name,
                               long defaultValue)
                        throws IOException
Get a header field parsed as a date value

Parameters:
name - Thename of the field
defaultValue - The default value to use if the field cannot be parsed or if it does not exist
Returns:
the value of the field or the default value if it cannot be parsed
Throws:
IOException - if there is an error

getHeaderField

public java.lang.String getHeaderField(int index)
                                throws IOException
Get a header field indexed by the index

Parameters:
index - The index
Returns:
the header field at the index or null if it is out of range
Throws:
IOException - if there is an error

getHeaderFieldKey

public java.lang.String getHeaderFieldKey(int index)
                                   throws IOException
Get the header field key at the index

Parameters:
index - the index
Returns:
the header field name at the index or null if it is out of range
Throws:
IOException - if there is an error

DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification