All Classes Functions Variables
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.server.HandleHTTP Class Reference

class HandleHttp This class is for handling the specific Http protocol, both POST and GET. More...

Inheritance diagram for com.server.HandleHTTP:

Public Member Functions

 HandleHTTP (Socket client)
 The only constructor, requires you have a client. More...
 
void run ()
 The main method that breaks down all of the client input string (GET request, etc.)
 
void dataDump (DataOutputStream out) throws IOException
 Dumps 100 MB of data onto the client as fast as possible. More...
 
void blackHole (InputStream ins, DataOutputStream out) throws IOException
 This method acts as the 'black hole' when a client POSTS to the server It's assumed that the client will send as much data as it can, as fast as possible. More...
 
void pingTest (DataOutputStream out) throws IOException
 This method is specifically for testing the ping from a client. More...
 

Public Attributes

Map< String, String > headerKeyPair = new HashMap<String,String>()
 

Private Member Functions

double parseHeaders (BufferedReader inStream)
 This method parses up the headers sent by the client and places them into a map. More...
 

Private Attributes

Socket client
 
BufferedReader is
 
DataOutputStream os
 
InputStream ins
 
double contentLength = 0.0
 

Static Private Attributes

static final int BYTES_IN_MEGABYTES = 1048576
 

Detailed Description

class HandleHttp This class is for handling the specific Http protocol, both POST and GET.

It is initialized with only a client socket, as we need to process the input stream from it Currently it ONLY checks for the first header to contain the word either GET or POST. if neither are encountered, it just closes the connecction.

Author
William Daniels
Version
1.1

Constructor & Destructor Documentation

com.server.HandleHTTP.HandleHTTP ( Socket  client)
inline

The only constructor, requires you have a client.

Parameters
Socket"client" the client that is connected to the http Port.

Member Function Documentation

void com.server.HandleHTTP.blackHole ( InputStream  ins,
DataOutputStream  out 
) throws IOException
inline

This method acts as the 'black hole' when a client POSTS to the server It's assumed that the client will send as much data as it can, as fast as possible.

it simple overwrites the old data and does nothing with it. EX: 'black hole'.

Parameters
insthe basic client inputStream, to allow single byte reading.
void com.server.HandleHTTP.dataDump ( DataOutputStream  out) throws IOException
inline

Dumps 100 MB of data onto the client as fast as possible.

Parameters
outa DataOutputStream that represents the outgoing connection to the client.
Exceptions
IOExceptionto catch any read/write errors.
double com.server.HandleHTTP.parseHeaders ( BufferedReader  inStream)
inlineprivate

This method parses up the headers sent by the client and places them into a map.

Parameters
inStreama BufferedReader used to read the headers line at a time until you reach the blank line
void com.server.HandleHTTP.pingTest ( DataOutputStream  out) throws IOException
inline

This method is specifically for testing the ping from a client.

Parameters
outa DataOutputStream that allows the server to write bytes to the client.

The documentation for this class was generated from the following file: