You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/04/14 10:40:38 UTC

git commit: WICKET-5557 Don't cache the result of AuthenticatedWebApplication#getWebSessionClass()

Repository: wicket
Updated Branches:
  refs/heads/master c61455e9a -> d3dee42da


WICKET-5557 Don't cache the result of AuthenticatedWebApplication#getWebSessionClass()

(cherry picked from commit ea68c8623196c7a91b9f7d8ce6b43f2a57013c42)


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/d3dee42d
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/d3dee42d
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/d3dee42d

Branch: refs/heads/master
Commit: d3dee42da6cbcc53158cec2ed66fcea2d13ef075
Parents: c61455e
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Apr 14 11:32:23 2014 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Apr 14 11:33:34 2014 +0300

----------------------------------------------------------------------
 .../AuthenticatedWebApplication.java            | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/d3dee42d/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebApplication.java
----------------------------------------------------------------------
diff --git a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebApplication.java b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebApplication.java
index a95e5b2..b3b673a 100644
--- a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebApplication.java
+++ b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebApplication.java
@@ -16,8 +16,6 @@
  */
 package org.apache.wicket.authroles.authentication;
 
-import java.lang.ref.WeakReference;
-
 import org.apache.wicket.Component;
 import org.apache.wicket.Page;
 import org.apache.wicket.RestartResponseAtInterceptPageException;
@@ -44,19 +42,6 @@ public abstract class AuthenticatedWebApplication extends WebApplication
 		IRoleCheckingStrategy,
 		IUnauthorizedComponentInstantiationListener
 {
-	/** Subclass of authenticated web session to instantiate */
-	private final WeakReference<Class<? extends AbstractAuthenticatedWebSession>> webSessionClassRef;
-
-	/**
-	 * Constructor
-	 */
-	public AuthenticatedWebApplication()
-	{
-		// Get web session class to instantiate
-		webSessionClassRef = new WeakReference<Class<? extends AbstractAuthenticatedWebSession>>(
-			getWebSessionClass());
-	}
-
 	/**
 	 * @see org.apache.wicket.protocol.http.WebApplication#init()
 	 */
@@ -124,16 +109,17 @@ public abstract class AuthenticatedWebApplication extends WebApplication
 	@Override
 	public Session newSession(final Request request, final Response response)
 	{
+		Class<? extends AbstractAuthenticatedWebSession> webSessionClass = getWebSessionClass();
 		try
 		{
-			return webSessionClassRef.get()
+			return webSessionClass
 				.getDeclaredConstructor(Request.class)
 				.newInstance(request);
 		}
 		catch (Exception e)
 		{
 			throw new WicketRuntimeException("Unable to instantiate web session " +
-				webSessionClassRef.get(), e);
+				webSessionClass, e);
 		}
 	}