You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Funk (JIRA)" <ji...@apache.org> on 2007/09/27 09:39:50 UTC
[jira] Commented: (WICKET-1010) Contract of Session.attach() and
Session.detach()
[ https://issues.apache.org/jira/browse/WICKET-1010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530650 ]
Martin Funk commented on WICKET-1010:
-------------------------------------
If I interpret this right:
http://www.nabble.com/Contract-of-Session.attach%28%29-and-Session.detach%28%29-tf4517840.html#a12887573
the patch should read like this:
$ svn diff ./jdk-1.4/wicket/src/main/
Index: jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
===================================================================
--- jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java (revision 579923)
+++ jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java (working copy)
@@ -305,7 +305,22 @@
*/
public static void unset()
{
- current.set(null);
+ try
+ {
+ Session session = (Session)current.get();
+ if (session != null)
+ {
+ session.detach();
+ }
+ }
+ catch (RuntimeException re)
+ {
+ log.error("there was an error unsetting the current session", re);
+ }
+ finally
+ {
+ current.set(null);
+ }
}
/** A number to generate names for auto create pagemaps */
> Contract of Session.attach() and Session.detach()
> -------------------------------------------------
>
> Key: WICKET-1010
> URL: https://issues.apache.org/jira/browse/WICKET-1010
> Project: Wicket
> Issue Type: Bug
> Reporter: Martin Funk
>
> What is the contract of Session.attach() and Session.detach() ?
> Especially, is it intended that after a call to attach() that there will
> be at least one call to detach() before the request goes back to the client?
> If that's the case, then there might be a bug in Session and I propose
> the following patch on org.apache.wicket.Session
> Index: .
> ===================================================================
> --- . (revision 579354)
> +++ . (working copy)
> @@ -305,6 +305,11 @@
> */
> public static void unset()
> {
> + Session session = (Session)current.get();
> + if (session != null)
> + {
> + session.detach();
> + }
> current.set(null);
> }
> In my current project well fell over this looking at:
> WicketFilter.getLastModified(final HttpServletRequest servletRequest)
> where cachable resources lead over Session.findOrCreate to Session.set(Session) to Session.attach()
> but the Session.unset() doesn't lead to a Session.detach()
> Martin
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.