[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...
Shane Bryzak
Shane_Bryzak at symantec.com
Thu Feb 1 20:41:47 EST 2007
User: sbryzak2
Date: 07/02/01 20:41:47
Modified: src/main/org/jboss/seam/core Selector.java
Log:
JBSEAM-758
Revision Changes Path
1.2 +80 -83 jboss-seam/src/main/org/jboss/seam/core/Selector.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Selector.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Selector.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Selector.java 18 Dec 2006 11:52:49 -0000 1.1
+++ Selector.java 2 Feb 2007 01:41:47 -0000 1.2
@@ -1,11 +1,8 @@
package org.jboss.seam.core;
-
import java.io.Serializable;
-
import javax.faces.context.FacesContext;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
-
/**
* Support for selector objects which remember their selection as a cookie
*
@@ -24,13 +21,11 @@
{
return cookieEnabled;
}
-
public void setCookieEnabled(boolean cookieEnabled)
{
setDirty(this.cookieEnabled, cookieEnabled);
this.cookieEnabled = cookieEnabled;
}
-
/**
* The max age of the cookie
* @return 1 year by default
@@ -39,7 +34,6 @@
{
return cookieMaxAge;
}
-
public void setCookieMaxAge(int cookieMaxAge)
{
this.cookieMaxAge = cookieMaxAge;
@@ -55,18 +49,21 @@
*/
protected String getCookieValue()
{
+ Cookie cookie = null;
+
if ( isCookieEnabled() )
{
- Cookie cookie = (Cookie) FacesContext.getCurrentInstance().getExternalContext()
- .getRequestCookieMap().get( getCookieName() );
- return cookie==null ? null : cookie.getValue();
- }
- else
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ if (ctx != null)
{
- return null;
+ cookie = (Cookie) ctx.getExternalContext().getRequestCookieMap()
+ .get( getCookieName() );
}
}
+ return cookie==null ? null : cookie.getValue();
+ }
+
/**
* Set the cookie
*/
More information about the jboss-cvs-commits
mailing list