class HandleHttp This class is for handling the specific Http protocol, both POST and GET.
More...
|
| | 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...
|
| |
|
|
Map< String, String > | headerKeyPair = new HashMap<String,String>() |
| |
|
| double | parseHeaders (BufferedReader inStream) |
| | This method parses up the headers sent by the client and places them into a map. More...
|
| |
|
|
Socket | client |
| |
|
BufferedReader | is |
| |
|
DataOutputStream | os |
| |
|
InputStream | ins |
| |
|
double | contentLength = 0.0 |
| |
|
|
static final int | BYTES_IN_MEGABYTES = 1048576 |
| |
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
| 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. |
| 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
-
| ins | the 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
-
| out | a DataOutputStream that represents the outgoing connection to the client. |
- Exceptions
-
| IOException | to 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
-
| inStream | a 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
-
| out | a DataOutputStream that allows the server to write bytes to the client. |
The documentation for this class was generated from the following file:
- src/main/java/com/server/HandleHTTP.java