You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jo...@apache.org on 2007/04/13 06:27:25 UTC
svn commit: r528350 - in /incubator/wicket/branches/wicket-1.x:
jdk-1.4/wicket/src/main/java/org/apache/wicket/
jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/
jdk-1.4/wicket/src/main/java/org/apache/wicket/request/
jdk-1.4/wicket/src/mai...
Author: jonl
Date: Thu Apr 12 21:27:24 2007
New Revision: 528350
URL: http://svn.apache.org/viewvc?view=rev&rev=528350
Log:
Moved call to session factory to Session.get(), removed session setting on PageMaps, moved session factory to Application and removed getDefaultSessionFactory.
Modified:
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/AccessStackPageMap.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IPageMap.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IRequestCycleFactory.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/session/ISessionStore.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java
incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/test/java/org/apache/wicket/examples/panels/signin/CookieTest.java
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/AccessStackPageMap.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/AccessStackPageMap.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/AccessStackPageMap.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/AccessStackPageMap.java Thu Apr 12 21:27:24 2007
@@ -124,12 +124,10 @@
*
* @param name
* The name of this page map
- * @param session
- * The session holding this page map
*/
- public AccessStackPageMap(final String name, final Session session)
+ public AccessStackPageMap(final String name)
{
- super(name, session);
+ super(name);
}
/**
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java Thu Apr 12 21:27:24 2007
@@ -536,6 +536,11 @@
}
/**
+ * @return Request cycle factory for this kind of session.
+ */
+ protected abstract IRequestCycleFactory getRequestCycleFactory();
+
+ /**
* Gets the {@link RequestLogger}.
*
* @return The RequestLogger
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IPageMap.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IPageMap.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IPageMap.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IPageMap.java Thu Apr 12 21:27:24 2007
@@ -72,11 +72,6 @@
String getName();
/**
- * @return The session that this PageMap is in.
- */
- Session getSession();
-
- /**
* @return Size of this page map in bytes, including a sum of the sizes of
* all the pages it contains.
*/
@@ -143,11 +138,4 @@
* The entry to remove
*/
void removeEntry(final IPageMapEntry entry);
-
- /**
- * @param session
- * Session to set
- */
- void setSession(final Session session);
-
}
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IRequestCycleFactory.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IRequestCycleFactory.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IRequestCycleFactory.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IRequestCycleFactory.java Thu Apr 12 21:27:24 2007
@@ -19,22 +19,22 @@
/**
* Factory for creating request cycles for a session.
- *
+ *
* @author Jonathan Locke
*/
public interface IRequestCycleFactory extends IClusterable
{
/**
* Creates a new RequestCycle object.
- *
- * @param session
- * The session
+ *
+ * @param application
+ * The application
* @param request
* The request
* @param response
* The response
* @return The cycle
*/
- RequestCycle newRequestCycle(final Session session, final Request request,
+ RequestCycle newRequestCycle(final Application application, final Request request,
final Response response);
}
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java Thu Apr 12 21:27:24 2007
@@ -24,8 +24,8 @@
import org.apache.wicket.session.pagemap.IPageMapEntry;
import org.apache.wicket.util.lang.Objects;
-
/**
+ * @author Jonathan Locke
* @author jcompagner
*/
public abstract class PageMap implements IClusterable, IPageMap
@@ -74,10 +74,6 @@
/** Next available page identifier in this page map. */
private int pageId = 0;
- /** The session where this PageMap resides */
- private transient Session session;
-
-
/**
* Constructor
*
@@ -86,17 +82,11 @@
* @param session
* The session holding this page map
*/
- public PageMap(String name, Session session)
+ public PageMap(String name)
{
this.name = name;
- if (session == null)
- {
- throw new IllegalArgumentException("session must be not null");
- }
- this.session = session;
}
-
/**
* @see org.apache.wicket.IPageMap#attributeForId(int)
*/
@@ -157,7 +147,7 @@
*/
public final IPageMapEntry getEntry(final int id)
{
- return (IPageMapEntry)session.getAttribute(attributeForId(id));
+ return (IPageMapEntry)Session.get().getAttribute(attributeForId(id));
}
/**
@@ -169,11 +159,11 @@
}
/**
- * @see org.apache.wicket.IPageMap#getSession()
+ * @return Session this page map is in
*/
public final Session getSession()
{
- return session;
+ return Session.get();
}
/**
@@ -293,7 +283,7 @@
clear();
// Then remove the pagemap itself
- session.removePageMap(this);
+ Session.get().removePageMap(this);
}
/**
@@ -311,14 +301,6 @@
public abstract void removeEntry(final IPageMapEntry entry);
/**
- * @see org.apache.wicket.IPageMap#setSession(org.apache.wicket.Session)
- */
- public final void setSession(final Session session)
- {
- this.session = session;
- }
-
- /**
* @see java.lang.Object#toString()
*/
public String toString()
@@ -326,12 +308,12 @@
return "[PageMap name=" + name + "]";
}
-
/**
* @return List of entries in this page map
*/
private final List getEntries()
{
+ final Session session = Session.get();
final List attributes = session.getAttributeNames();
final List list = new ArrayList();
for (final Iterator iterator = attributes.iterator(); iterator.hasNext();)
@@ -347,7 +329,7 @@
protected final void dirty()
{
- session.dirtyPageMap(this);
+ Session.get().dirtyPageMap(this);
}
/**
@@ -356,6 +338,7 @@
*/
protected final void visitEntries(final IVisitor visitor)
{
+ final Session session = Session.get();
final List attributes = session.getAttributeNames();
for (final Iterator iterator = attributes.iterator(); iterator.hasNext();)
{
@@ -366,7 +349,6 @@
}
}
}
-
/**
* @return The attribute prefix for this page map
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java Thu Apr 12 21:27:24 2007
@@ -259,7 +259,6 @@
/** The processor for this request. */
protected final IRequestCycleProcessor processor;
-
/** The current request. */
protected Request request;
@@ -267,23 +266,23 @@
protected Response response;
/** The session object. */
- protected final Session session;
+ protected Session session;
/**
* Constructor. This instance will be set as the current one for this
* thread.
*
- * @param session
- * The session
+ * @param application
+ * The application
* @param request
* The request
* @param response
* The response
*/
- protected RequestCycle(final Session session, final Request request, final Response response)
+ protected RequestCycle(final Application application, final Request request,
+ final Response response)
{
- this.application = session.getApplication();
- this.session = session;
+ this.application = application;
this.request = request;
this.response = response;
this.originalResponse = response;
@@ -293,7 +292,6 @@
current.set(this);
}
-
/**
* Gets the application object.
*
@@ -415,12 +413,24 @@
}
/**
+ * @return True if a session exists for the calling thread
+ */
+ private boolean sessionExists()
+ {
+ return Session.exists();
+ }
+
+ /**
* Gets the session.
*
* @return Session object
*/
public final Session getSession()
{
+ if (session == null)
+ {
+ session = Session.get();
+ }
return session;
}
@@ -723,10 +733,10 @@
}
else
{
-
page.setPageStateless(Boolean.FALSE);
+
// make session non-volatile if not already so
- Session session = Session.get();
+ final Session session = getSession();
if (session.isTemporary())
{
session.bind();
@@ -791,7 +801,7 @@
public final CharSequence urlFor(final Page page)
{
IRequestTarget target = new PageRequestTarget(page);
- Session.get().touch(((IPageRequestTarget)target).getPage());
+ getSession().touch(((IPageRequestTarget)target).getPage());
return urlFor(target);
}
@@ -872,7 +882,10 @@
// the session
try
{
- session.cleanupFeedbackMessages();
+ if (sessionExists())
+ {
+ getSession().cleanupFeedbackMessages();
+ }
}
catch (RuntimeException re)
{
@@ -881,13 +894,16 @@
}
// At the end of our response, let the session do some book keeping
- try
+ if (sessionExists())
{
- session.update();
- }
- catch (RuntimeException re)
- {
- log.error("there was an error updating the session " + session + ".", re);
+ try
+ {
+ getSession().update();
+ }
+ catch (RuntimeException re)
+ {
+ log.error("there was an error updating the session " + session + ".", re);
+ }
}
try
@@ -904,14 +920,17 @@
}
// clear the used pagemap for this thread,
- try
- {
- session.requestDetached();
- }
- catch (RuntimeException re)
+ if (sessionExists())
{
- log.error("there was an error detaching the request from the session " + session + ".",
- re);
+ try
+ {
+ getSession().requestDetached();
+ }
+ catch (RuntimeException re)
+ {
+ log.error("there was an error detaching the request from the session " + session
+ + ".", re);
+ }
}
if (getResponse() instanceof BufferedWebResponse)
@@ -953,9 +972,6 @@
*/
private void prepare()
{
- // Prepare session for request
- session.init();
-
// Event callback
onBeginRequest();
}
@@ -1153,7 +1169,10 @@
private final void threadDetach()
{
// Detach from session
- session.detach();
+ if (sessionExists())
+ {
+ getSession().detach();
+ }
if (getRedirect())
{
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java Thu Apr 12 21:27:24 2007
@@ -235,11 +235,13 @@
*/
public static Session get()
{
- final Session session = (Session)current.get();
+ Session session = (Session)current.get();
if (session == null)
{
- throw new WicketRuntimeException("there is no session attached to current thread "
- + Thread.currentThread().getName());
+ final RequestCycle cycle = RequestCycle.get();
+ session = Application.get().getSessionFactory().newSession(cycle.getRequest(),
+ cycle.getResponse());
+ set(session);
}
return session;
}
@@ -397,8 +399,7 @@
*/
public void cleanupFeedbackMessages()
{
-
- // if session scoped, rendered messages got indeed cleaned up, mark the
+ // If session scoped, rendered messages got indeed cleaned up, mark the
// session as dirty
if (feedbackMessages.clear(RENDERED_SESSION_SCOPED_MESSAGES) > 0)
{
@@ -753,25 +754,6 @@
}
/**
- * Set the session for each PageMap
- */
- public final void init()
- {
- // Set session on each page map
- visitPageMaps(new IPageMapVisitor()
- {
- public void pageMap(IPageMap pageMap)
- {
- if (log.isDebugEnabled())
- {
- log.debug("updateSession(): Attaching session to PageMap " + pageMap);
- }
- pageMap.setSession(Session.this);
- }
- });
- }
-
- /**
* Invalidates this session.
*/
public void invalidate()
@@ -810,30 +792,13 @@
}
// Create new page map
- final IPageMap pageMap = getSessionStore().createPageMap(name, this);
+ final IPageMap pageMap = getSessionStore().createPageMap(name);
setAttribute(attributeForPageMapName(name), pageMap);
dirty();
return pageMap;
}
/**
- * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
- *
- * Creates a new RequestCycle for the given request and response using the
- * session's request cycle factory.
- *
- * @param request
- * The request
- * @param response
- * The response
- * @return The new request cycle.
- */
- public final RequestCycle newRequestCycle(final Request request, final Response response)
- {
- return getRequestCycleFactory().newRequestCycle(this, request, response);
- }
-
- /**
* Gets a page map for the given name, automatically creating it if need be.
*
* @param pageMapName
@@ -1088,11 +1053,6 @@
}
return Collections.EMPTY_LIST;
}
-
- /**
- * @return Request cycle factory for this kind of session.
- */
- protected abstract IRequestCycleFactory getRequestCycleFactory();
/**
* Gets the session store.
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java Thu Apr 12 21:27:24 2007
@@ -49,14 +49,12 @@
}
/**
- * @see org.apache.wicket.session.ISessionStore#createPageMap(java.lang.String,
- * org.apache.wicket.Session)
+ * @see org.apache.wicket.session.ISessionStore#createPageMap(java.lang.String)
*/
- public IPageMap createPageMap(String name, Session session)
+ public IPageMap createPageMap(String name)
{
- return new AccessStackPageMap(name, session);
+ return new AccessStackPageMap(name);
}
-
/**
* @see org.apache.wicket.session.ISessionStore#getAttribute(org.apache.wicket.Request,
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java Thu Apr 12 21:27:24 2007
@@ -201,13 +201,15 @@
this.context);
this.servletResponse = new MockHttpServletResponse();
- // Construct request, response and session using factories
+ // Get request cycle factory
+ this.requestCycleFactory = this.application.getRequestCycleFactory();
+
+ // Construct request and response using factories
this.wicketRequest = this.application.newWebRequest(this.servletRequest);
this.wicketResponse = this.application.newWebResponse(this.servletResponse);
- this.wicketSession = this.application.getSession(this.wicketRequest, this.wicketResponse);
- // Get request cycle factory
- this.requestCycleFactory = this.wicketSession.getRequestCycleFactory();
+ // Create request cycle
+ createRequestCycle();
// Set the default context path
this.application.getApplicationSettings().setContextPath(context.getServletContextName());
@@ -227,8 +229,6 @@
// watcher still runs, taking up file handles and memory, leading
// to "Too many files opened" or a regular OutOfMemoryException
this.application.getResourceSettings().setResourcePollFrequency(null);
-
- createRequestCycle();
}
/**
@@ -421,7 +421,6 @@
servletSession, this.application.getServletContext());
newHttpRequest.setRequestToRedirectString(httpResponse.getRedirectLocation());
wicketRequest = this.application.newWebRequest(newHttpRequest);
- wicketSession = this.application.getSession(wicketRequest, wicketResponse);
cycle = createRequestCycle();
cycle.request();
@@ -443,8 +442,8 @@
*/
private Page generateLastRenderedPage(WebRequestCycle cycle)
{
- Page lastRenderedPage = cycle.getResponsePage();
- if (lastRenderedPage == null)
+ Page newLastRenderedPage = cycle.getResponsePage();
+ if (newLastRenderedPage == null)
{
Class responseClass = cycle.getResponsePageClass();
if (responseClass != null)
@@ -453,7 +452,7 @@
IRequestTarget target = cycle.getRequestTarget();
if (target instanceof IPageRequestTarget)
{
- lastRenderedPage = ((IPageRequestTarget)target).getPage();
+ newLastRenderedPage = ((IPageRequestTarget)target).getPage();
}
else if (target instanceof IBookmarkablePageRequestTarget)
{
@@ -464,22 +463,23 @@
PageParameters parameters = pageClassRequestTarget.getPageParameters();
if (parameters == null || parameters.size() == 0)
{
- lastRenderedPage = new DefaultPageFactory().newPage(pageClass);
+ newLastRenderedPage = new DefaultPageFactory().newPage(pageClass);
}
else
{
- lastRenderedPage = new DefaultPageFactory().newPage(pageClass, parameters);
+ newLastRenderedPage = new DefaultPageFactory().newPage(pageClass,
+ parameters);
}
}
}
}
- if (lastRenderedPage == null)
+ if (newLastRenderedPage == null)
{
- lastRenderedPage = this.lastRenderedPage;
+ newLastRenderedPage = this.lastRenderedPage;
}
- return lastRenderedPage;
+ return newLastRenderedPage;
}
/**
@@ -492,7 +492,10 @@
{
// Create a web request cycle using factory
final WebRequestCycle cycle = (WebRequestCycle)requestCycleFactory.newRequestCycle(
- wicketSession, wicketRequest, wicketResponse);
+ application, wicketRequest, wicketResponse);
+
+ // Construct session
+ this.wicketSession = this.application.getSession(this.wicketRequest, this.wicketResponse);
// Set request cycle so it won't detach automatically and clear messages
// we want to check
@@ -513,6 +516,7 @@
parametersForNextRequest.clear();
this.wicketRequest = this.application.newWebRequest(servletRequest);
this.wicketResponse = this.application.newWebResponse(servletResponse);
+ createRequestCycle();
this.wicketSession = this.application.getSession(wicketRequest, wicketResponse);
this.application.getSessionStore().bind(wicketRequest, wicketSession);
wicketResponse.setAjax(wicketRequest.isAjax());
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java Thu Apr 12 21:27:24 2007
@@ -24,7 +24,6 @@
import org.apache.wicket.Page;
import org.apache.wicket.PageMap;
import org.apache.wicket.Request;
-import org.apache.wicket.Session;
import org.apache.wicket.session.pagemap.IPageMapEntry;
import org.apache.wicket.version.IPageVersionManager;
import org.apache.wicket.version.undo.Change;
@@ -112,11 +111,10 @@
* Construct.
*
* @param name
- * @param session
*/
- private SecondLevelCachePageMap(String name, Session session)
+ private SecondLevelCachePageMap(String name)
{
- super(name, session);
+ super(name);
}
public Page get(int id, int versionNumber)
@@ -413,9 +411,9 @@
* @see org.apache.wicket.protocol.http.HttpSessionStore#createPageMap(java.lang.String,
* org.apache.wicket.Session)
*/
- public IPageMap createPageMap(String name, Session session)
+ public IPageMap createPageMap(String name)
{
- return new SecondLevelCachePageMap(name, session);
+ return new SecondLevelCachePageMap(name);
}
/**
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java Thu Apr 12 21:27:24 2007
@@ -377,7 +377,8 @@
}
/**
- * @see org.apache.wicket.ISessionFactory#newSession(org.apache.wicket.Request, org.apache.wicket.Response)
+ * @see org.apache.wicket.ISessionFactory#newSession(org.apache.wicket.Request,
+ * org.apache.wicket.Response)
*/
public Session newSession(Request request, Response response)
{
@@ -455,6 +456,26 @@
}
/**
+ * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
+ *
+ * Creates a new RequestCycle for the given request and response using the
+ * session's request cycle factory.
+ *
+ * @param application
+ * The application
+ * @param request
+ * The request
+ * @param response
+ * The response
+ * @return The new request cycle.
+ */
+ public final RequestCycle newRequestCycle(final Application application, final Request request,
+ final Response response)
+ {
+ return getRequestCycleFactory().newRequestCycle(application, request, response);
+ }
+
+ /**
* Create a request cycle factory which is used by default by WebSession.
* You may provide your own default factory by subclassing WebApplication
* and overriding this method or your may subclass WebSession to create a
@@ -465,16 +486,17 @@
*
* @return Request cycle factory
*/
- protected IRequestCycleFactory getDefaultRequestCycleFactory()
+ protected IRequestCycleFactory getRequestCycleFactory()
{
return new IRequestCycleFactory()
{
private static final long serialVersionUID = 1L;
- public RequestCycle newRequestCycle(Session session, Request request, Response response)
+ public RequestCycle newRequestCycle(final Application application,
+ final Request request, final Response response)
{
// Respond to request
- return new WebRequestCycle((WebSession)session, (WebRequest)request,
+ return new WebRequestCycle((WebApplication)application, (WebRequest)request,
(WebResponse)response);
}
};
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java Thu Apr 12 21:27:24 2007
@@ -32,7 +32,6 @@
import org.apache.wicket.request.IRequestCycleProcessor;
import org.apache.wicket.settings.IRequestCycleSettings;
-
/**
* RequestCycle implementation for HTTP protocol. Holds the application,
* session, request and response objects for a given HTTP request. Contains
@@ -61,17 +60,17 @@
* Constructor which simply passes arguments to superclass for storage
* there. This instance will be set as the current one for this thread.
*
- * @param session
- * The session
+ * @param application
+ * The applicaiton
* @param request
* The request
* @param response
* The response
*/
- public WebRequestCycle(final WebSession session, final WebRequest request,
+ public WebRequestCycle(final WebApplication application, final WebRequest request,
final Response response)
{
- super(session, request, response);
+ super(application, request, response);
}
/**
@@ -195,10 +194,10 @@
setResponse(currentResponse);
if (ex instanceof AbortException)
throw ex;
-
+
if (!(ex instanceof PageExpiredException))
logRuntimeException(ex);
-
+
IRequestCycleProcessor processor = getProcessor();
processor.respond(ex, this);
return;
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java Thu Apr 12 21:27:24 2007
@@ -17,7 +17,6 @@
package org.apache.wicket.protocol.http;
import org.apache.wicket.Application;
-import org.apache.wicket.IRequestCycleFactory;
import org.apache.wicket.Request;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.Session;
@@ -33,9 +32,6 @@
// private static final Log log = LogFactory.getLog(WebSession.class);
private static final long serialVersionUID = 1L;
- /** The request cycle factory for the session */
- private transient IRequestCycleFactory requestCycleFactory;
-
/** True, if session has been invalidated */
private transient boolean sessionInvalidated = false;
@@ -133,20 +129,6 @@
{
invalidateNow();
}
- }
-
- /**
- * @see org.apache.wicket.Session#getRequestCycleFactory()
- */
- protected IRequestCycleFactory getRequestCycleFactory()
- {
- if (requestCycleFactory == null)
- {
- this.requestCycleFactory = ((WebApplication)getApplication())
- .getDefaultRequestCycleFactory();
- }
-
- return this.requestCycleFactory;
}
/**
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java Thu Apr 12 21:27:24 2007
@@ -159,12 +159,13 @@
final HttpServletResponse servletResponse) throws ServletException, IOException
{
String relativePath = getRelativePath(servletRequest);
+
// Special-case for home page - we redirect to add a trailing slash.
if (relativePath.length() == 0
&& !Strings.stripJSessionId(servletRequest.getRequestURI()).endsWith("/"))
{
- String foo = servletRequest.getRequestURI() + "/";
- servletResponse.sendRedirect(foo);
+ final String redirectUrl = servletRequest.getRequestURI() + "/";
+ servletResponse.sendRedirect(redirectUrl);
return;
}
@@ -236,12 +237,12 @@
response.setCharacterEncoding(webApplication.getRequestCycleSettings()
.getResponseRequestEncoding());
- // Get session for request
- final WebSession session = webApplication.getSession(request, response);
-
try
{
- RequestCycle cycle = session.newRequestCycle(request, response);
+ // Create request cycle
+ RequestCycle cycle = webApplication.newRequestCycle(webApplication, request,
+ response);
+
try
{
// Process request
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java Thu Apr 12 21:27:24 2007
@@ -111,8 +111,7 @@
public void respond(RuntimeException e, RequestCycle requestCycle)
{
// If application doesn't want debug info showing up for users
- final Session session = requestCycle.getSession();
- final Application application = session.getApplication();
+ final Application application = Application.get();
final IExceptionSettings settings = application.getExceptionSettings();
final Page responsePage = requestCycle.getResponsePage();
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/session/ISessionStore.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/session/ISessionStore.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/session/ISessionStore.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/session/ISessionStore.java Thu Apr 12 21:27:24 2007
@@ -28,8 +28,8 @@
/**
- * The actual store that is used by {@link org.apache.wicket.Session} to store its
- * attributes.
+ * The actual store that is used by {@link org.apache.wicket.Session} to store
+ * its attributes.
*
* @author Eelco Hillenius
* @author Johan Compagner
@@ -154,13 +154,13 @@
/**
* @param name
- * @param session
- * @return The pagemap instances for the session
+ * @return The pagemap instance
*/
- IPageMap createPageMap(String name, Session session);
+ IPageMap createPageMap(String name);
/**
- * @param page The page for which this version manager must be created
+ * @param page
+ * The page for which this version manager must be created
* @return A instance of a IPageVersionManager that the page will use.
*/
IPageVersionManager newVersionManager(Page page);
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java Thu Apr 12 21:27:24 2007
@@ -64,38 +64,40 @@
{
final List data = new ArrayList();
- page.visitChildren(new IVisitor()
+ if (page != null)
{
- public Object component(final Component component)
+ page.visitChildren(new IVisitor()
{
- final ComponentData object = new ComponentData();
-
- // anonymous class? Get the parent's class name
- String name = component.getClass().getName();
- if (name.indexOf("$") > 0)
+ public Object component(final Component component)
{
- name = component.getClass().getSuperclass().getName();
- }
+ final ComponentData object = new ComponentData();
- // remove the path component
- name = Strings.lastPathComponent(name, Component.PATH_SEPARATOR);
+ // anonymous class? Get the parent's class name
+ String name = component.getClass().getName();
+ if (name.indexOf("$") > 0)
+ {
+ name = component.getClass().getSuperclass().getName();
+ }
- object.path = component.getPageRelativePath();
- object.type = name;
- try
- {
- object.value = component.getModelObjectAsString();
- }
- catch (Exception e)
- {
- object.value = e.getMessage();
- }
+ // remove the path component
+ name = Strings.lastPathComponent(name, Component.PATH_SEPARATOR);
- data.add(object);
- return IVisitor.CONTINUE_TRAVERSAL;
- }
- });
+ object.path = component.getPageRelativePath();
+ object.type = name;
+ try
+ {
+ object.value = component.getModelObjectAsString();
+ }
+ catch (Exception e)
+ {
+ object.value = e.getMessage();
+ }
+ data.add(object);
+ return IVisitor.CONTINUE_TRAVERSAL;
+ }
+ });
+ }
return data;
}
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java Thu Apr 12 21:27:24 2007
@@ -32,12 +32,12 @@
/**
* Test cases for the <code>StringResourceModel</code> class.
+ *
* @author Chris Turner
*/
public class StringResourceModelTest extends TestCase
{
-
- private WicketTester application;
+ private WicketTester tester;
private WebPage page;
@@ -47,7 +47,9 @@
/**
* Create the test case.
- * @param name The test name
+ *
+ * @param name
+ * The test name
*/
public StringResourceModelTest(String name)
{
@@ -56,21 +58,22 @@
protected void setUp() throws Exception
{
- application = new WicketTester();
- application.getApplication().getResourceSettings().addStringResourceLoader(
+ tester = new WicketTester();
+ tester.getApplication().getResourceSettings().addStringResourceLoader(
new BundleStringResourceLoader("org.apache.wicket.model.StringResourceModelTest"));
page = new MockPage();
ws = new WeatherStation();
wsModel = new Model(ws);
}
+
protected void tearDown() throws Exception
{
- application.destroy();
+ tester.destroy();
}
/**
- *
- *
+ *
+ *
*/
public void testGetSimpleResource()
{
@@ -81,8 +84,8 @@
}
/**
- *
- *
+ *
+ *
*/
public void testNullResourceKey()
{
@@ -98,8 +101,8 @@
}
/**
- *
- *
+ *
+ *
*/
public void testGetSimpleResourceWithKeySubstitution()
{
@@ -113,8 +116,8 @@
}
/**
- *
- *
+ *
+ *
*/
public void testGetPropertySubstitutedResource()
{
@@ -127,8 +130,8 @@
}
/**
- *
- *
+ *
+ *
*/
public void testSubstitutionParametersResource()
{
@@ -138,22 +141,22 @@
"The report for {0,date,medium}, shows the temparature as {2,number,###.##} {3} and the weather to be {1}",
page.getLocale());
StringResourceModel model = new StringResourceModel("weather.detail", page, wsModel,
- new Object[] {cal.getTime(), "${currentStatus}",
+ new Object[] { cal.getTime(), "${currentStatus}",
new PropertyModel(wsModel, "currentTemperature"),
- new PropertyModel(wsModel, "units")});
- String expected = format.format(new Object[] {cal.getTime(), "sunny", new Double(25.7),
- "\u00B0C"});
+ new PropertyModel(wsModel, "units") });
+ String expected = format.format(new Object[] { cal.getTime(), "sunny", new Double(25.7),
+ "\u00B0C" });
Assert.assertEquals("Text should be as expected", expected, model.getString());
ws.setCurrentStatus("raining");
ws.setCurrentTemperature(11.568);
- expected = format.format(new Object[] {cal.getTime(), "raining", new Double(11.568),
- "\u00B0C"});
+ expected = format.format(new Object[] { cal.getTime(), "raining", new Double(11.568),
+ "\u00B0C" });
Assert.assertEquals("Text should be as expected", expected, model.getString());
}
/**
- *
- *
+ *
+ *
*/
public void testUninitialisedLocalizer()
{
@@ -170,7 +173,7 @@
}
/**
- *
+ *
*/
public void testSetObject()
{
@@ -196,9 +199,9 @@
public void testDetachAttachNormalModel() throws Exception
{
StringResourceModel model = new StringResourceModel("simple.text", page, wsModel);
- application.setupRequestAndResponse();
- RequestCycle cycle = new WebRequestCycle(application.getWicketSession(),
- application.getWicketRequest(), application.getWicketResponse());
+ tester.setupRequestAndResponse();
+ RequestCycle cycle = new WebRequestCycle(tester.getApplication(),
+ tester.getWicketRequest(), tester.getWicketResponse());
model.getObject();
Assert.assertNotNull(model.getLocalizer());
model.detach();
@@ -224,9 +227,9 @@
};
StringResourceModel model = new StringResourceModel("simple.text", page, wsDetachModel);
- application.setupRequestAndResponse();
- RequestCycle cycle = new WebRequestCycle(application.getWicketSession(),
- application.getWicketRequest(), application.getWicketResponse());
+ tester.setupRequestAndResponse();
+ RequestCycle cycle = new WebRequestCycle(tester.getApplication(),
+ tester.getWicketRequest(), tester.getWicketResponse());
model.getObject();
Assert.assertNotNull(model.getLocalizer());
model.detach();
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/test/java/org/apache/wicket/examples/panels/signin/CookieTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/test/java/org/apache/wicket/examples/panels/signin/CookieTest.java?view=diff&rev=528350&r1=528349&r2=528350
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/test/java/org/apache/wicket/examples/panels/signin/CookieTest.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/test/java/org/apache/wicket/examples/panels/signin/CookieTest.java Thu Apr 12 21:27:24 2007
@@ -39,7 +39,6 @@
import org.apache.wicket.util.tester.WicketTester;
-
/**
* Test cases for Cookie handling
*
@@ -49,7 +48,7 @@
{
private static final Log log = LogFactory.getLog(CookieTest.class);
- private WicketTester application;
+ private WicketTester tester;
private SignInPanel panel;
private Form form;
private Cookie cookieUsername;
@@ -73,10 +72,10 @@
{
super.setUp();
- application = new WicketTester(MockPage.class);
- application.setupRequestAndResponse();
+ tester = new WicketTester(MockPage.class);
+ tester.setupRequestAndResponse();
- final ISecuritySettings settings = application.getApplication().getSecuritySettings();
+ final ISecuritySettings settings = tester.getApplication().getSecuritySettings();
settings.setCryptFactory(new NoCryptFactory());
this.panel = new SignInPanel("panel")
@@ -90,23 +89,24 @@
this.panel.setPersistent(true);
this.form = (Form)panel.get("signInForm");
- final ICrypt crypt = application.getApplication().getSecuritySettings().getCryptFactory().newCrypt();
+ final ICrypt crypt = tester.getApplication().getSecuritySettings().getCryptFactory()
+ .newCrypt();
final String encryptedPassword = crypt.encryptUrlSafe("test");
assertNotNull(encryptedPassword);
this.cookieUsername = new Cookie("panel:signInForm:username", "juergen");
this.cookiePassword = new Cookie("panel:signInForm:password", encryptedPassword);
this.cookies = new Cookie[] { cookieUsername, cookiePassword };
- application.getServletRequest().setCookies(cookies);
+ tester.getServletRequest().setCookies(cookies);
- cycle = new WebRequestCycle(application.getWicketSession(), application.getWicketRequest(),
- application.getWicketResponse());
+ cycle = new WebRequestCycle(tester.getApplication(), tester.getWicketRequest(), tester
+ .getWicketResponse());
this.page = new MockPage(null);
page.add(this.panel);
- WebRequestCycle cycle = new WebRequestCycle(application.getWicketSession(), application
- .getWicketRequest(), application.getWicketResponse());
+ WebRequestCycle cycle = new WebRequestCycle(tester.getApplication(), tester
+ .getWicketRequest(), tester.getWicketResponse());
}
/**
@@ -144,7 +144,7 @@
this.form.onFormSubmitted();
// validate
- Collection cookies = application.getServletResponse().getCookies();
+ Collection cookies = tester.getServletResponse().getCookies();
Iterator iter = cookies.iterator();
while (iter.hasNext())
{
@@ -165,7 +165,7 @@
this.form.onFormSubmitted();
// validate
- Collection cookies = application.getServletResponse().getCookies();
+ Collection cookies = tester.getServletResponse().getCookies();
Assert.assertEquals(2, cookies.size());
Iterator iter = cookies.iterator();
while (iter.hasNext())
@@ -194,7 +194,7 @@
page.removePersistedFormData(SignInPanel.SignInForm.class, true);
// validate
- Collection cookieCollection = application.getServletResponse().getCookies();
+ Collection cookieCollection = tester.getServletResponse().getCookies();
// Cookies are remove by setting maxAge == 0
Assert.assertEquals(2, cookieCollection.size());
@@ -203,13 +203,13 @@
final Cookie cookiePassword = new Cookie("panel:signInForm:password", "test");
final Cookie[] cookies = new Cookie[] { cookieUsername, cookiePassword };
- application.getServletRequest().setCookies(cookies);
+ tester.getServletRequest().setCookies(cookies);
// test
page.removePersistedFormData(SignInPanel.SignInForm.class, true);
// validate
- cookieCollection = application.getServletResponse().getCookies();
+ cookieCollection = tester.getServletResponse().getCookies();
Assert.assertEquals(4, cookieCollection.size());
Iterator iter = cookieCollection.iterator();
while (iter.hasNext())
Re: svn commit: r528350 - in /incubator/wicket/branches/wicket-1.x:
jdk-1.4/wicket/src/main/java/org/apache/wicket/ jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/
jdk-1.4/wicket/src/main/java/org/apache/wicket/request/ jdk-1.4/wicket/src/mai...
Posted by Al Maw <wi...@almaw.com>.
Jon,
This appears to have broken the world. Please can you at least do a
basic test against wicket-examples when you make changes like this?
The unit tests for wicket-examples are currently failing with 50x
errors, I presume due to this.
Issue is related to session creation. I'm using a stateless log-in page
if that makes any difference.
Al
jonl@apache.org wrote:
> Author: jonl
> Date: Thu Apr 12 21:27:24 2007
> New Revision: 528350
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=528350
> Log:
> Moved call to session factory to Session.get(), removed session setting on PageMaps, moved session factory to Application and removed getDefaultSessionFactory.
>
> Modified:
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/AccessStackPageMap.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IPageMap.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IRequestCycleFactory.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/session/ISessionStore.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java
> incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java
> incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/test/java/org/apache/wicket/examples/panels/signin/CookieTest.java
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/AccessStackPageMap.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/AccessStackPageMap.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/AccessStackPageMap.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/AccessStackPageMap.java Thu Apr 12 21:27:24 2007
> @@ -124,12 +124,10 @@
> *
> * @param name
> * The name of this page map
> - * @param session
> - * The session holding this page map
> */
> - public AccessStackPageMap(final String name, final Session session)
> + public AccessStackPageMap(final String name)
> {
> - super(name, session);
> + super(name);
> }
>
> /**
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Application.java Thu Apr 12 21:27:24 2007
> @@ -536,6 +536,11 @@
> }
>
> /**
> + * @return Request cycle factory for this kind of session.
> + */
> + protected abstract IRequestCycleFactory getRequestCycleFactory();
> +
> + /**
> * Gets the {@link RequestLogger}.
> *
> * @return The RequestLogger
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IPageMap.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IPageMap.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IPageMap.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IPageMap.java Thu Apr 12 21:27:24 2007
> @@ -72,11 +72,6 @@
> String getName();
>
> /**
> - * @return The session that this PageMap is in.
> - */
> - Session getSession();
> -
> - /**
> * @return Size of this page map in bytes, including a sum of the sizes of
> * all the pages it contains.
> */
> @@ -143,11 +138,4 @@
> * The entry to remove
> */
> void removeEntry(final IPageMapEntry entry);
> -
> - /**
> - * @param session
> - * Session to set
> - */
> - void setSession(final Session session);
> -
> }
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IRequestCycleFactory.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IRequestCycleFactory.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IRequestCycleFactory.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/IRequestCycleFactory.java Thu Apr 12 21:27:24 2007
> @@ -19,22 +19,22 @@
>
> /**
> * Factory for creating request cycles for a session.
> - *
> + *
> * @author Jonathan Locke
> */
> public interface IRequestCycleFactory extends IClusterable
> {
> /**
> * Creates a new RequestCycle object.
> - *
> - * @param session
> - * The session
> + *
> + * @param application
> + * The application
> * @param request
> * The request
> * @param response
> * The response
> * @return The cycle
> */
> - RequestCycle newRequestCycle(final Session session, final Request request,
> + RequestCycle newRequestCycle(final Application application, final Request request,
> final Response response);
> }
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageMap.java Thu Apr 12 21:27:24 2007
> @@ -24,8 +24,8 @@
> import org.apache.wicket.session.pagemap.IPageMapEntry;
> import org.apache.wicket.util.lang.Objects;
>
> -
> /**
> + * @author Jonathan Locke
> * @author jcompagner
> */
> public abstract class PageMap implements IClusterable, IPageMap
> @@ -74,10 +74,6 @@
> /** Next available page identifier in this page map. */
> private int pageId = 0;
>
> - /** The session where this PageMap resides */
> - private transient Session session;
> -
> -
> /**
> * Constructor
> *
> @@ -86,17 +82,11 @@
> * @param session
> * The session holding this page map
> */
> - public PageMap(String name, Session session)
> + public PageMap(String name)
> {
> this.name = name;
> - if (session == null)
> - {
> - throw new IllegalArgumentException("session must be not null");
> - }
> - this.session = session;
> }
>
> -
> /**
> * @see org.apache.wicket.IPageMap#attributeForId(int)
> */
> @@ -157,7 +147,7 @@
> */
> public final IPageMapEntry getEntry(final int id)
> {
> - return (IPageMapEntry)session.getAttribute(attributeForId(id));
> + return (IPageMapEntry)Session.get().getAttribute(attributeForId(id));
> }
>
> /**
> @@ -169,11 +159,11 @@
> }
>
> /**
> - * @see org.apache.wicket.IPageMap#getSession()
> + * @return Session this page map is in
> */
> public final Session getSession()
> {
> - return session;
> + return Session.get();
> }
>
> /**
> @@ -293,7 +283,7 @@
> clear();
>
> // Then remove the pagemap itself
> - session.removePageMap(this);
> + Session.get().removePageMap(this);
> }
>
> /**
> @@ -311,14 +301,6 @@
> public abstract void removeEntry(final IPageMapEntry entry);
>
> /**
> - * @see org.apache.wicket.IPageMap#setSession(org.apache.wicket.Session)
> - */
> - public final void setSession(final Session session)
> - {
> - this.session = session;
> - }
> -
> - /**
> * @see java.lang.Object#toString()
> */
> public String toString()
> @@ -326,12 +308,12 @@
> return "[PageMap name=" + name + "]";
> }
>
> -
> /**
> * @return List of entries in this page map
> */
> private final List getEntries()
> {
> + final Session session = Session.get();
> final List attributes = session.getAttributeNames();
> final List list = new ArrayList();
> for (final Iterator iterator = attributes.iterator(); iterator.hasNext();)
> @@ -347,7 +329,7 @@
>
> protected final void dirty()
> {
> - session.dirtyPageMap(this);
> + Session.get().dirtyPageMap(this);
> }
>
> /**
> @@ -356,6 +338,7 @@
> */
> protected final void visitEntries(final IVisitor visitor)
> {
> + final Session session = Session.get();
> final List attributes = session.getAttributeNames();
> for (final Iterator iterator = attributes.iterator(); iterator.hasNext();)
> {
> @@ -366,7 +349,6 @@
> }
> }
> }
> -
>
> /**
> * @return The attribute prefix for this page map
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java Thu Apr 12 21:27:24 2007
> @@ -259,7 +259,6 @@
> /** The processor for this request. */
> protected final IRequestCycleProcessor processor;
>
> -
> /** The current request. */
> protected Request request;
>
> @@ -267,23 +266,23 @@
> protected Response response;
>
> /** The session object. */
> - protected final Session session;
> + protected Session session;
>
> /**
> * Constructor. This instance will be set as the current one for this
> * thread.
> *
> - * @param session
> - * The session
> + * @param application
> + * The application
> * @param request
> * The request
> * @param response
> * The response
> */
> - protected RequestCycle(final Session session, final Request request, final Response response)
> + protected RequestCycle(final Application application, final Request request,
> + final Response response)
> {
> - this.application = session.getApplication();
> - this.session = session;
> + this.application = application;
> this.request = request;
> this.response = response;
> this.originalResponse = response;
> @@ -293,7 +292,6 @@
> current.set(this);
> }
>
> -
> /**
> * Gets the application object.
> *
> @@ -415,12 +413,24 @@
> }
>
> /**
> + * @return True if a session exists for the calling thread
> + */
> + private boolean sessionExists()
> + {
> + return Session.exists();
> + }
> +
> + /**
> * Gets the session.
> *
> * @return Session object
> */
> public final Session getSession()
> {
> + if (session == null)
> + {
> + session = Session.get();
> + }
> return session;
> }
>
> @@ -723,10 +733,10 @@
> }
> else
> {
> -
> page.setPageStateless(Boolean.FALSE);
> +
> // make session non-volatile if not already so
> - Session session = Session.get();
> + final Session session = getSession();
> if (session.isTemporary())
> {
> session.bind();
> @@ -791,7 +801,7 @@
> public final CharSequence urlFor(final Page page)
> {
> IRequestTarget target = new PageRequestTarget(page);
> - Session.get().touch(((IPageRequestTarget)target).getPage());
> + getSession().touch(((IPageRequestTarget)target).getPage());
> return urlFor(target);
> }
>
> @@ -872,7 +882,10 @@
> // the session
> try
> {
> - session.cleanupFeedbackMessages();
> + if (sessionExists())
> + {
> + getSession().cleanupFeedbackMessages();
> + }
> }
> catch (RuntimeException re)
> {
> @@ -881,13 +894,16 @@
> }
>
> // At the end of our response, let the session do some book keeping
> - try
> + if (sessionExists())
> {
> - session.update();
> - }
> - catch (RuntimeException re)
> - {
> - log.error("there was an error updating the session " + session + ".", re);
> + try
> + {
> + getSession().update();
> + }
> + catch (RuntimeException re)
> + {
> + log.error("there was an error updating the session " + session + ".", re);
> + }
> }
>
> try
> @@ -904,14 +920,17 @@
> }
>
> // clear the used pagemap for this thread,
> - try
> - {
> - session.requestDetached();
> - }
> - catch (RuntimeException re)
> + if (sessionExists())
> {
> - log.error("there was an error detaching the request from the session " + session + ".",
> - re);
> + try
> + {
> + getSession().requestDetached();
> + }
> + catch (RuntimeException re)
> + {
> + log.error("there was an error detaching the request from the session " + session
> + + ".", re);
> + }
> }
>
> if (getResponse() instanceof BufferedWebResponse)
> @@ -953,9 +972,6 @@
> */
> private void prepare()
> {
> - // Prepare session for request
> - session.init();
> -
> // Event callback
> onBeginRequest();
> }
> @@ -1153,7 +1169,10 @@
> private final void threadDetach()
> {
> // Detach from session
> - session.detach();
> + if (sessionExists())
> + {
> + getSession().detach();
> + }
>
> if (getRedirect())
> {
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/Session.java Thu Apr 12 21:27:24 2007
> @@ -235,11 +235,13 @@
> */
> public static Session get()
> {
> - final Session session = (Session)current.get();
> + Session session = (Session)current.get();
> if (session == null)
> {
> - throw new WicketRuntimeException("there is no session attached to current thread "
> - + Thread.currentThread().getName());
> + final RequestCycle cycle = RequestCycle.get();
> + session = Application.get().getSessionFactory().newSession(cycle.getRequest(),
> + cycle.getResponse());
> + set(session);
> }
> return session;
> }
> @@ -397,8 +399,7 @@
> */
> public void cleanupFeedbackMessages()
> {
> -
> - // if session scoped, rendered messages got indeed cleaned up, mark the
> + // If session scoped, rendered messages got indeed cleaned up, mark the
> // session as dirty
> if (feedbackMessages.clear(RENDERED_SESSION_SCOPED_MESSAGES) > 0)
> {
> @@ -753,25 +754,6 @@
> }
>
> /**
> - * Set the session for each PageMap
> - */
> - public final void init()
> - {
> - // Set session on each page map
> - visitPageMaps(new IPageMapVisitor()
> - {
> - public void pageMap(IPageMap pageMap)
> - {
> - if (log.isDebugEnabled())
> - {
> - log.debug("updateSession(): Attaching session to PageMap " + pageMap);
> - }
> - pageMap.setSession(Session.this);
> - }
> - });
> - }
> -
> - /**
> * Invalidates this session.
> */
> public void invalidate()
> @@ -810,30 +792,13 @@
> }
>
> // Create new page map
> - final IPageMap pageMap = getSessionStore().createPageMap(name, this);
> + final IPageMap pageMap = getSessionStore().createPageMap(name);
> setAttribute(attributeForPageMapName(name), pageMap);
> dirty();
> return pageMap;
> }
>
> /**
> - * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
> - *
> - * Creates a new RequestCycle for the given request and response using the
> - * session's request cycle factory.
> - *
> - * @param request
> - * The request
> - * @param response
> - * The response
> - * @return The new request cycle.
> - */
> - public final RequestCycle newRequestCycle(final Request request, final Response response)
> - {
> - return getRequestCycleFactory().newRequestCycle(this, request, response);
> - }
> -
> - /**
> * Gets a page map for the given name, automatically creating it if need be.
> *
> * @param pageMapName
> @@ -1088,11 +1053,6 @@
> }
> return Collections.EMPTY_LIST;
> }
> -
> - /**
> - * @return Request cycle factory for this kind of session.
> - */
> - protected abstract IRequestCycleFactory getRequestCycleFactory();
>
> /**
> * Gets the session store.
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/HttpSessionStore.java Thu Apr 12 21:27:24 2007
> @@ -49,14 +49,12 @@
> }
>
> /**
> - * @see org.apache.wicket.session.ISessionStore#createPageMap(java.lang.String,
> - * org.apache.wicket.Session)
> + * @see org.apache.wicket.session.ISessionStore#createPageMap(java.lang.String)
> */
> - public IPageMap createPageMap(String name, Session session)
> + public IPageMap createPageMap(String name)
> {
> - return new AccessStackPageMap(name, session);
> + return new AccessStackPageMap(name);
> }
> -
>
> /**
> * @see org.apache.wicket.session.ISessionStore#getAttribute(org.apache.wicket.Request,
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/MockWebApplication.java Thu Apr 12 21:27:24 2007
> @@ -201,13 +201,15 @@
> this.context);
> this.servletResponse = new MockHttpServletResponse();
>
> - // Construct request, response and session using factories
> + // Get request cycle factory
> + this.requestCycleFactory = this.application.getRequestCycleFactory();
> +
> + // Construct request and response using factories
> this.wicketRequest = this.application.newWebRequest(this.servletRequest);
> this.wicketResponse = this.application.newWebResponse(this.servletResponse);
> - this.wicketSession = this.application.getSession(this.wicketRequest, this.wicketResponse);
>
> - // Get request cycle factory
> - this.requestCycleFactory = this.wicketSession.getRequestCycleFactory();
> + // Create request cycle
> + createRequestCycle();
>
> // Set the default context path
> this.application.getApplicationSettings().setContextPath(context.getServletContextName());
> @@ -227,8 +229,6 @@
> // watcher still runs, taking up file handles and memory, leading
> // to "Too many files opened" or a regular OutOfMemoryException
> this.application.getResourceSettings().setResourcePollFrequency(null);
> -
> - createRequestCycle();
> }
>
> /**
> @@ -421,7 +421,6 @@
> servletSession, this.application.getServletContext());
> newHttpRequest.setRequestToRedirectString(httpResponse.getRedirectLocation());
> wicketRequest = this.application.newWebRequest(newHttpRequest);
> - wicketSession = this.application.getSession(wicketRequest, wicketResponse);
>
> cycle = createRequestCycle();
> cycle.request();
> @@ -443,8 +442,8 @@
> */
> private Page generateLastRenderedPage(WebRequestCycle cycle)
> {
> - Page lastRenderedPage = cycle.getResponsePage();
> - if (lastRenderedPage == null)
> + Page newLastRenderedPage = cycle.getResponsePage();
> + if (newLastRenderedPage == null)
> {
> Class responseClass = cycle.getResponsePageClass();
> if (responseClass != null)
> @@ -453,7 +452,7 @@
> IRequestTarget target = cycle.getRequestTarget();
> if (target instanceof IPageRequestTarget)
> {
> - lastRenderedPage = ((IPageRequestTarget)target).getPage();
> + newLastRenderedPage = ((IPageRequestTarget)target).getPage();
> }
> else if (target instanceof IBookmarkablePageRequestTarget)
> {
> @@ -464,22 +463,23 @@
> PageParameters parameters = pageClassRequestTarget.getPageParameters();
> if (parameters == null || parameters.size() == 0)
> {
> - lastRenderedPage = new DefaultPageFactory().newPage(pageClass);
> + newLastRenderedPage = new DefaultPageFactory().newPage(pageClass);
> }
> else
> {
> - lastRenderedPage = new DefaultPageFactory().newPage(pageClass, parameters);
> + newLastRenderedPage = new DefaultPageFactory().newPage(pageClass,
> + parameters);
> }
> }
> }
> }
>
> - if (lastRenderedPage == null)
> + if (newLastRenderedPage == null)
> {
> - lastRenderedPage = this.lastRenderedPage;
> + newLastRenderedPage = this.lastRenderedPage;
> }
>
> - return lastRenderedPage;
> + return newLastRenderedPage;
> }
>
> /**
> @@ -492,7 +492,10 @@
> {
> // Create a web request cycle using factory
> final WebRequestCycle cycle = (WebRequestCycle)requestCycleFactory.newRequestCycle(
> - wicketSession, wicketRequest, wicketResponse);
> + application, wicketRequest, wicketResponse);
> +
> + // Construct session
> + this.wicketSession = this.application.getSession(this.wicketRequest, this.wicketResponse);
>
> // Set request cycle so it won't detach automatically and clear messages
> // we want to check
> @@ -513,6 +516,7 @@
> parametersForNextRequest.clear();
> this.wicketRequest = this.application.newWebRequest(servletRequest);
> this.wicketResponse = this.application.newWebResponse(servletResponse);
> + createRequestCycle();
> this.wicketSession = this.application.getSession(wicketRequest, wicketResponse);
> this.application.getSessionStore().bind(wicketRequest, wicketSession);
> wicketResponse.setAjax(wicketRequest.isAjax());
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/SecondLevelCacheSessionStore.java Thu Apr 12 21:27:24 2007
> @@ -24,7 +24,6 @@
> import org.apache.wicket.Page;
> import org.apache.wicket.PageMap;
> import org.apache.wicket.Request;
> -import org.apache.wicket.Session;
> import org.apache.wicket.session.pagemap.IPageMapEntry;
> import org.apache.wicket.version.IPageVersionManager;
> import org.apache.wicket.version.undo.Change;
> @@ -112,11 +111,10 @@
> * Construct.
> *
> * @param name
> - * @param session
> */
> - private SecondLevelCachePageMap(String name, Session session)
> + private SecondLevelCachePageMap(String name)
> {
> - super(name, session);
> + super(name);
> }
>
> public Page get(int id, int versionNumber)
> @@ -413,9 +411,9 @@
> * @see org.apache.wicket.protocol.http.HttpSessionStore#createPageMap(java.lang.String,
> * org.apache.wicket.Session)
> */
> - public IPageMap createPageMap(String name, Session session)
> + public IPageMap createPageMap(String name)
> {
> - return new SecondLevelCachePageMap(name, session);
> + return new SecondLevelCachePageMap(name);
> }
>
> /**
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebApplication.java Thu Apr 12 21:27:24 2007
> @@ -377,7 +377,8 @@
> }
>
> /**
> - * @see org.apache.wicket.ISessionFactory#newSession(org.apache.wicket.Request, org.apache.wicket.Response)
> + * @see org.apache.wicket.ISessionFactory#newSession(org.apache.wicket.Request,
> + * org.apache.wicket.Response)
> */
> public Session newSession(Request request, Response response)
> {
> @@ -455,6 +456,26 @@
> }
>
> /**
> + * THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.
> + *
> + * Creates a new RequestCycle for the given request and response using the
> + * session's request cycle factory.
> + *
> + * @param application
> + * The application
> + * @param request
> + * The request
> + * @param response
> + * The response
> + * @return The new request cycle.
> + */
> + public final RequestCycle newRequestCycle(final Application application, final Request request,
> + final Response response)
> + {
> + return getRequestCycleFactory().newRequestCycle(application, request, response);
> + }
> +
> + /**
> * Create a request cycle factory which is used by default by WebSession.
> * You may provide your own default factory by subclassing WebApplication
> * and overriding this method or your may subclass WebSession to create a
> @@ -465,16 +486,17 @@
> *
> * @return Request cycle factory
> */
> - protected IRequestCycleFactory getDefaultRequestCycleFactory()
> + protected IRequestCycleFactory getRequestCycleFactory()
> {
> return new IRequestCycleFactory()
> {
> private static final long serialVersionUID = 1L;
>
> - public RequestCycle newRequestCycle(Session session, Request request, Response response)
> + public RequestCycle newRequestCycle(final Application application,
> + final Request request, final Response response)
> {
> // Respond to request
> - return new WebRequestCycle((WebSession)session, (WebRequest)request,
> + return new WebRequestCycle((WebApplication)application, (WebRequest)request,
> (WebResponse)response);
> }
> };
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebRequestCycle.java Thu Apr 12 21:27:24 2007
> @@ -32,7 +32,6 @@
> import org.apache.wicket.request.IRequestCycleProcessor;
> import org.apache.wicket.settings.IRequestCycleSettings;
>
> -
> /**
> * RequestCycle implementation for HTTP protocol. Holds the application,
> * session, request and response objects for a given HTTP request. Contains
> @@ -61,17 +60,17 @@
> * Constructor which simply passes arguments to superclass for storage
> * there. This instance will be set as the current one for this thread.
> *
> - * @param session
> - * The session
> + * @param application
> + * The applicaiton
> * @param request
> * The request
> * @param response
> * The response
> */
> - public WebRequestCycle(final WebSession session, final WebRequest request,
> + public WebRequestCycle(final WebApplication application, final WebRequest request,
> final Response response)
> {
> - super(session, request, response);
> + super(application, request, response);
> }
>
> /**
> @@ -195,10 +194,10 @@
> setResponse(currentResponse);
> if (ex instanceof AbortException)
> throw ex;
> -
> +
> if (!(ex instanceof PageExpiredException))
> logRuntimeException(ex);
> -
> +
> IRequestCycleProcessor processor = getProcessor();
> processor.respond(ex, this);
> return;
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WebSession.java Thu Apr 12 21:27:24 2007
> @@ -17,7 +17,6 @@
> package org.apache.wicket.protocol.http;
>
> import org.apache.wicket.Application;
> -import org.apache.wicket.IRequestCycleFactory;
> import org.apache.wicket.Request;
> import org.apache.wicket.RequestCycle;
> import org.apache.wicket.Session;
> @@ -33,9 +32,6 @@
> // private static final Log log = LogFactory.getLog(WebSession.class);
> private static final long serialVersionUID = 1L;
>
> - /** The request cycle factory for the session */
> - private transient IRequestCycleFactory requestCycleFactory;
> -
> /** True, if session has been invalidated */
> private transient boolean sessionInvalidated = false;
>
> @@ -133,20 +129,6 @@
> {
> invalidateNow();
> }
> - }
> -
> - /**
> - * @see org.apache.wicket.Session#getRequestCycleFactory()
> - */
> - protected IRequestCycleFactory getRequestCycleFactory()
> - {
> - if (requestCycleFactory == null)
> - {
> - this.requestCycleFactory = ((WebApplication)getApplication())
> - .getDefaultRequestCycleFactory();
> - }
> -
> - return this.requestCycleFactory;
> }
>
> /**
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java Thu Apr 12 21:27:24 2007
> @@ -159,12 +159,13 @@
> final HttpServletResponse servletResponse) throws ServletException, IOException
> {
> String relativePath = getRelativePath(servletRequest);
> +
> // Special-case for home page - we redirect to add a trailing slash.
> if (relativePath.length() == 0
> && !Strings.stripJSessionId(servletRequest.getRequestURI()).endsWith("/"))
> {
> - String foo = servletRequest.getRequestURI() + "/";
> - servletResponse.sendRedirect(foo);
> + final String redirectUrl = servletRequest.getRequestURI() + "/";
> + servletResponse.sendRedirect(redirectUrl);
> return;
> }
>
> @@ -236,12 +237,12 @@
> response.setCharacterEncoding(webApplication.getRequestCycleSettings()
> .getResponseRequestEncoding());
>
> - // Get session for request
> - final WebSession session = webApplication.getSession(request, response);
> -
> try
> {
> - RequestCycle cycle = session.newRequestCycle(request, response);
> + // Create request cycle
> + RequestCycle cycle = webApplication.newRequestCycle(webApplication, request,
> + response);
> +
> try
> {
> // Process request
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/request/AbstractRequestCycleProcessor.java Thu Apr 12 21:27:24 2007
> @@ -111,8 +111,7 @@
> public void respond(RuntimeException e, RequestCycle requestCycle)
> {
> // If application doesn't want debug info showing up for users
> - final Session session = requestCycle.getSession();
> - final Application application = session.getApplication();
> + final Application application = Application.get();
> final IExceptionSettings settings = application.getExceptionSettings();
> final Page responsePage = requestCycle.getResponsePage();
>
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/session/ISessionStore.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/session/ISessionStore.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/session/ISessionStore.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/session/ISessionStore.java Thu Apr 12 21:27:24 2007
> @@ -28,8 +28,8 @@
>
>
> /**
> - * The actual store that is used by {@link org.apache.wicket.Session} to store its
> - * attributes.
> + * The actual store that is used by {@link org.apache.wicket.Session} to store
> + * its attributes.
> *
> * @author Eelco Hillenius
> * @author Johan Compagner
> @@ -154,13 +154,13 @@
>
> /**
> * @param name
> - * @param session
> - * @return The pagemap instances for the session
> + * @return The pagemap instance
> */
> - IPageMap createPageMap(String name, Session session);
> + IPageMap createPageMap(String name);
>
> /**
> - * @param page The page for which this version manager must be created
> + * @param page
> + * The page for which this version manager must be created
> * @return A instance of a IPageVersionManager that the page will use.
> */
> IPageVersionManager newVersionManager(Page page);
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java Thu Apr 12 21:27:24 2007
> @@ -64,38 +64,40 @@
> {
> final List data = new ArrayList();
>
> - page.visitChildren(new IVisitor()
> + if (page != null)
> {
> - public Object component(final Component component)
> + page.visitChildren(new IVisitor()
> {
> - final ComponentData object = new ComponentData();
> -
> - // anonymous class? Get the parent's class name
> - String name = component.getClass().getName();
> - if (name.indexOf("$") > 0)
> + public Object component(final Component component)
> {
> - name = component.getClass().getSuperclass().getName();
> - }
> + final ComponentData object = new ComponentData();
>
> - // remove the path component
> - name = Strings.lastPathComponent(name, Component.PATH_SEPARATOR);
> + // anonymous class? Get the parent's class name
> + String name = component.getClass().getName();
> + if (name.indexOf("$") > 0)
> + {
> + name = component.getClass().getSuperclass().getName();
> + }
>
> - object.path = component.getPageRelativePath();
> - object.type = name;
> - try
> - {
> - object.value = component.getModelObjectAsString();
> - }
> - catch (Exception e)
> - {
> - object.value = e.getMessage();
> - }
> + // remove the path component
> + name = Strings.lastPathComponent(name, Component.PATH_SEPARATOR);
>
> - data.add(object);
> - return IVisitor.CONTINUE_TRAVERSAL;
> - }
> - });
> + object.path = component.getPageRelativePath();
> + object.type = name;
> + try
> + {
> + object.value = component.getModelObjectAsString();
> + }
> + catch (Exception e)
> + {
> + object.value = e.getMessage();
> + }
>
> + data.add(object);
> + return IVisitor.CONTINUE_TRAVERSAL;
> + }
> + });
> + }
> return data;
> }
>
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/StringResourceModelTest.java Thu Apr 12 21:27:24 2007
> @@ -32,12 +32,12 @@
>
> /**
> * Test cases for the <code>StringResourceModel</code> class.
> + *
> * @author Chris Turner
> */
> public class StringResourceModelTest extends TestCase
> {
> -
> - private WicketTester application;
> + private WicketTester tester;
>
> private WebPage page;
>
> @@ -47,7 +47,9 @@
>
> /**
> * Create the test case.
> - * @param name The test name
> + *
> + * @param name
> + * The test name
> */
> public StringResourceModelTest(String name)
> {
> @@ -56,21 +58,22 @@
>
> protected void setUp() throws Exception
> {
> - application = new WicketTester();
> - application.getApplication().getResourceSettings().addStringResourceLoader(
> + tester = new WicketTester();
> + tester.getApplication().getResourceSettings().addStringResourceLoader(
> new BundleStringResourceLoader("org.apache.wicket.model.StringResourceModelTest"));
> page = new MockPage();
> ws = new WeatherStation();
> wsModel = new Model(ws);
> }
> +
> protected void tearDown() throws Exception
> {
> - application.destroy();
> + tester.destroy();
> }
>
> /**
> - *
> - *
> + *
> + *
> */
> public void testGetSimpleResource()
> {
> @@ -81,8 +84,8 @@
> }
>
> /**
> - *
> - *
> + *
> + *
> */
> public void testNullResourceKey()
> {
> @@ -98,8 +101,8 @@
> }
>
> /**
> - *
> - *
> + *
> + *
> */
> public void testGetSimpleResourceWithKeySubstitution()
> {
> @@ -113,8 +116,8 @@
> }
>
> /**
> - *
> - *
> + *
> + *
> */
> public void testGetPropertySubstitutedResource()
> {
> @@ -127,8 +130,8 @@
> }
>
> /**
> - *
> - *
> + *
> + *
> */
> public void testSubstitutionParametersResource()
> {
> @@ -138,22 +141,22 @@
> "The report for {0,date,medium}, shows the temparature as {2,number,###.##} {3} and the weather to be {1}",
> page.getLocale());
> StringResourceModel model = new StringResourceModel("weather.detail", page, wsModel,
> - new Object[] {cal.getTime(), "${currentStatus}",
> + new Object[] { cal.getTime(), "${currentStatus}",
> new PropertyModel(wsModel, "currentTemperature"),
> - new PropertyModel(wsModel, "units")});
> - String expected = format.format(new Object[] {cal.getTime(), "sunny", new Double(25.7),
> - "\u00B0C"});
> + new PropertyModel(wsModel, "units") });
> + String expected = format.format(new Object[] { cal.getTime(), "sunny", new Double(25.7),
> + "\u00B0C" });
> Assert.assertEquals("Text should be as expected", expected, model.getString());
> ws.setCurrentStatus("raining");
> ws.setCurrentTemperature(11.568);
> - expected = format.format(new Object[] {cal.getTime(), "raining", new Double(11.568),
> - "\u00B0C"});
> + expected = format.format(new Object[] { cal.getTime(), "raining", new Double(11.568),
> + "\u00B0C" });
> Assert.assertEquals("Text should be as expected", expected, model.getString());
> }
>
> /**
> - *
> - *
> + *
> + *
> */
> public void testUninitialisedLocalizer()
> {
> @@ -170,7 +173,7 @@
> }
>
> /**
> - *
> + *
> */
> public void testSetObject()
> {
> @@ -196,9 +199,9 @@
> public void testDetachAttachNormalModel() throws Exception
> {
> StringResourceModel model = new StringResourceModel("simple.text", page, wsModel);
> - application.setupRequestAndResponse();
> - RequestCycle cycle = new WebRequestCycle(application.getWicketSession(),
> - application.getWicketRequest(), application.getWicketResponse());
> + tester.setupRequestAndResponse();
> + RequestCycle cycle = new WebRequestCycle(tester.getApplication(),
> + tester.getWicketRequest(), tester.getWicketResponse());
> model.getObject();
> Assert.assertNotNull(model.getLocalizer());
> model.detach();
> @@ -224,9 +227,9 @@
>
> };
> StringResourceModel model = new StringResourceModel("simple.text", page, wsDetachModel);
> - application.setupRequestAndResponse();
> - RequestCycle cycle = new WebRequestCycle(application.getWicketSession(),
> - application.getWicketRequest(), application.getWicketResponse());
> + tester.setupRequestAndResponse();
> + RequestCycle cycle = new WebRequestCycle(tester.getApplication(),
> + tester.getWicketRequest(), tester.getWicketResponse());
> model.getObject();
> Assert.assertNotNull(model.getLocalizer());
> model.detach();
>
> Modified: incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/test/java/org/apache/wicket/examples/panels/signin/CookieTest.java
> URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/test/java/org/apache/wicket/examples/panels/signin/CookieTest.java?view=diff&rev=528350&r1=528349&r2=528350
> ==============================================================================
> --- incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/test/java/org/apache/wicket/examples/panels/signin/CookieTest.java (original)
> +++ incubator/wicket/branches/wicket-1.x/jdk-1.5/wicket-examples/src/test/java/org/apache/wicket/examples/panels/signin/CookieTest.java Thu Apr 12 21:27:24 2007
> @@ -39,7 +39,6 @@
> import org.apache.wicket.util.tester.WicketTester;
>
>
> -
> /**
> * Test cases for Cookie handling
> *
> @@ -49,7 +48,7 @@
> {
> private static final Log log = LogFactory.getLog(CookieTest.class);
>
> - private WicketTester application;
> + private WicketTester tester;
> private SignInPanel panel;
> private Form form;
> private Cookie cookieUsername;
> @@ -73,10 +72,10 @@
> {
> super.setUp();
>
> - application = new WicketTester(MockPage.class);
> - application.setupRequestAndResponse();
> + tester = new WicketTester(MockPage.class);
> + tester.setupRequestAndResponse();
>
> - final ISecuritySettings settings = application.getApplication().getSecuritySettings();
> + final ISecuritySettings settings = tester.getApplication().getSecuritySettings();
> settings.setCryptFactory(new NoCryptFactory());
>
> this.panel = new SignInPanel("panel")
> @@ -90,23 +89,24 @@
> this.panel.setPersistent(true);
> this.form = (Form)panel.get("signInForm");
>
> - final ICrypt crypt = application.getApplication().getSecuritySettings().getCryptFactory().newCrypt();
> + final ICrypt crypt = tester.getApplication().getSecuritySettings().getCryptFactory()
> + .newCrypt();
> final String encryptedPassword = crypt.encryptUrlSafe("test");
> assertNotNull(encryptedPassword);
> this.cookieUsername = new Cookie("panel:signInForm:username", "juergen");
> this.cookiePassword = new Cookie("panel:signInForm:password", encryptedPassword);
> this.cookies = new Cookie[] { cookieUsername, cookiePassword };
>
> - application.getServletRequest().setCookies(cookies);
> + tester.getServletRequest().setCookies(cookies);
>
> - cycle = new WebRequestCycle(application.getWicketSession(), application.getWicketRequest(),
> - application.getWicketResponse());
> + cycle = new WebRequestCycle(tester.getApplication(), tester.getWicketRequest(), tester
> + .getWicketResponse());
>
> this.page = new MockPage(null);
> page.add(this.panel);
>
> - WebRequestCycle cycle = new WebRequestCycle(application.getWicketSession(), application
> - .getWicketRequest(), application.getWicketResponse());
> + WebRequestCycle cycle = new WebRequestCycle(tester.getApplication(), tester
> + .getWicketRequest(), tester.getWicketResponse());
> }
>
> /**
> @@ -144,7 +144,7 @@
> this.form.onFormSubmitted();
>
> // validate
> - Collection cookies = application.getServletResponse().getCookies();
> + Collection cookies = tester.getServletResponse().getCookies();
> Iterator iter = cookies.iterator();
> while (iter.hasNext())
> {
> @@ -165,7 +165,7 @@
> this.form.onFormSubmitted();
>
> // validate
> - Collection cookies = application.getServletResponse().getCookies();
> + Collection cookies = tester.getServletResponse().getCookies();
> Assert.assertEquals(2, cookies.size());
> Iterator iter = cookies.iterator();
> while (iter.hasNext())
> @@ -194,7 +194,7 @@
> page.removePersistedFormData(SignInPanel.SignInForm.class, true);
>
> // validate
> - Collection cookieCollection = application.getServletResponse().getCookies();
> + Collection cookieCollection = tester.getServletResponse().getCookies();
> // Cookies are remove by setting maxAge == 0
> Assert.assertEquals(2, cookieCollection.size());
>
> @@ -203,13 +203,13 @@
> final Cookie cookiePassword = new Cookie("panel:signInForm:password", "test");
> final Cookie[] cookies = new Cookie[] { cookieUsername, cookiePassword };
>
> - application.getServletRequest().setCookies(cookies);
> + tester.getServletRequest().setCookies(cookies);
>
> // test
> page.removePersistedFormData(SignInPanel.SignInForm.class, true);
>
> // validate
> - cookieCollection = application.getServletResponse().getCookies();
> + cookieCollection = tester.getServletResponse().getCookies();
> Assert.assertEquals(4, cookieCollection.size());
> Iterator iter = cookieCollection.iterator();
> while (iter.hasNext())
>
>
>
> !DSPAM:461f06cb108102051017194!
>