Javax.servlet.http.Cookie API Translation

Source: Internet
Author: User
Tags rfc send cookies alphanumeric characters
There is nothing to say, the servlet specification of the things, English look uncomfortable on the translation. There is not the right place, but also hope master correct.
Overview Package Class Tree Deprecated Index Help
PREV class NEXT Class FRAMES NO FRAMES
Summary:inner | FIELD | Constr | Method Detail:field | Constr | Method
javax.servlet.http
Class Cookie
Java.lang.Object
  |
  +--javax.servlet.http.cookie
Public class  Cookie extends Java.lang.Object implements Java.lang.Cloneable creates a cookie, a small amount of INF Ormation sent by a servlet to a Web browser, saved by the browser, and later sent back to the server. A cookie ' s value can uniquely identify a client, so cookies are commonly used for session management. Create a cookie, a small amount of information is sent through the servlet to the Web browser, saved through the browser, and then sent to the server from the browser. The value of a cookie uniquely identifies a client, so cookies are often used in session management. A cookie has a name, a single value, and optional attributes such as a comment, path and domain qualifiers, a maximum age, and a version number. Some Web browsers have bugs in how they handle the optional attributes ity of your servlets. A cookie has a name and a value and some optional attributes such as annotation, path, domain, maximum valid time, version number, and so on. Some browsers have bugs in handling optional options, so use them sparingly to improve sevlet interactivity. The servlet sends cookies to the browser by using the Httpservletresponse.addcookie (Javax.servlet.http.Cookie)   method, which adds fields to HTTP response headers to send cookie to the browseR, one at a time. The browser is expected to support cookies for each WEB server, all cookies total, and could limit cookie size to 4 KB ea Ch. Sevlet send cookies using the Httpservletresponse.addcookie (Javax.servlet.http.Cookie) method, a browser is expected to support up to 300 cookies, Supports up to 20 cookies for a site and may limit the size of a cookie to no more than 4KB. The browser returns cookies to the servlet by adding fields to HTTP request headers. Cookies can be retrieved from a request by using the  httpservletrequest.getcookies ()  method. Several cookies might have the same name but different path attributes. The browser returns a cookie to a servlet through the processor of the HTTP request. Cookies can be retrieved from the Httpservletrequest.getcookies (). Cookies affect the caching of the WEB pages that use them. HTTP 1.0 does not cache pages ' use cookie created with this class. This class does not support the cache control defined with HTTP 1.1. Cookies affect every Web page that uses it. (......) This class is supports both the version 0 (by Netscape) and version 1 (by RFC 2109) cookie specifications. By default, cookies are created USINg Version 0 To ensure the best interoperability. This class supports both version 0 and version 1 cookie specifications. By default, cookies are created using version 0来 to ensure the best interactivity.
Constructor Summary
Cookie (java.lang.String name, java.lang.String value)
Constructs a cookie with a specified name and value. Constructs a cookie using the specified name and value.
Method Summary
Java.lang.Object Clone ()
Overrides the standard Java.lang.Object.clone method to return a copy of this cookie. Returns a copy of the cookie clone, which overrides the Java.lang.Object.clone () method.
Java.lang.String Getcomment ()
Returns the comment describing the purpose of this cookie, or null if the cookie has no comment. Returns a comment that describes the purpose of the cookie, if no comment is Returns NULL.
Java.lang.String GetDomain ()
Returns the domain name set for this cookie. Returns a cookie domain name. (Domain name specifies the domain in which the cookie is valid, for example: domain=.blog.51cto.com)
Int Getmaxage ()
Returns The maximum age of the cookies, specified in seconds, by default, -1indicating the cookie would persist until browse R shutdown. Returns the maximum valid time, in seconds, of a cookie on the client. The default is-1, which means that the cookie will remain valid until the browser is closed.
Java.lang.String GetName ()
Returns the name of the cookie. Returns the names of the cookies.
Java.lang.String GetPath ()
Returns the "path" on the "server to which" browser Returns this cookie. Returns a cookie that is valid for the URL on the server.
Boolean Getsecure ()
Returns true if the browser is sending cookie only over a secure protocol, or falseif the browser can send cookies using Any protocol. Returns true if the browser only sends cookies under the security protocol. The browser can send cookies using any protocol to return to Fasle.
Java.lang.String GetValue ()
Returns the value of the cookie. Returns the value of a cookie.
Int GetVersion ()
Returns the version of the protocol this cookie complies with. Returns the versions that the cookie content follows. (Currently available only when the value is 1).
void Setcomment (java.lang.String Purpose)
Specifies a comment that describes a cookie ' s purpose. Sets a comment that describes the purpose of the cookie.
void SetDomain (java.lang.String pattern)
Specifies the domain within which this cookie should to be presented. Set the field in which the cookie is used.
void Setmaxage (int expiry)
Sets The maximum age of the cookies in seconds. Set the maximum valid time for cookies.
void SetPath (java.lang.String URI)
Specifies a path for the cookies to which the client should return the cookie. Set a valid path for the cookie.
void SetSecure (Boolean flag)
Indicates to the browser whether the cookies should only be sent using a secure protocol, such as HTTPS or SSL. Setting whether to use security protocols such as H TTPS or SSL to send cookies.
void SetValue (java.lang.String newvalue)
Assigns a new value to a cookie after the cookies is created. Re-assign a new value to a cookie.
void setversion (int v)
Sets The version of the cookie protocol this cookie complies with. Set the protocol versions used by cookies.
Methods inherited from class Java.lang.Object
Equals, Finalize, GetClass, Hashcode, notify, Notifyall, toString, wait, wait, wait
Constructor Detail
Cookies
Public Cookie (java.lang.String name,
              java.lang.String value)
Constructs a cookie with a specified name and value. Creates a cookie using the specified name and value. The name must conform to RFC 2109. That is means it can contain only ASCII alphanumeric characters and cannot contain, commas, or white spaces or semicolons N with a $ character. The cookie ' s name cannot is changed after creation. This name must conform to the RFC 2109 specification. This means that it can contain only ASCII characters and cannot contain commas, semicolons, or spaces, or a string that begins with $, and the name of the cookie cannot be changed after it is created. The value can be anything the server chooses to send. Its value is probably of interest-only to the server. The cookie ' s value can be changed after creation with the  Setvalue&nbs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.