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

Constructor Index

 o HTTP()
Construct an instance of HTTP class and sets the default values for port and protocol name.

Method Index

 o addRequestHeader(String, String, int)
Creates a headers array to send to the HTTP server using senRequest method.
 o closeConnection()
Close an opened up connection to a HTTP server.
 o closeRequest()
Closes a request handle
 o connect()
Connects to an HTTP server.
 o getDataInputStream()
Gets the input stream
 o getLastReply()
Gets the complete discriptive reply of the server for the last command sent to the server.
 o openRequest(String, String, String)
Creates a request which will be passed to the HTTP server using sendRequest method.
 o queryInfo(String)
Query the header field informations send back to the client from the host.
 o readFile(byte[])
Calls readFile method of the Internet class and passes the buffer to be filled with the reply from the HTTP server.
 o sendRequest()
sends a request to the HTTP server.
 o setProtocolName(String)
Sets the protocol name.

Constructors

 o 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.

Methods

 o getDataInputStream
  public DataInputStream getDataInputStream()
Gets the input stream
 o 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
 o getLastReply
  public String getLastReply()
Gets the complete discriptive reply of the server for the last command sent to the server.
 o connect
  public boolean connect()
Connects to an HTTP server.
 o closeConnection
  public boolean closeConnection()
Close an opened up connection to a HTTP server.
 o 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
 o 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
 o sendRequest
  public boolean sendRequest()
sends a request to the HTTP server.
 o closeRequest
  public boolean closeRequest()
Closes a request handle
 o 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.
 o 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