MCPcopy Index your code
hub / github.com/apache/tomcat / ServerCookie

Class ServerCookie

java/org/apache/tomcat/util/http/ServerCookie.java:32–87  ·  view source on GitHub ↗

Server-side cookie representation. Allows recycling and uses MessageBytes as low-level representation ( and thus the byte -> char conversion can be delayed until we know the charset ). Tomcat.core uses this recyclable object to represent cookies, and the facade will convert it to the external

Source from the content-addressed store, hash-verified

30 * representation.
31 */
32public class ServerCookie implements Serializable {
33
34 @Serial
35 private static final long serialVersionUID = 1L;
36
37 // RFC 6265
38 /**
39 * The cookie name.
40 */
41 private final MessageBytes name = MessageBytes.newInstance();
42 /**
43 * The cookie value.
44 */
45 private final MessageBytes value = MessageBytes.newInstance();
46
47 /**
48 * Creates a new empty ServerCookie instance.
49 */
50 public ServerCookie() {
51 // NOOP
52 }
53
54 /**
55 * Resets this cookie's name and value so it can be reused.
56 */
57 public void recycle() {
58 name.recycle();
59 value.recycle();
60 }
61
62 /**
63 * Returns the name of this cookie as a {@link MessageBytes} object.
64 *
65 * @return the cookie name
66 */
67 public MessageBytes getName() {
68 return name;
69 }
70
71 /**
72 * Returns the value of this cookie as a {@link MessageBytes} object.
73 *
74 * @return the cookie value
75 */
76 public MessageBytes getValue() {
77 return value;
78 }
79
80
81 // -------------------- utils --------------------
82
83 @Override
84 public String toString() {
85 return "Cookie " + getName() + "=" + getValue();
86 }
87}
88

Callers

nothing calls this directly

Calls 1

newInstanceMethod · 0.95

Tested by

no test coverage detected