[
https://issues.apache.org/jira/browse/WICKET-5040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13578390#comment-13578390
]
Sven Meier commented on WICKET-5040:
------------------------------------
With commit:80adc54 RestartResponseAtInterceptPageException.InterceptData#get()
checks for existence of a session with Session#exists() before calling
Session#get():
if (Session.exists())
{
return Session.get().getMetaData(key);
}
return null;
This was changed so that RestartResponseAtInterceptPageException#MAPPER doesn't
create a (temporary) session if not needed (e.g. when a resource is requested).
Note that Session#exists()'s javadoc is ambiguous about this detail:
/**
* Checks if the <code>Session</code> threadlocal is set in this thread
*
* @return true if {@link Session#get()} can return the instance of
session, false otherwise
*/
public static boolean exists()
It claims to return true if #get() can return the session. If there's a current
session but it is not set on the ThreadContext yet, #exists() will return
false, but #get() will return the session from the session store.
> Session.exists() returns false when ThreadContext#session is not set to
> current session
> ---------------------------------------------------------------------------------------
>
> Key: WICKET-5040
> URL: https://issues.apache.org/jira/browse/WICKET-5040
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 6.5.0
> Reporter: Sven Meier
> Assignee: Sven Meier
>
> There are several places in Wicket which check for the existence of a Session
> before actually getting a reference to it, e.g. FeedbackCollector:
> public final List<FeedbackMessage> collect(final IFeedbackMessageFilter
> filter)
> {
> ...
> if (includeSession && Session.exists())
> {
>
> messages.addAll(Session.get().getFeedbackMessages().messages(filter));
> }
> }
> If no one has called Session#get(), all calls to Session#exists() return
> false although a session might exist in the session store, i.e. it might just
> not be set to ThreadContext#session already.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira