Author: jcompagner
Date: Mon Mar 24 08:16:59 2008
New Revision: 640440

URL: http://svn.apache.org/viewvc?rev=640440&view=rev
Log:
WICKET-1288 Make Cookie-Detection possible without JavaScript

Modified:
    
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/ClientProperties.java

Modified: 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/ClientProperties.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/ClientProperties.java?rev=640440&r1=640439&r2=640440&view=diff
==============================================================================
--- 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/ClientProperties.java
 (original)
+++ 
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/ClientProperties.java
 Mon Mar 24 08:16:59 2008
@@ -19,7 +19,10 @@
 import java.lang.reflect.Field;
 import java.util.TimeZone;
 
+import javax.servlet.http.Cookie;
+
 import org.apache.wicket.IClusterable;
+import org.apache.wicket.RequestCycle;
 import org.apache.wicket.markup.html.pages.BrowserInfoPage;
 import org.apache.wicket.util.string.AppendingStringBuffer;
 
@@ -299,12 +302,12 @@
                                                        dstOffset = 
dstOffset.substring(1);
                                                }
                                                dstTimeZone = 
TimeZone.getTimeZone("GMT" + ((offset > 0) ? "+" : "-") +
-                                                               dstOffset);
+                                                       dstOffset);
                                        }
                                        // if the dstTimezone (1 July) has a 
different offset then
                                        // the real time zone (1 January) try 
to combine the 2.
                                        if (dstTimeZone != null &&
-                                                       
dstTimeZone.getRawOffset() != timeZone.getRawOffset())
+                                               dstTimeZone.getRawOffset() != 
timeZone.getRawOffset())
                                        {
                                                int dstSaving = 
dstTimeZone.getRawOffset() - timeZone.getRawOffset();
                                                String[] availableIDs = 
TimeZone.getAvailableIDs(timeZone.getRawOffset());
@@ -419,6 +422,11 @@
         */
        public boolean isCookiesEnabled()
        {
+               if (!cookiesEnabled && RequestCycle.get() != null)
+               {
+                       Cookie[] cookies = 
((WebRequest)RequestCycle.get().getRequest()).getCookies();
+                       cookiesEnabled = cookies != null ? cookies.length > 0 : 
false;
+               }
                return cookiesEnabled;
        }
 
@@ -943,7 +951,7 @@
         *            scrolling region.
         */
        public void setQuirkIETablePercentWidthScrollbarError(
-                       boolean quirkIETablePercentWidthScrollbarError)
+               boolean quirkIETablePercentWidthScrollbarError)
        {
                this.quirkIETablePercentWidthScrollbarError = 
quirkIETablePercentWidthScrollbarError;
        }
@@ -964,7 +972,7 @@
         *            hierarchies from a DOM.
         */
        public void setQuirkMozillaPerformanceLargeDomRemove(
-                       boolean quirkMozillaPerformanceLargeDomRemove)
+               boolean quirkMozillaPerformanceLargeDomRemove)
        {
                this.quirkMozillaPerformanceLargeDomRemove = 
quirkMozillaPerformanceLargeDomRemove;
        }
@@ -1055,8 +1063,8 @@
 
                        // Ignore these fields
                        if (field.getName().equals("serialVersionUID") == false 
&&
-                                       field.getName().startsWith("class$") == 
false &&
-                                       field.getName().startsWith("timeZone") 
== false)
+                               field.getName().startsWith("class$") == false &&
+                               field.getName().startsWith("timeZone") == false)
                        {
 
                                field.setAccessible(true);


Reply via email to