Author: ehillenius Date: Wed Jun 6 00:36:30 2007 New Revision: 544754 URL: http://svn.apache.org/viewvc?view=rev&rev=544754 Log: WICKET-605
Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageParameters.java incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageParameters.java URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageParameters.java?view=diff&rev=544754&r1=544753&r2=544754 ============================================================================== --- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageParameters.java (original) +++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/PageParameters.java Wed Jun 6 00:36:30 2007 @@ -50,6 +50,13 @@ */ public PageParameters() { + super(); + + RequestCycle cycle = RequestCycle.get(); + if (cycle != null) + { + cycle.setPageParameters(this); + } } /** @@ -62,6 +69,12 @@ public PageParameters(final Map parameterMap) { super(parameterMap); + + RequestCycle cycle = RequestCycle.get(); + if (cycle != null) + { + cycle.setPageParameters(this); + } } /** @@ -95,6 +108,12 @@ public PageParameters(final String keyValuePairs, final String delimiter) { super(); + + RequestCycle cycle = RequestCycle.get(); + if (cycle != null) + { + cycle.setPageParameters(this); + } // We can not use ValueMaps constructor as it uses // VariableAssignmentParser which is more suitable for markup Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java?view=diff&rev=544754&r1=544753&r2=544754 ============================================================================== --- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java (original) +++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/RequestCycle.java Wed Jun 6 00:36:30 2007 @@ -254,6 +254,12 @@ /** holds the stack of set [EMAIL PROTECTED] IRequestTarget}, the last set op top. */ private transient final ArrayListStack requestTargets = new ArrayListStack(3); + /** + * Any page parameters. Only set when the request is resolving and the + * parameters are passed into a page. + */ + private PageParameters pageParameters; + /** The session object. */ private Session session; @@ -333,6 +339,18 @@ } /** + * Any set page parameters. Typically only available when a request to a + * bookmarkable page with a [EMAIL PROTECTED] Page#Page(PageParameters)} constructor + * was made. + * + * @return the page parameters or null + */ + public final PageParameters getPageParameters() + { + return this.pageParameters; + } + + /** * Gets the processor for delegated request cycle handling. * * @return the processor for delegated request cycle handling @@ -744,7 +762,9 @@ * Returns a URL that references a given interface on a component. When the * URL is requested from the server at a later time, the interface will be * called. A URL returned by this method will not be stable across sessions - * and cannot be bookmarked by a user. + * and cannot be bookmarked by a user unless the component resides on a + * stateless bookmarkable page, in which case the URL *will* be + * bookmarkable. * * @param component * The component to reference @@ -761,8 +781,11 @@ if (listener != IRedirectListener.INTERFACE && component.isStateless() && page.isBookmarkable()) { - target = new BookmarkableListenerInterfaceRequestTarget(page.getPageMapName(), - page.getClass(), new PageParameters(), component, listener); + PageParameters parameters = (this.pageParameters != null) + ? this.pageParameters + : new PageParameters(); + target = new BookmarkableListenerInterfaceRequestTarget(page.getPageMapName(), page + .getClass(), parameters, component, listener); } else { @@ -954,7 +977,7 @@ + ".", re); } } - + if (getResponse() instanceof BufferedWebResponse) { try @@ -975,7 +998,7 @@ { log.error("Exception occurred during onEndRequest", e); } - + try { getApplication().getSessionStore().onEndRequest(getRequest()); @@ -984,7 +1007,7 @@ { log.error("Exception occurred during onEndRequest of the SessionStore", e); } - + // Release thread local resources try { @@ -1215,6 +1238,21 @@ // Clear ThreadLocal reference; makes sense as this object should not be // reused current.set(null); + } + + /** + * Possibly set the page parameters. Only set when the request is resolving + * and the parameters are passed into a page. + * + * @param parameters + * the parameters to set + */ + final void setPageParameters(PageParameters parameters) + { + if (currentStep == RESOLVE_TARGET) + { + this.pageParameters = parameters; + } } /**