You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by th...@apache.org on 2009/01/25 22:36:14 UTC
svn commit: r737583 -
/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
Author: thrantal
Date: Sun Jan 25 21:36:14 2009
New Revision: 737583
URL: http://svn.apache.org/viewvc?rev=737583&view=rev
Log:
WICKET-1910: Restoring the original fix as requested by Juergen on the mailing list. It seems that now that Juergen fixed the WicketTester issue, this is all harmless goodness.
Modified:
wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java?rev=737583&r1=737582&r2=737583&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java Sun Jan 25 21:36:14 2009
@@ -16,12 +16,11 @@
*/
package org.apache.wicket.protocol.http.servlet;
+import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
-
import org.apache.wicket.Application;
import org.apache.wicket.IRedirectListener;
import org.apache.wicket.RequestContext;
@@ -60,6 +59,9 @@
private int previousUrlDepth;
+ /** Marks this request as an ajax request. */
+ private boolean ajax;
+
private boolean forceNewVersion = false;
/**
@@ -71,6 +73,21 @@
public ServletWebRequest(final HttpServletRequest httpServletRequest)
{
this.httpServletRequest = httpServletRequest;
+
+ ajax = false;
+ String ajaxHeader = httpServletRequest.getHeader("Wicket-Ajax");
+ if (Strings.isEmpty(ajaxHeader) == false)
+ {
+ try
+ {
+ ajax = Strings.isTrue(ajaxHeader);
+ }
+ catch (StringValueConversionException e)
+ {
+ // We are not interested in this exception but we log it anyway
+ log.debug("Couldn't convert the Wicket-Ajax header: " + ajaxHeader);
+ }
+ }
}
/**
@@ -412,6 +429,28 @@
}
/**
+ * This will return true if the header "Wicket-Ajax" is set.
+ *
+ * @see org.apache.wicket.protocol.http.WebRequest#isAjax()
+ */
+ @Override
+ public final boolean isAjax()
+ {
+ return ajax;
+ }
+
+ /**
+ * THIS IS FOR WICKET INTERNAL USE ONLY. DO NOT USE IT IN YOUR APPLICATION.
+ *
+ * @param ajax
+ * ajax
+ */
+ public final void setAjax(boolean ajax)
+ {
+ this.ajax = ajax;
+ }
+
+ /**
* This method by default calls isAjax(), wicket ajax request do have an header set. And for all
* the ajax request the versioning should be merged with the previous one. And when it sees that
* the current request is a redirect to page request the version will also be merged with the
@@ -497,30 +536,6 @@
}
/**
- * @see org.apache.wicket.protocol.http.WebRequest#isAjax()
- *
- * @FIXME in 1.5 see wicket-1910 and revision 730362
- */
- @Override
- public boolean isAjax()
- {
- String ajaxHeader = httpServletRequest.getHeader("Wicket-Ajax");
- if (Strings.isEmpty(ajaxHeader) == false)
- {
- try
- {
- return Strings.isTrue(ajaxHeader);
- }
- catch (StringValueConversionException e)
- {
- // We are not interested in this exception but we log it anyway
- log.debug("Couldn't convert the Wicket-Ajax header: " + ajaxHeader);
- }
- }
- return false;
- }
-
- /**
* @see java.lang.Object#toString()
*/
@Override