|
Oracle© Fusion Middleware Java API Reference for Oracle ADF Faces 11g Release 1 (11.1.1.7.0) E10684-08 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
javax.servlet.http.Cookie
oracle.adf.view.rich.remote.CookieWrapper
public class CookieWrapper
The RemoteApplicationFramework needs to use two cookie types on a regular basis. The first is the javax.servlet.http.Cookie which is required on the producer side in order to be served from some of our ServletWrappers. The second is the org.apache.http.cookie.SetCookie2 which is used by the Apache HttpComponents used to connect to the client from the producer. We often need to use these cookie types at different times and casting the cookies from one format to another is confusing. <p/> This class extends both the javax.servlet.http.Cookie and implements the org.apache.http.cookie.SetCookie2 interface and makes them serializable. There are copy constructors designed for either of these cookie types in order to create a new cookie wrapper that should have the capabilities of both. By using the CookieWrapper for all cookies in the RemoteApplication framework, we can ensure that our handling of cookies between these two frameworks is less error prone.
Constructor Summary | |
---|---|
CookieWrapper() |
|
CookieWrapper(javax.servlet.http.Cookie cookie) Creates a new CookieWrapper based on a javax.servlet.http.Cookie. |
|
CookieWrapper(org.apache.http.cookie.Cookie cookie) Creates a new CookieWrapper based on org.apache.http.cookie |
|
CookieWrapper(CookieWrapper cookie) This is a copy constructor which creates a new CookieWrapper based on another CookieWrapper. |
|
CookieWrapper(java.lang.String name, java.lang.String value) Creates a new Cookie using a name and value pair |
Method Summary | |
---|---|
java.lang.Object |
clone() |
boolean |
equals(java.lang.Object object) Checks to see whether these cookies are "functionally" equivalent by checking the equivalency of the object's "toString()" function which has all the relivant information. |
java.lang.String |
getCommentURL() Returns the comment URL. |
java.util.Date |
getExpiryDate() Returns the expiration Date of the cookie, or null if none exists. |
int |
getMaxAge() Computes the max age of this cookie based on the ExpiryDate compared to the local time. |
java.lang.String |
getName() Returns the name of the cookie. |
int[] |
getPorts() Get the Port attribute. |
int |
hashCode() Returns a hashcode based on name and value. |
boolean |
isExpired(java.util.Date date) Returns true if this cookie is expired as of the procided date. |
boolean |
isPersistent() Returns false if the cookie should be discarded at the end of the "session"; true otherwise. |
boolean |
isSecure() Indicates whether this cookie requires a secure connection. |
void |
readExternal(java.io.ObjectInput in) Reads the CookieWrapper from the input stream. |
void |
setCommentURL(java.lang.String commentURL) Sets the comment URL |
void |
setDiscard(boolean discard) Set the Discard attribute. |
void |
setExpiryDate(java.util.Date expiryDate) Sets the expiration Date of the cookie. |
void |
setMaxAge(int expiry) Sets the cookie's max age in seconds ala the javax.servlet.http.Cookie spec. |
void |
setPorts(int[] ports) Sets the Port attribute. |
void |
setSecure(boolean secure) Sets whether this cookie requires a secure connection. |
java.lang.String |
toString() |
void |
writeExternal(java.io.ObjectOutput out) Writes the object to the output stream. |
Methods inherited from class javax.servlet.http.Cookie |
---|
getComment, getDomain, getPath, getSecure, getValue, getVersion, setComment, setDomain, setPath, setValue, setVersion |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.http.cookie.SetCookie |
---|
setComment, setDomain, setPath, setValue, setVersion |
Methods inherited from interface org.apache.http.cookie.Cookie |
---|
getComment, getDomain, getPath, getValue, getVersion |
Constructor Detail |
---|
public CookieWrapper()
public CookieWrapper(java.lang.String name, java.lang.String value)
name
-value
-public CookieWrapper(javax.servlet.http.Cookie cookie)
cookie
-public CookieWrapper(CookieWrapper cookie)
cookie
-public CookieWrapper(org.apache.http.cookie.Cookie cookie)
cookie
-Method Detail |
---|
public java.lang.String getName()
getName
in interface org.apache.http.cookie.Cookie
getName
in class javax.servlet.http.Cookie
public void setCommentURL(java.lang.String commentURL)
setCommentURL
in interface org.apache.http.cookie.SetCookie2
commentURL
-public java.lang.String getCommentURL()
getCommentURL
in interface org.apache.http.cookie.Cookie
public void setMaxAge(int expiry)
null
. <p/> If the expiry is greater then zero, then the ExpiryDate will be computed from the current System time and saved accordingly. <p/> If the expiry is zero, then the ExpiryDate will be set to the current System time -1 milisecond to indicate the that cookie has already expired.setMaxAge
in class javax.servlet.http.Cookie
expiry
-public int getMaxAge()
getMaxAge
in class javax.servlet.http.Cookie
public void setExpiryDate(java.util.Date expiryDate)
setExpiryDate
in interface org.apache.http.cookie.SetCookie
expiryDate
- the Date or null
is this cookie has no expiration.public java.util.Date getExpiryDate()
null
if none exists.getExpiryDate
in interface org.apache.http.cookie.Cookie
null
public boolean isPersistent()
false
if the cookie should be discarded at the end of the "session"; true
otherwise.isPersistent
in interface org.apache.http.cookie.Cookie
public void setPorts(int[] ports)
setPorts
in interface org.apache.http.cookie.SetCookie2
ports
-public int[] getPorts()
getPorts
in interface org.apache.http.cookie.Cookie
public void setSecure(boolean secure)
setSecure
in interface org.apache.http.cookie.SetCookie
setSecure
in class javax.servlet.http.Cookie
secure
-public void setDiscard(boolean discard)
setDiscard
in interface org.apache.http.cookie.SetCookie2
discard
-public boolean isSecure()
isSecure
in interface org.apache.http.cookie.Cookie
true
if this cookie should only be sent over secure connections, false
otherwise.public boolean isExpired(java.util.Date date)
true
if this cookie is expired as of the procided date.isExpired
in interface org.apache.http.cookie.Cookie
date
- Current timetrue
if the cookie has expired.java.lang.IllegalArgumentException
- is Date is nullpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
object
-public java.lang.Object clone()
clone
in class javax.servlet.http.Cookie
public java.lang.String toString()
toString
in class java.lang.Object
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
out
- the ObjectOutput objectjava.io.IOException
- if something goes wrongpublic void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
in
- the ObjectInputjava.io.IOException
- if something goes wrong with the IOjava.lang.ClassNotFoundException
- if we have trouble recieving an object member field.
|
Oracle© Fusion Middleware Java API Reference for Oracle ADF Faces 11g Release 1 (11.1.1.7.0) E10684-08 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |