com.prolixtech.jaminid
Class Protocol

java.lang.Object
  extended by com.prolixtech.jaminid.Protocol

public class Protocol
extends java.lang.Object

This class captures the essential messages in the HTTP protocol. It behaves as a singleton.

Author:
Constantinos Michael

Field Summary
static int ACCEPTED
           
static int BAD_GATEWAY
           
static int BAD_REQUEST
           
static int CONFLICT
           
static int CONTINUE
           
static int CREATED
           
static int EXPECTATION_FAILED
           
static int FORBIDDEN
           
static int GATEWAY_TIMEOUT
           
static int GONE
           
static java.lang.String HQ_IFMODSINCE
           
static java.lang.String HTTP_VERSION
           
static int HTTP_VERSION_NOT_SUPPORTED
           
static int INTERNAL_SERVER_ERROR
           
static int LENGTH_REQUIRED
           
static java.lang.String MIMEFILE
           
static int MOVED_PERMANENTLY
           
static int MOVED_TEMPORARILY
           
static int MULTIPLE_CHOICE
           
static int NO_CONTENT
           
static int NONE_ACCEPTABLE
           
static int NOT_ALLOWED
           
static int NOT_FOUND
           
static int NOT_IMPLEMENTED
           
static int NOT_MODIFIED
           
static int OK
           
static int PARTIAL_CONTENT
           
static int PAYMENT_REQUIRED
           
static int PRECONDITION_FAILED
           
static int PROVISIONAL_INFORMATION
           
static int PROXY_AUTH_REQUIRED
           
static int REQUEST_ENTITY_TOO_LARGE
           
static int REQUEST_TIMEOUT
           
static int REQUEST_URI_TOO_LONG
           
static int REQUESTED_RANGE_NOT_SATISFIABLE
           
static int RESET_CONTENT
           
static int SEE_OTHER
           
static int SERVICE_UNAVAILABLE
           
static int SWITCHING
           
static int UNAUTHORIZED
           
static int UNSUPPORTED_MEDIA_TYPE
           
static int USE_PROXY
           
 
Method Summary
static java.lang.String getHeaderResponseStatus(int statusCode)
          gets a String description of the status code e.g (200 OK) or (404 FnF)
static java.lang.String getMIME(java.lang.String extension)
          MIME type accessor.
static Protocol Instance()
           
static void makeNewMIME()
          Creates a new mime file with the bare basic defaults
static boolean requestHeaderExists(java.lang.String requestHeader)
          checks if a request header exists in the protocol
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIMEFILE

public static final java.lang.String MIMEFILE
See Also:
Constant Field Values

HTTP_VERSION

public static final java.lang.String HTTP_VERSION
See Also:
Constant Field Values

CONTINUE

public static final int CONTINUE
See Also:
Constant Field Values

SWITCHING

public static final int SWITCHING
See Also:
Constant Field Values

OK

public static final int OK
See Also:
Constant Field Values

CREATED

public static final int CREATED
See Also:
Constant Field Values

ACCEPTED

public static final int ACCEPTED
See Also:
Constant Field Values

PROVISIONAL_INFORMATION

public static final int PROVISIONAL_INFORMATION
See Also:
Constant Field Values

NO_CONTENT

public static final int NO_CONTENT
See Also:
Constant Field Values

RESET_CONTENT

public static final int RESET_CONTENT
See Also:
Constant Field Values

PARTIAL_CONTENT

public static final int PARTIAL_CONTENT
See Also:
Constant Field Values

MULTIPLE_CHOICE

public static final int MULTIPLE_CHOICE
See Also:
Constant Field Values

MOVED_PERMANENTLY

public static final int MOVED_PERMANENTLY
See Also:
Constant Field Values

MOVED_TEMPORARILY

public static final int MOVED_TEMPORARILY
See Also:
Constant Field Values

SEE_OTHER

public static final int SEE_OTHER
See Also:
Constant Field Values

NOT_MODIFIED

public static final int NOT_MODIFIED
See Also:
Constant Field Values

USE_PROXY

public static final int USE_PROXY
See Also:
Constant Field Values

BAD_REQUEST

public static final int BAD_REQUEST
See Also:
Constant Field Values

UNAUTHORIZED

public static final int UNAUTHORIZED
See Also:
Constant Field Values

PAYMENT_REQUIRED

public static final int PAYMENT_REQUIRED
See Also:
Constant Field Values

FORBIDDEN

public static final int FORBIDDEN
See Also:
Constant Field Values

NOT_FOUND

public static final int NOT_FOUND
See Also:
Constant Field Values

NOT_ALLOWED

public static final int NOT_ALLOWED
See Also:
Constant Field Values

NONE_ACCEPTABLE

public static final int NONE_ACCEPTABLE
See Also:
Constant Field Values

PROXY_AUTH_REQUIRED

public static final int PROXY_AUTH_REQUIRED
See Also:
Constant Field Values

REQUEST_TIMEOUT

public static final int REQUEST_TIMEOUT
See Also:
Constant Field Values

CONFLICT

public static final int CONFLICT
See Also:
Constant Field Values

GONE

public static final int GONE
See Also:
Constant Field Values

LENGTH_REQUIRED

public static final int LENGTH_REQUIRED
See Also:
Constant Field Values

PRECONDITION_FAILED

public static final int PRECONDITION_FAILED
See Also:
Constant Field Values

REQUEST_ENTITY_TOO_LARGE

public static final int REQUEST_ENTITY_TOO_LARGE
See Also:
Constant Field Values

REQUEST_URI_TOO_LONG

public static final int REQUEST_URI_TOO_LONG
See Also:
Constant Field Values

UNSUPPORTED_MEDIA_TYPE

public static final int UNSUPPORTED_MEDIA_TYPE
See Also:
Constant Field Values

REQUESTED_RANGE_NOT_SATISFIABLE

public static final int REQUESTED_RANGE_NOT_SATISFIABLE
See Also:
Constant Field Values

EXPECTATION_FAILED

public static final int EXPECTATION_FAILED
See Also:
Constant Field Values

INTERNAL_SERVER_ERROR

public static final int INTERNAL_SERVER_ERROR
See Also:
Constant Field Values

NOT_IMPLEMENTED

public static final int NOT_IMPLEMENTED
See Also:
Constant Field Values

BAD_GATEWAY

public static final int BAD_GATEWAY
See Also:
Constant Field Values

SERVICE_UNAVAILABLE

public static final int SERVICE_UNAVAILABLE
See Also:
Constant Field Values

GATEWAY_TIMEOUT

public static final int GATEWAY_TIMEOUT
See Also:
Constant Field Values

HTTP_VERSION_NOT_SUPPORTED

public static final int HTTP_VERSION_NOT_SUPPORTED
See Also:
Constant Field Values

HQ_IFMODSINCE

public static final java.lang.String HQ_IFMODSINCE
See Also:
Constant Field Values
Method Detail

Instance

public static Protocol Instance()

getMIME

public static java.lang.String getMIME(java.lang.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.

Parameters:
extension - the extension of the file
Returns:
the MIME type of the file according to the extension

getHeaderResponseStatus

public static java.lang.String getHeaderResponseStatus(int statusCode)
gets a String description of the status code e.g (200 OK) or (404 FnF)

Parameters:
statusCode - the integer status code
Returns:
the String status code

requestHeaderExists

public static boolean requestHeaderExists(java.lang.String requestHeader)
checks if a request header exists in the protocol

Parameters:
requestHeader - the request headcer to check
Returns:
true if it exists, false otherwise

makeNewMIME

public static void makeNewMIME()
Creates a new mime file with the bare basic defaults