01: package org.acegisecurity.ui.savedrequest;
02:
03: import javax.servlet.http.Cookie;
04: import java.io.Serializable;
05:
06: /**
07: * Stores off the values of a cookie in a serializable holder
08: *
09: * @author Ray Krueger
10: */
11: public class SavedCookie implements Serializable {
12: private java.lang.String name;
13: private java.lang.String value;
14: private java.lang.String comment;
15: private java.lang.String domain;
16: private int maxAge;
17: private java.lang.String path;
18: private boolean secure;
19: private int version;
20:
21: public SavedCookie(String name, String value, String comment,
22: String domain, int maxAge, String path, boolean secure,
23: int version) {
24: this .name = name;
25: this .value = value;
26: this .comment = comment;
27: this .domain = domain;
28: this .maxAge = maxAge;
29: this .path = path;
30: this .secure = secure;
31: this .version = version;
32: }
33:
34: public SavedCookie(Cookie cookie) {
35: this (cookie.getName(), cookie.getValue(), cookie.getComment(),
36: cookie.getDomain(), cookie.getMaxAge(), cookie
37: .getPath(), cookie.getSecure(), cookie
38: .getVersion());
39: }
40:
41: public String getName() {
42: return name;
43: }
44:
45: public String getValue() {
46: return value;
47: }
48:
49: public String getComment() {
50: return comment;
51: }
52:
53: public String getDomain() {
54: return domain;
55: }
56:
57: public int getMaxAge() {
58: return maxAge;
59: }
60:
61: public String getPath() {
62: return path;
63: }
64:
65: public boolean isSecure() {
66: return secure;
67: }
68:
69: public int getVersion() {
70: return version;
71: }
72:
73: public Cookie getCookie() {
74: Cookie c = new Cookie(getName(), getValue());
75:
76: if (getComment() != null)
77: c.setComment(getComment());
78:
79: if (getDomain() != null)
80: c.setDomain(getDomain());
81:
82: if (getPath() != null)
83: c.setPath(getPath());
84:
85: c.setVersion(getVersion());
86: c.setMaxAge(getMaxAge());
87: c.setSecure(isSecure());
88: return c;
89: }
90: }
|