This class captures the essential messages in the HTTP protocol. It behaves
as a singleton.
ACCEPTED
public static final int ACCEPTED
BAD_GATEWAY
public static final int BAD_GATEWAY
BAD_REQUEST
public static final int BAD_REQUEST
CONFLICT
public static final int CONFLICT
CONTINUE
public static final int CONTINUE
CREATED
public static final int CREATED
EXPECTATION_FAILED
public static final int EXPECTATION_FAILED
FORBIDDEN
public static final int FORBIDDEN
GATEWAY_TIMEOUT
public static final int GATEWAY_TIMEOUT
GONE
public static final int GONE
HQ_IFMODSINCE
public static final String HQ_IFMODSINCE
HTTP_VERSION
public static final String HTTP_VERSION
HTTP_VERSION_NOT_SUPPORTED
public static final int HTTP_VERSION_NOT_SUPPORTED
INTERNAL_SERVER_ERROR
public static final int INTERNAL_SERVER_ERROR
LENGTH_REQUIRED
public static final int LENGTH_REQUIRED
MIMEFILE
public static final String MIMEFILE
MOVED_PERMANENTLY
public static final int MOVED_PERMANENTLY
MOVED_TEMPORARILY
public static final int MOVED_TEMPORARILY
MULTIPLE_CHOICE
public static final int MULTIPLE_CHOICE
NONE_ACCEPTABLE
public static final int NONE_ACCEPTABLE
NOT_ALLOWED
public static final int NOT_ALLOWED
NOT_FOUND
public static final int NOT_FOUND
NOT_IMPLEMENTED
public static final int NOT_IMPLEMENTED
NOT_MODIFIED
public static final int NOT_MODIFIED
NO_CONTENT
public static final int NO_CONTENT
OK
public static final int OK
PARTIAL_CONTENT
public static final int PARTIAL_CONTENT
PAYMENT_REQUIRED
public static final int PAYMENT_REQUIRED
PRECONDITION_FAILED
public static final int PRECONDITION_FAILED
PROVISIONAL_INFORMATION
public static final int PROVISIONAL_INFORMATION
PROXY_AUTH_REQUIRED
public static final int PROXY_AUTH_REQUIRED
REQUESTED_RANGE_NOT_SATISFIABLE
public static final int REQUESTED_RANGE_NOT_SATISFIABLE
REQUEST_ENTITY_TOO_LARGE
public static final int REQUEST_ENTITY_TOO_LARGE
REQUEST_TIMEOUT
public static final int REQUEST_TIMEOUT
REQUEST_URI_TOO_LONG
public static final int REQUEST_URI_TOO_LONG
RESET_CONTENT
public static final int RESET_CONTENT
SEE_OTHER
public static final int SEE_OTHER
SERVICE_UNAVAILABLE
public static final int SERVICE_UNAVAILABLE
SWITCHING
public static final int SWITCHING
UNAUTHORIZED
public static final int UNAUTHORIZED
UNSUPPORTED_MEDIA_TYPE
public static final int UNSUPPORTED_MEDIA_TYPE
USE_PROXY
public static final int USE_PROXY
Instance
public static Protocol Instance()
getHeaderResponseStatus
public static String getHeaderResponseStatus(int statusCode)
gets a String description of the status code e.g (200 OK) or (404 FnF)
statusCode
- the integer status code
getMIME
public static String getMIME(String extension)
MIME type accessor. By using this, we understand that sometimes the wrong
headers might go out for a badly named file (e.g. an mp3 file with
extension .txt but this is how all the major HTTP servers do it anyway.
extension
- the extension of the file
- the MIME type of the file according to the extension
makeNewMIME
public static void makeNewMIME()
Creates a new mime file with the bare basic defaults
requestHeaderExists
public static boolean requestHeaderExists(String requestHeader)
checks if a request header exists in the protocol
requestHeader
- the request headcer to check
- true if it exists, false otherwise