Updated fixmes for ataylor regarding cookie encoding/decoding

This commit is contained in:
Trustin Lee 2009-02-26 08:06:07 +00:00
parent b8bc78a7d0
commit b71d2d3d7f
2 changed files with 7 additions and 2 deletions

View File

@ -33,11 +33,14 @@ import org.jboss.netty.util.CaseIgnoringComparator;
*/
public class CookieDecoder {
// TODO: Add domain, path, maxAge, and version (and perhaps secure and comment?)
private final static String semicolon = ";";
private final static String equals = "=";
public Map<String, Cookie> decode(String header) {
// FIXME: Support both version 0 and 1 cookies
// FIXME: Decode all cookie fields, including domain, path, maxAge, secure, and comment.
// FIXME: CookieDecoder cannot assume that the first field is always the name-value pair.
// FIXME: Check RFC 2109 - http://www.ietf.org/rfc/rfc2109.txt
Map<String, Cookie> cookies = new TreeMap<String, Cookie>(CaseIgnoringComparator.INSTANCE);
String[] split = header.split(semicolon);
for (String s : split) {

View File

@ -34,7 +34,6 @@ import org.jboss.netty.util.CaseIgnoringComparator;
*/
public class CookieEncoder {
// TODO: Add domain, path, maxAge, and version (and perhaps secure and comment?)
private final Map<String, Cookie> cookies = new TreeMap<String, Cookie>(CaseIgnoringComparator.INSTANCE);
public void addCookie(String name, String val) {
@ -46,6 +45,9 @@ public class CookieEncoder {
}
public String encode() {
// FIXME: Support both version 0 and 1 cookies
// FIXME: Encode all cookie fields, including domain, path, maxAge, secure, and comment.
// FIXME: Check RFC 2109 - http://www.ietf.org/rfc/rfc2109.txt
StringBuffer sb = new StringBuffer();
Collection<String> cookieNames = cookies.keySet();
if(cookieNames.isEmpty()) {