|
What this is
Other links
The source code/* * Copyright 1999-2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.tomcat.util.http; import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.buf.DateTool; import java.text.*; import java.io.*; import java.util.*; /** * 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 representation. */ public class ServerCookie implements Serializable { private MessageBytes name=MessageBytes.newInstance(); private MessageBytes value=MessageBytes.newInstance(); private MessageBytes comment=MessageBytes.newInstance(); // ;Comment=VALUE private MessageBytes domain=MessageBytes.newInstance(); // ;Domain=VALUE ... private int maxAge = -1; // ;Max-Age=VALUE // ;Discard ... implied by maxAge < 0 // RFC2109: maxAge=0 will end a session private MessageBytes path=MessageBytes.newInstance(); // ;Path=VALUE . private boolean secure; // ;Secure private int version = 0; // ;Version=1 //XXX CommentURL, Port -> use notes ? public ServerCookie() { } public void recycle() { path.recycle(); name.recycle(); value.recycle(); comment.recycle(); maxAge=-1; path.recycle(); domain.recycle(); version=0; secure=false; } public MessageBytes getComment() { return comment; } public MessageBytes getDomain() { return domain; } public void setMaxAge(int expiry) { maxAge = expiry; } public int getMaxAge() { return maxAge; } public MessageBytes getPath() { return path; } public void setSecure(boolean flag) { secure = flag; } public boolean getSecure() { return secure; } public MessageBytes getName() { return name; } public MessageBytes getValue() { return value; } public int getVersion() { return version; } public void setVersion(int v) { version = v; } // -------------------- utils -------------------- public String toString() { return "Cookie " + getName() + "=" + getValue() + " ; " + getVersion() + " " + getPath() + " " + getDomain(); } // Note -- disabled for now to allow full Netscape compatibility // from RFC 2068, token special case characters // // private static final String tspecials = "()<>@,;:\\\"/[]?={} \t"; private static final String tspecials = ",;"; /* * Tests a string and returns true if the string counts as a * reserved token in the Java language. * * @param value the |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.