You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2008/10/22 20:33:51 UTC

svn commit: r707157 - in /myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main: java/org/apache/myfaces/trinidadinternal/context/ java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/ java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtm...

Author: gcrawford
Date: Wed Oct 22 11:33:51 2008
New Revision: 707157

URL: http://svn.apache.org/viewvc?rev=707157&view=rev
Log:
TRINIDAD-1261 remove UIXCookie as the values are no longer used

Removed UIXCookie. 

UIXCookie is supposed to supports the following state:

        * The accessibility mode chosen by the user
        * The TimeZone of the user


The info on the cookie for the tz and accessibility mode are never used.

TimeZone

    * Server: UIXCookie.setTimeZone, the only way to assign
       the UIXCookie tz, is never called on the server.
    * Client: There is a script written to the client in
       HeadRenderer, which on the client writes tz info
       into the uixcookie. However this value is never used
       on either the client or server. It used to be used on
       the server in RequestContextImpl.getTimeZone, but that
       code has been commented out long ago.
    * Conclusion: We're needlessly writing out a cookie script
       when the value set on the client is never used.


Accessibility Mode

    * Server: UIXCookie.setAccessibilityMode, the only way to
       assign the UIXCookie accessibility mode, is never called
    * Client: I see no references on the client to the
       accessibility mode cookie value.
    * Conclusion: I don't see how the mode could be set on
       the cookie. Andy Schwartz, who has worked extensively on
       accessibility issues, thinks this is old code that is no
       longer in use. 

Removed:
    myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/DefaultTimeZoneScriptlet.java
    myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/share/config/UIXCookie.java
Modified:
    myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
    myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
    myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java
    myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js

Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java?rev=707157&r1=707156&r2=707157&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java (original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/RequestContextImpl.java Wed Oct 22 11:33:51 2008
@@ -36,8 +36,6 @@
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 
 import org.apache.myfaces.trinidad.change.ChangeManager;
 import org.apache.myfaces.trinidad.change.SessionChangeManager;
@@ -54,6 +52,8 @@
 import org.apache.myfaces.trinidad.render.CoreRenderer;
 import org.apache.myfaces.trinidad.util.ClassLoaderUtils;
 import org.apache.myfaces.trinidad.util.ComponentUtils;
+import org.apache.myfaces.trinidad.util.ExternalContextUtils;
+import org.apache.myfaces.trinidad.util.TransientHolder;
 import org.apache.myfaces.trinidad.webapp.UploadedFileProcessor;
 import org.apache.myfaces.trinidadinternal.agent.AgentFactory;
 import org.apache.myfaces.trinidadinternal.agent.AgentFactoryImpl;
@@ -65,13 +65,11 @@
 import org.apache.myfaces.trinidadinternal.el.OracleHelpProvider;
 import org.apache.myfaces.trinidadinternal.metadata.RegionMetadata;
 import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
-import org.apache.myfaces.trinidadinternal.share.config.UIXCookie;
 import org.apache.myfaces.trinidadinternal.ui.expl.ColorPaletteUtils;
-import org.apache.myfaces.trinidad.util.ExternalContextUtils;
-import org.apache.myfaces.trinidad.util.TransientHolder;
 import org.apache.myfaces.trinidadinternal.util.nls.LocaleUtils;
 import org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl;
 
+
 /**
  */
 public class RequestContextImpl extends RequestContext
@@ -238,16 +236,7 @@
   { 
     String name = (String) _bean.getProperty(
       RequestContextBean.ACCESSIBILITY_MODE_KEY);
-    if (name == null)
-    {
-      UIXCookie cookie = _getUIXCookie();
-      if (cookie != null)
-      {
-        if (cookie.getAccessibilityMode() != null)
-          name = cookie.getAccessibilityMode().toString();
-      }
-    }
-
+    
     return _ACCESSIBILITY_NAMES.get(name);
   }
 
@@ -779,25 +768,6 @@
     return component;
   }
 
