X-Git-Url: http://dolda2000.com/gitweb/?p=jsvc.git;a=blobdiff_plain;f=src%2Fdolda%2Fjsvc%2Futil%2FCookie.java;h=591289dcf3f0e76ff1c0c0ee52a59b06fa00dcc0;hp=8783427cd38cd421197bd9d6bf72c61b44fd3ff0;hb=d5dd6a2dada08df30133b739d0ce1fa8f2a0d2e9;hpb=2bacd22079557f2efcceb41ce542a61663c2b6da diff --git a/src/dolda/jsvc/util/Cookie.java b/src/dolda/jsvc/util/Cookie.java index 8783427..591289d 100644 --- a/src/dolda/jsvc/util/Cookie.java +++ b/src/dolda/jsvc/util/Cookie.java @@ -6,6 +6,7 @@ import java.text.*; import java.io.*; public class Cookie { + private final static Map> cache = new WeakHashMap>(); public final static DateFormat datefmt; static { datefmt = new SimpleDateFormat("EEE, dd-MMM-yyyy HH:mm:ss z", Locale.ENGLISH); @@ -88,6 +89,17 @@ public class Cookie { return(ret); } + public static MultiMap get(Request req) { + synchronized(cache) { + MultiMap ret = cache.get(req); + if(ret == null) { + ret = parse(req); + cache.put(req, ret); + } + return(ret); + } + } + public String toString() { StringBuilder buf = new StringBuilder(); buf.append("Cookie(");