You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2008/09/15 02:25:51 UTC

svn commit: r695317 - /wicket/sandbox/knopp/experimental/wicket/src/main/java/org/apache/_wicket/request/request/WebRequest.java

Author: ivaynberg
Date: Sun Sep 14 17:25:51 2008
New Revision: 695317

URL: http://svn.apache.org/viewvc?rev=695317&view=rev
Log:
convinence header method

Modified:
    wicket/sandbox/knopp/experimental/wicket/src/main/java/org/apache/_wicket/request/request/WebRequest.java

Modified: wicket/sandbox/knopp/experimental/wicket/src/main/java/org/apache/_wicket/request/request/WebRequest.java
URL: http://svn.apache.org/viewvc/wicket/sandbox/knopp/experimental/wicket/src/main/java/org/apache/_wicket/request/request/WebRequest.java?rev=695317&r1=695316&r2=695317&view=diff
==============================================================================
--- wicket/sandbox/knopp/experimental/wicket/src/main/java/org/apache/_wicket/request/request/WebRequest.java (original)
+++ wicket/sandbox/knopp/experimental/wicket/src/main/java/org/apache/_wicket/request/request/WebRequest.java Sun Sep 14 17:25:51 2008
@@ -16,6 +16,7 @@
  */
 package org.apache._wicket.request.request;
 
+import java.util.Date;
 import java.util.List;
 
 import javax.servlet.http.Cookie;
@@ -71,8 +72,8 @@
 
 	/**
 	 * Returns the value of the specified request header as a <code>long</code> value that
-	 * represents a <code>Date</code> object. Use this method with headers that contain dates,
-	 * such as <code>If-Modified-Since</code>.
+	 * represents a <code>Date</code> object. Use this method with headers that contain dates, such
+	 * as <code>If-Modified-Since</code>.
 	 * 
 	 * @param name
 	 * @return date value of request header
@@ -80,6 +81,24 @@
 	public abstract long getDateHeader(String name);
 
 	/**
+	 * Convenience method for retrieving If-Modified-Since header.
+	 * 
+	 * @return date representing the header or <code>null</code> if not set
+	 */
+	public final Date getIfModifiedSinceHeader()
+	{
+		final long header = getDateHeader("If-Modified-Since");
+		if (header >= 0)
+		{
+			return new Date(header);
+		}
+		else
+		{
+			return null;
+		}
+	}
+
+	/**
 	 * Marker parameter for AjaxRequest.
 	 */
 	public static final String PARAM_AJAX = "wicket:ajax";
@@ -88,8 +107,7 @@
 	 * Returns whether this request is an Ajax request. This implementation only checks for value of
 	 * wicket:ajax url parameter. Subclasses can use other approach.
 	 * 
-	 * @return <code>true</code> if this request is an ajax request, <code>false</codE>
-	 *         otherwise.
+	 * @return <code>true</code> if this request is an ajax request, <code>false</codE> otherwise.
 	 */
 	public boolean isAjax()
 	{
@@ -97,4 +115,3 @@
 	}
 
 }
-