anon.proxy
Class HTTPProxyCallback
java.lang.Object
anon.proxy.HTTPProxyCallback
- All Implemented Interfaces:
- ProxyCallback
public class HTTPProxyCallback
- extends java.lang.Object
- implements ProxyCallback
Provides functionality for parsing and storing the headers of a
HTTP-Connection. Invoked by the ProxyCallbackHandler framework.
HTTPConnectionListeners can be registered to examine and modify
the corresponding HTTP messages before they are
transmitted further. Also Listeners can be notified about how much
payload was transmitted via the corresponding HTTPConnection.
- Author:
- Simon Pecher
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HTTP_CONTENT_LENGTH
public static final java.lang.String HTTP_CONTENT_LENGTH
- See Also:
- Constant Field Values
HTTP_CONTENT_ENCODING
public static final java.lang.String HTTP_CONTENT_ENCODING
- See Also:
- Constant Field Values
HTTP_HOST
public static final java.lang.String HTTP_HOST
- See Also:
- Constant Field Values
HTTP_USER_AGENT
public static final java.lang.String HTTP_USER_AGENT
- See Also:
- Constant Field Values
HTTP_ACCEPT
public static final java.lang.String HTTP_ACCEPT
- See Also:
- Constant Field Values
HTTP_ACCEPT_LANGUAGE
public static final java.lang.String HTTP_ACCEPT_LANGUAGE
- See Also:
- Constant Field Values
HTTP_ACCEPT_ENCODING
public static final java.lang.String HTTP_ACCEPT_ENCODING
- See Also:
- Constant Field Values
HTTP_ACCEPT_CHARSET
public static final java.lang.String HTTP_ACCEPT_CHARSET
- See Also:
- Constant Field Values
HTTP_KEEP_ALIVE
public static final java.lang.String HTTP_KEEP_ALIVE
- See Also:
- Constant Field Values
HTTP_PROXY_CONNECTION
public static final java.lang.String HTTP_PROXY_CONNECTION
- See Also:
- Constant Field Values
HTTP_CONNECTION
public static final java.lang.String HTTP_CONNECTION
- See Also:
- Constant Field Values
HTTP_REFERER
public static final java.lang.String HTTP_REFERER
- See Also:
- Constant Field Values
HTTP_CACHE_CONTROL
public static final java.lang.String HTTP_CACHE_CONTROL
- See Also:
- Constant Field Values
HTTP_PRAGMA
public static final java.lang.String HTTP_PRAGMA
- See Also:
- Constant Field Values
HTTP_RANGE
public static final java.lang.String HTTP_RANGE
- See Also:
- Constant Field Values
HTTP_IE_UA_CPU
public static final java.lang.String HTTP_IE_UA_CPU
- See Also:
- Constant Field Values
HTTPProxyCallback
public HTTPProxyCallback()
handleUpstreamChunk
public int handleUpstreamChunk(AnonProxyRequest anonRequest,
ProxyCallbackBuffer buffer)
throws ProxyCallbackNotProcessableException
- Specified by:
handleUpstreamChunk in interface ProxyCallback
- Throws:
ProxyCallbackNotProcessableException
handleDownstreamChunk
public int handleDownstreamChunk(AnonProxyRequest anonRequest,
ProxyCallbackBuffer buffer)
throws ProxyCallbackNotProcessableException
- Specified by:
handleDownstreamChunk in interface ProxyCallback
- Throws:
ProxyCallbackNotProcessableException
getUpStreamContentBytes
public long getUpStreamContentBytes(AnonProxyRequest anonRequest)
getDownStreamContentBytes
public long getDownStreamContentBytes(AnonProxyRequest anonRequest)
checkValidity
public static boolean checkValidity(java.lang.String headerData)
- checks whether the HTTP message headers fragment specified by headerData
contains invalid line terminations, i.e. all terminations other
than CRLF
- Parameters:
headerData - the fragment of the HTTP headers of a HTTP message
- Returns:
- false if the fragment contains invalid line terminations, true otherwise.
indexOfHTTPHeaderEnd
public static int indexOfHTTPHeaderEnd(byte[] chunk,
int startIndex,
int endIndex)
- Returns the index of the first char after the first occurence of the CRLFCRLF termination
in the array 'chunk' or -1 if such a termination sequence was not found.
indexOfHTTPHeaderEnd
public static int indexOfHTTPHeaderEnd(byte[] prefix,
byte[] chunk,
int chunkStartIndex,
int chunkEndIndex)
- Returns the index of the first char after the first occurence of the CRLFCRLF termination
in the array 'chunk' or -1 if such a termination sequence was not found. Also considers that
some of the line termination characters are stored at the end of the array 'prefix' which
are followed by the corresponding characters in 'chunk' to complete the CRLFCRLF
sequence. The index returned refers to the array 'chunk'.
addHTTPConnectionListener
public void addHTTPConnectionListener(AbstractHTTPConnectionListener listener)
removeHTTPConnectionListener
public void removeHTTPConnectionListener(AbstractHTTPConnectionListener listener)
removeAllHTTPConnectionListeners
public void removeAllHTTPConnectionListeners()
fireRequestHeadersReceived
public void fireRequestHeadersReceived(HTTPConnectionEvent event)
fireResponseHeadersReceived
public void fireResponseHeadersReceived(HTTPConnectionEvent event)
fireDownstreamContentBytesReceived
public void fireDownstreamContentBytesReceived(HTTPConnectionEvent event)
fireUpstreamContentBytesReceived
public void fireUpstreamContentBytesReceived(HTTPConnectionEvent event)
closeRequest
public void closeRequest(AnonProxyRequest anonRequest)
- Specified by:
closeRequest in interface ProxyCallback