Author: mgrigorov
Date: Sun Feb 27 09:57:03 2011
New Revision: 1075015
URL: http://svn.apache.org/viewvc?rev=1075015&view=rev
Log:
WICKET-3477 Exception when setting session default timezone with
GatherExtendedBrowserInfo
Add javadoc explaining that Session#getClientInfo() should not be called in
custom Session's constructor.
Modified:
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebSession.java
Modified:
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebSession.java
URL:
http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebSession.java?rev=1075015&r1=1075014&r2=1075015&view=diff
==============================================================================
---
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebSession.java
(original)
+++
wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebSession.java
Sun Feb 27 09:57:03 2011
@@ -186,6 +186,16 @@ public class WebSession extends Session
/**
* {@inheritDoc}
+ *
+ * <p>
+ * To gather the client information this implementation redirects
temporarily to a special page
+ * ({@link BrowserInfoPage}).
+ * <p>
+ * Note: Do <strong>not</strong> call this method from your custom
{@link Session} constructor
+ * because the temporary page needs a constructed {@link Session} to be
able to work.
+ * <p>
+ * If you need to set a default client info property then better use
+ * {@link #setClientInfo(org.apache.wicket.request.ClientInfo)}
directly.
*/
@Override
public WebClientInfo getClientInfo()
@@ -204,7 +214,16 @@ public class WebSession extends Session
Request request =
requestCycle.getRequest();
IRequestHandler activeRequestHandler =
requestCycle.getActiveRequestHandler();
- String url =
requestCycle.urlFor(activeRequestHandler).toString();
+
+ final String url;
+ if (activeRequestHandler != null)
+ {
+ url =
requestCycle.urlFor(activeRequestHandler).toString();
+ }
+ else
+ {
+ url =
requestCycle.urlFor(getApplication().getHomePage(), null).toString();
+ }
String relativeUrl =
requestCycle.getUrlRenderer()
.renderContextPathRelativeUrl(url);
Page browserInfoPage =
newBrowserInfoPage(relativeUrl);