From c4b87a1ed554eba79bb464b207f7b340cbd568dc Mon Sep 17 00:00:00 2001 From: Martin Spielmann Date: Sat, 30 Jul 2016 10:07:10 +0200 Subject: [PATCH] updated package for RedirectToUrlException --- .../com/gitblit/wicket/GitBlitWebSession.java | 15 ++++++++++++--- .../com/gitblit/wicket/GitblitWicketFilter.java | 6 ++++++ .../java/com/gitblit/wicket/pages/BasePage.java | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/gitblit/wicket/GitBlitWebSession.java b/src/main/java/com/gitblit/wicket/GitBlitWebSession.java index 7adbd359..8aa92d2f 100644 --- a/src/main/java/com/gitblit/wicket/GitBlitWebSession.java +++ b/src/main/java/com/gitblit/wicket/GitBlitWebSession.java @@ -21,15 +21,18 @@ import java.util.TimeZone; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.wicket.Page; +import org.apache.wicket.request.IRequestParameters; import org.apache.wicket.request.Request; +import org.apache.wicket.request.Url; import org.apache.wicket.request.cycle.RequestCycle; +import org.apache.wicket.request.flow.RedirectToUrlException; import org.apache.wicket.request.mapper.parameter.PageParameters; -import org.apache.wicket.RedirectToUrlException; import org.apache.wicket.Session; import org.apache.wicket.protocol.http.RequestUtils; import org.apache.wicket.protocol.http.WebSession; import org.apache.wicket.protocol.http.request.WebClientInfo; +import com.gitblit.GitBlitServer.Params; import com.gitblit.models.UserModel; public final class GitBlitWebSession extends WebSession { @@ -65,10 +68,16 @@ public final class GitBlitWebSession extends WebSession { public void cacheRequest(Class pageClass) { // build absolute url with correctly encoded parameters?! Request req = RequestCycle.get().getRequest(); - Map params = req.getRequestParameters().getParameters(); - PageParameters pageParams = new PageParameters(params); + IRequestParameters params = req.getRequestParameters(); + PageParameters pageParams = new PageParameters(); + params.getParameterNames().forEach(name->{ + pageParams.add(name, params.getParameterValue(name)); + }); String relativeUrl = RequestCycle.get().urlFor(pageClass, pageParams).toString(); requestUrl = RequestUtils.toAbsolutePath(relativeUrl); +// String relativeUrl = RequestCycle.get().urlFor(pageClass, pageParams).toString(); +// requestUrl = RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse(relativeUrl)); + if (isTemporary()) { // we must bind the temporary session into the session store diff --git a/src/main/java/com/gitblit/wicket/GitblitWicketFilter.java b/src/main/java/com/gitblit/wicket/GitblitWicketFilter.java index 68ad84a5..9ada7dc6 100644 --- a/src/main/java/com/gitblit/wicket/GitblitWicketFilter.java +++ b/src/main/java/com/gitblit/wicket/GitblitWicketFilter.java @@ -81,6 +81,12 @@ public class GitblitWicketFilter extends WicketFilter { public WebApplication createApplication(WicketFilter filter) { return webapp; } + + @Override + public void destroy(WicketFilter filter) { + // TODO Auto-generated method stub + + } }; } diff --git a/src/main/java/com/gitblit/wicket/pages/BasePage.java b/src/main/java/com/gitblit/wicket/pages/BasePage.java index 4ade581e..e858d5e1 100644 --- a/src/main/java/com/gitblit/wicket/pages/BasePage.java +++ b/src/main/java/com/gitblit/wicket/pages/BasePage.java @@ -36,11 +36,11 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.io.IOUtils; import org.apache.wicket.Application; import org.apache.wicket.Page; +import org.apache.wicket.request.flow.RedirectToUrlException; import org.apache.wicket.request.http.WebResponse; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.apache.wicket.request.resource.CssPackageResource; import org.apache.wicket.request.resource.JavaScriptResourceReference; -import org.apache.wicket.RedirectToUrlException; import org.apache.wicket.markup.html.CSSPackageResource; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.link.ExternalLink; -- 2.39.5