-  private UIXCookie _getUIXCookie()
-  {
-    FacesContext fContext = __getFacesContext();
-    if (fContext == null)
-      return null;
-
-    Object request = fContext.getExternalContext().getRequest();
-    Object response = fContext.getExternalContext().getResponse();
-
-    if ((request instanceof HttpServletRequest) &&
-        (response instanceof HttpServletResponse))
-    {
-      return UIXCookie.getUIXCookie((HttpServletRequest) request,
-                                    (HttpServletResponse) response);
-    }
-
-    return null;
-  }
-
   private Map<UIComponent, Set<UIComponent>> _getPartialListeners()
   {
     if (_partialListeners == null)

Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java?rev=707157&r1=707156&r2=707157&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java (original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/HeadRenderer.java Wed Oct 22 11:33:51 2008
@@ -19,25 +19,18 @@
 package org.apache.myfaces.trinidadinternal.renderkit.core.xhtml;
 
 import java.io.IOException;
-import java.util.TimeZone;
 
 import javax.faces.component.UIComponent;
-import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 
 import org.apache.myfaces.trinidad.bean.FacesBean;
 import org.apache.myfaces.trinidad.bean.PropertyKey;
 import org.apache.myfaces.trinidad.component.html.HtmlHead;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.myfaces.trinidadinternal.share.config.UIXCookie;
-
 import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidad.render.CoreRenderer;
 
+
 /**
  * Renderer for meta data section of the document--a.k.a <head>.
  * <p>
@@ -85,8 +78,6 @@
     _writeGeneratorTag(context);
 
     delegateRenderer(context, arc, comp, bean, _styleSheetRenderer);
-
-    _writeCookieScript(context, arc);
   }
 
   @Override
@@ -122,62 +113,6 @@
 
 
 
-  static private void _writeCookieScript(
-   FacesContext context, RenderingContext arc)
-    throws IOException
-  { 
-    if (_needsCookieScript(context, arc))
-    {
-      XhtmlUtils.addLib(context, arc, "defaultTimeZone");
-    }
-  }
-
-  static private boolean _needsCookieScript(
-    FacesContext context,
-    RenderingContext arc)
-  {
-    ExternalContext externalContext = context.getExternalContext();
-    
-    // Disable the Cookie script for portlets
-    // =-=AEW Right or wrong?
-    String outputMode = arc.getOutputMode();
-    if (XhtmlConstants.OUTPUT_MODE_PORTLET.equals(outputMode))
-      return false;
-
-    // Do not need the cookie script when we have a PartialPageContext
-    if (arc.getPartialPageContext() != null)
-      return false;
-    
-    Object request = externalContext.getRequest();
-    Object response = externalContext.getResponse();
-    if ((request instanceof HttpServletRequest) &&
-        (response instanceof HttpServletResponse))
-    {
-      UIXCookie cookie = UIXCookie.getUIXCookie(
-         (HttpServletRequest) request,
-         (HttpServletResponse) response, false);
-
-      return (((cookie == null) || 
-               _timeZoneIsDefaulting(cookie)) &&
-              _supportsUIXCookie());
-    }
-    
-    return false;
-  }
-
-  static private boolean _timeZoneIsDefaulting(UIXCookie cookie)
-  {
-    TimeZone tz = cookie.getTimeZone();
-    return ((tz == null) || 
-            tz.getID().startsWith("GMT"));
-  }
-
-  static private boolean _supportsUIXCookie()
-  {
-    // =-=AEW We used to have a configuration hook for disabling
-    // the cookie.
-    return true;
-  }
 
   private CoreRenderer _styleSheetRenderer = new StyleSheetRenderer()
   {

Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java?rev=707157&r1=707156&r2=707157&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java (original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java Wed Oct 22 11:33:51 2008
@@ -30,7 +30,6 @@
 
   static final String LOCALE_LIB                   = "Locale";
   static final String LOCALE_INFO_LIB              = "LocaleInfoLib";
-  static final String COOKIES_LIB                  = "Cookies";
   static final String CORE_FORMAT_LIB              = "CoreFormat";
   static final String CHAR_SETS_LIB                = "CharSets";
   static final String DATE_FORMAT_LIB              = "DateFormat";
@@ -60,7 +59,6 @@
     AliasedScriptlet.registerAliases();
     _sLocaleScriptlet.registerSelf();
     _sCoreScriptlet.registerSelf();
-    _sCoreScriptlet.registerSelfWithKey(COOKIES_LIB);
     _sDateFormatScriptlet.registerSelf();
     _sCoreFormatScriptlet.registerSelf();
     _sCharSetsScriptlet.registerSelf();
@@ -75,7 +73,6 @@
     NamedLocaleInfoScriptlet.registerNamedLocales();
     ColorFormatInfoScriptlet.sharedInstance().registerSelf();
     DateFormatInfoScriptlet.sharedInstance().registerSelf();
-    DefaultTimeZoneScriptlet.sharedInstance().registerSelf();
     JspDirScriptlet.sharedInstance().registerSelf();
     ConfigurationScriptlet.sharedInstance().registerSelf();
     GlobalVariablesScriptlet.sharedInstance().registerSelf();

Modified: myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js?rev=707157&r1=707156&r2=707157&view=diff
==============================================================================
--- myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js (original)
+++ myfaces/trinidad/trunk_1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js Wed Oct 22 11:33:51 2008
@@ -4269,62 +4269,6 @@
 
 
 //
-// Set a single value in the Trinidad cookie
-//
-function _setTrCookie(index, value)
-{
-  var arry = _getTrCookie();
-  arry[index] = value;
-
-  // Rebuild the encoded value
-  var encodedValue = arry[0];
-  for (var i = 1; i < arry.length; i++)
-  {
-    encodedValue = encodedValue + "^" + arry[i];
-  }
-
-  _setCookie("oracle.uix", encodedValue);
-}
-
-
-//
-// Extract the decoded form of the Trinidad cookie
-//
-function _getTrCookie()
-{
-  var encodedValue = _getCookie("oracle.uix");
-  var arry;
-  if (encodedValue)
-    arry = encodedValue.split("^");
-  else
-    arry = new Array("0", "", "");
-
-  return arry;
-}
-
-
-//
-// Defaults the time zone
-//
-function _defaultTZ()
-{
-  var tz = _getTrCookie()[2];
-
-  // If the time zone has already been set, then bail:  however,
-  // time zones that start with "GMT" are inherently unreliable,
-  // because they won't track daylight savings.  For such time zones,
-  // always replace the value.
-  if (tz && (tz.indexOf("GMT") != 0))
-  {
-    return;
-  }
-
-  // Set the correct time zone.
-  _setTrCookie(2, _getTimeZoneID());
-}
-
-
-//
 // Compute the time zone ID, of form GMT+-XX:YY
 //
 function _getTimeZoneID()