net.groboclown.util.http.v1
Interface IHttpClientState

All Known Implementing Classes:
Cookie

public interface IHttpClientState

Generic interface for storing client-side state information, which can be passed back to the server, and have security checks. COmmonly, these are called "Cookies".

Since:
Alpha 0.9.1
Version:
Alpha 0.9.1
Author:
Matt Albrecht

Method Summary
 String getName()
          Returns the name of the cookie.
 String getValue()
          Returns the value of the cookie.
 boolean isExpired()
          Checks if the cookie has expired, and hence needs to be removed from the server.
 boolean receiveSecurityCheck(IHttpResponseMessage msg)
          Checks if this cookie, which was loaded from the header of the given message, passes all security checks for the given set command by the server.
 boolean sendSecurityCheck(URL server)
          Checks if the given URL that this cookie is being passed to correctly passes all security checks.
 void setValue(String newValue)
          Assigns a new value to a cookie after the cookie is created.
 String toString(boolean append, boolean serverSet)
          Converts this cookie to a header-compatible string.
 

Method Detail

getName

public String getName()
Returns the name of the cookie. The name cannot be changed after creation.
Returns:
a String specifying the cookie's name

getValue

public String getValue()
Returns the value of the cookie.
Returns:
a String containing the cookie's present value
See Also:
setValue(String)

setValue

public void setValue(String newValue)
Assigns a new value to a cookie after the cookie is created. If you use a binary value, you may want to use BASE64 encoding.

With Version 0 cookies, values should not contain white space, brackets, parentheses, equals signs, commas, double quotes, slashes, question marks, at signs, colons, and semicolons. Empty values may not behave the same way on all browsers.

Parameters:
newValue - a String specifying the new value
See Also:
getValue()

sendSecurityCheck

public boolean sendSecurityCheck(URL server)
Checks if the given URL that this cookie is being passed to correctly passes all security checks. Expiration should be checked externally to this function.
Parameters:
server - the URL that this cookie is being sent to.
Returns:
true if the security considerations all check out, or false if the check fails verification.
See Also:
receiveSecurityCheck( IHttpResponseMessage ), isExpired()

receiveSecurityCheck

public boolean receiveSecurityCheck(IHttpResponseMessage msg)
Checks if this cookie, which was loaded from the header of the given message, passes all security checks for the given set command by the server. It may fill in any up-to-now unspecified security settings.

isExpired

public boolean isExpired()
Checks if the cookie has expired, and hence needs to be removed from the server.

toString

public String toString(boolean append,
                       boolean serverSet)
Converts this cookie to a header-compatible string. It adds any necessary separator to the beginning of the string if append is true.
Parameters:
append - true if this cookie is to be appended to the end of another cookie on the same header.
serverSet - true if this cookie is for the server to send to the client, or false if this cookie is being sent back to the server by the client.


Written under the LGPL