Class powersoft.jcm.net.HTTP
All Packages Class Hierarchy This Package Previous Next Index
Class powersoft.jcm.net.HTTP
java.lang.Object
|
+----powersoft.jcm.net.Internet
|
+----powersoft.jcm.net.HTTP
- public class HTTP
- extends Internet
- implements HTTPInterface
The HTTP Class is drived from Internet class. It allows toconnect
to a HTTP server and be able to open a resourse. All the constants are
defined in HTTPInterface Class.
- See Also:
- Internet Class, HTTPInterface Class
-
HTTP()
- Construct an instance of HTTP class and sets the default values
for port and protocol name.
-
addRequestHeader(String, String, int)
- Creates a headers array to send to the HTTP server using senRequest
method.
-
closeConnection()
- Close an opened up connection to a HTTP server.
-
closeRequest()
- Closes a request handle
-
connect()
- Connects to an HTTP server.
-
getDataInputStream()
- Gets the input stream
-
getLastReply()
- Gets the complete discriptive reply of the server for the last
command sent to the server.
-
openRequest(String, String, String)
- Creates a request which will be passed to the HTTP server using
sendRequest method.
-
queryInfo(String)
- Query the header field informations send back to the client from
the host.
-
readFile(byte[])
- Calls readFile method of the Internet class and passes the buffer to
be filled with the reply from the HTTP server.
-
sendRequest()
- sends a request to the HTTP server.
-
setProtocolName(String)
- Sets the protocol name.
HTTP
public HTTP()
- Construct an instance of HTTP class and sets the default values
for port and protocol name.
Note: The default command port for HTTP protocol is 80.
getDataInputStream
public DataInputStream getDataInputStream()
- Gets the input stream
setProtocolName
public void setProtocolName(String protocol)
- Sets the protocol name. Always defaults to HTTP.
Note: Protocol name for HTTP can not be change and
the supllied value of the argument will simply be ignored.
- Parameters:
- protocol - String which will simply be ignored.
- Overrides:
- setProtocolName in class Internet
getLastReply
public String getLastReply()
- Gets the complete discriptive reply of the server for the last
command sent to the server.
connect
public boolean connect()
- Connects to an HTTP server.
closeConnection
public boolean closeConnection()
- Close an opened up connection to a HTTP server.
openRequest
public boolean openRequest(String object,
String verb,
String version)
- Creates a request which will be passed to the HTTP server using
sendRequest method.
- Parameters:
- object - instance of String containing the name of the object
to be opend
- verb - String containing the any valid verb i.e. GET, POST, etc.
default is "GET"
- version - String defining the version of HTTP protocol which HTTP
has. Default is HTTP version 0.9.
- See Also:
- sendRequest
addRequestHeader
public boolean addRequestHeader(String headerField,
String headerFieldValue,
int headerFieldFlag)
- Creates a headers array to send to the HTTP server using senRequest
method.
- Parameters:
- headerField - String containing the header field name
- headerFieldValue - String containing the value of the header
field
- headerFieldFlag - String containing the header field flags
- See Also:
- sendRequest
sendRequest
public boolean sendRequest()
- sends a request to the HTTP server.
closeRequest
public boolean closeRequest()
- Closes a request handle
queryInfo
public String queryInfo(String headerField)
- Query the header field informations send back to the client from
the host.
- Parameters:
- headerField - String containing the name of the header field.
readFile
public int readFile(byte buffer[])
- Calls readFile method of the Internet class and passes the buffer to
be filled with the reply from the HTTP server.
- Parameters:
- buffer - Byte array to be filled.
- Overrides:
- readFile in class Internet
All Packages Class Hierarchy This Package Previous Next Index