Fixed comments

This commit is contained in:
Ziver Koc 2010-10-23 19:40:19 +00:00
parent b5f161f7f1
commit faad31ce05

View file

@ -27,8 +27,8 @@ public class HTTPHeaderParser {
/** /**
* Parses the HTTP header information from the stream * Parses the HTTP header information from the stream
* *
* @param in is the stream * @param in is the stream
* @throws IOException * @throws IOException
*/ */
public HTTPHeaderParser(BufferedReader in) throws IOException{ public HTTPHeaderParser(BufferedReader in) throws IOException{
url_attr = new HashMap<String, String>(); url_attr = new HashMap<String, String>();
@ -48,7 +48,7 @@ public class HTTPHeaderParser {
/** /**
* Parses the HTTP header information from an String * Parses the HTTP header information from an String
* *
* @param in is the string * @param in is the string
*/ */
public HTTPHeaderParser(String in){ public HTTPHeaderParser(String in){
url_attr = new HashMap<String, String>(); url_attr = new HashMap<String, String>();
@ -71,9 +71,9 @@ public class HTTPHeaderParser {
* Parses the first header line and ads the values to * Parses the first header line and ads the values to
* the map and returns the file name and path * the map and returns the file name and path
* *
* @param header The header String * @param header The header String
* @param map The HashMap to put the variables to * @param map The HashMap to put the variables to
* @return The path and file name as a String * @return The path and file name as a String
*/ */
protected void parseFirstLine(String line){ protected void parseFirstLine(String line){
// Server Response // Server Response
@ -106,8 +106,20 @@ public class HTTPHeaderParser {
* Parses a String with variables from a get or post * Parses a String with variables from a get or post
* that was sent from a client and puts the data into a HashMap * that was sent from a client and puts the data into a HashMap
* *
* @param header is the String containing all the attributes * @param attributes is the String containing all the attributes
* @param map is the HashMap to put all the values into */
public static HashMap<String, String> parseUrlAttributes( String attributes ){
HashMap<String, String> map = new HashMap<String, String>();
parseUrlAttributes(attributes, map);
return map;
}
/**
* Parses a String with variables from a get or post
* that was sent from a client and puts the data into a HashMap
*
* @param attributes is the String containing all the attributes
* @param map is the HashMap to put all the values into
*/ */
public static void parseUrlAttributes(String attributes, HashMap<String, String> map){ public static void parseUrlAttributes(String attributes, HashMap<String, String> map){
String[] tmp; String[] tmp;
@ -124,7 +136,7 @@ public class HTTPHeaderParser {
/** /**
* Parses the rest of the header * Parses the rest of the header
* *
* @param line is the next line in the header * @param line is the next line in the header
*/ */
protected void parseLine(String line){ protected void parseLine(String line){
String[] data = colonPattern.split( line, 2 ); String[] data = colonPattern.split( line, 2 );
@ -137,7 +149,7 @@ public class HTTPHeaderParser {
* Parses the attribute "Cookie" and returns a HashMap * Parses the attribute "Cookie" and returns a HashMap
* with the values * with the values
* *
* @return a HashMap with cookie values * @return a HashMap with cookie values
*/ */
protected void parseCookies(){ protected void parseCookies(){
if( headers.containsKey("COOKIE") ){ if( headers.containsKey("COOKIE") ){
@ -153,46 +165,49 @@ public class HTTPHeaderParser {
} }
/** /**
* @return the HTTP message type( ex. GET,POST...) * @return the HTTP message type( ex. GET,POST...)
*/ */
public String getRequestType(){ public String getRequestType(){
return type; return type;
} }
/** /**
* @return the HTTP version of this header * @return the HTTP version of this header
*/ */
public float getHTTPVersion(){ public float getHTTPVersion(){
return version; return version;
} }
/** /**
* @return the HTTP Return Code from a Server * @return the HTTP Return Code from a Server
*/ */
public float getHTTPCode(){ public float getHTTPCode(){
return httpCode; return httpCode;
} }
/** /**
* @return the URL that the client sent the server * @return the URL that the client sent the server
*/ */
public String getRequestURL(){ public String getRequestURL(){
return url; return url;
} }
/** /**
* Returns the URL attribute value of the given name, * Returns the URL attribute value of the given name.
* returns null if there is no such attribute *
* returns null if there is no such attribute
*/ */
public String getURLAttribute(String name){ public String getURLAttribute(String name){
return url_attr.get( name ); return url_attr.get( name );
} }
/** /**
* Returns the HTTP attribute value of the given name, * Returns the HTTP attribute value of the given name.
* returns null if there is no such attribute *
* returns null if there is no such attribute
*/ */
public String getHeader(String name){ public String getHeader(String name){
return headers.get( name.toUpperCase() ); return headers.get( name.toUpperCase() );
} }
/** /**
* Returns the cookie value of the given name, * Returns the cookie value of the given name.
* returns null if there is no such attribute *
* returns null if there is no such attribute
*/ */
public String getCookie(String name){ public String getCookie(String name){
return cookies.get( name ); return cookies.get( name );
@ -200,19 +215,19 @@ public class HTTPHeaderParser {
/** /**
* @return a map of the parsed cookies * @return a map of the parsed cookies
*/ */
public HashMap<String, String> getCookies(){ public HashMap<String, String> getCookies(){
return cookies; return cookies;
} }
/** /**
* @return a map of the parsed URL attributes * @return a map of the parsed URL attributes
*/ */
public HashMap<String, String> getURLAttributes(){ public HashMap<String, String> getURLAttributes(){
return url_attr; return url_attr;
} }
/** /**
* @return a map of the parsed headers * @return a map of the parsed headers
*/ */
public HashMap<String, String> getHeaders(){ public HashMap<String, String> getHeaders(){
return headers; return headers;