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 2010/10/20 00:11:26 UTC

svn commit: r1024430 - /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/AbstractHttpSessionStore.java

Author: ivaynberg
Date: Tue Oct 19 22:11:26 2010
New Revision: 1024430

URL: http://svn.apache.org/viewvc?rev=1024430&view=rev
Log:

Issue: WICKET-3120

Modified:
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/AbstractHttpSessionStore.java

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/AbstractHttpSessionStore.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/AbstractHttpSessionStore.java?rev=1024430&r1=1024429&r2=1024430&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/AbstractHttpSessionStore.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/AbstractHttpSessionStore.java Tue Oct 19 22:11:26 2010
@@ -137,7 +137,7 @@ public abstract class AbstractHttpSessio
 		onBind(request, newSession);
 
 		WebRequest webRequest = toWebRequest(request);
-		HttpSession httpSession = getHttpSession(webRequest);
+		HttpSession httpSession = getHttpSession(webRequest, true);
 
 		// register an unbinding listener for cleaning up
 		String applicationKey = application.getApplicationKey();
@@ -297,7 +297,26 @@ public abstract class AbstractHttpSessio
 	 */
 	protected final HttpSession getHttpSession(WebRequest request)
 	{
-		return request.getHttpServletRequest().getSession(false);
+		return getHttpSession(request, false);
+	}
+
+	/**
+	 * Gets the underlying HttpSession object. If {@code create} is set to true a new instance of
+	 * http session will be created if one does not already exist.
+	 * <p>
+	 * WARNING: it is a bad idea to depend on the http session object directly. Please use the
+	 * classes and methods that are exposed by Wicket instead. Send an email to the mailing list in
+	 * case it is not clear how to do things or you think you miss functionality which causes you to
+	 * depend on this directly.
+	 * </p>
+	 * 
+	 * @param request
+	 * 
+	 * @return The underlying HttpSession object, or {@code null}
+	 */
+	protected final HttpSession getHttpSession(WebRequest request, boolean create)
+	{
+		return request.getHttpServletRequest().getSession(create);
 	}
 
 	/**