import org.apache.wicket.protocol.http.RequestUtils;\r
import org.apache.wicket.protocol.http.WebResponse;\r
import org.apache.wicket.protocol.http.servlet.ServletWebRequest;\r
+import org.apache.wicket.request.target.basic.RedirectRequestTarget;\r
import org.apache.wicket.util.time.Duration;\r
import org.apache.wicket.util.time.Time;\r
import org.slf4j.Logger;\r
return canonicalUrl;\r
}\r
\r
+ protected void manualRedirect(Class<? extends BasePage> pageClass) {\r
+ redirect(pageClass, null);\r
+ }\r
+\r
+ protected void redirect(Class<? extends BasePage> pageClass, PageParameters parameters) {\r
+ String absoluteUrl = getCanonicalUrl(pageClass, parameters);\r
+ getRequestCycle().setRequestTarget(new RedirectRequestTarget(absoluteUrl));\r
+ }\r
+\r
protected String getLanguageCode() {\r
return GitBlitWebSession.get().getLocale().getLanguage();\r
}\r
}\r
return sb.toString();\r
}\r
+\r
}\r
}\r
\r
if (success && app().tickets().updateMilestone(getRepositoryModel(), tm, createdBy)) {\r
- setResponsePage(TicketsPage.class, WicketUtils.newOpenTicketsParameter(repositoryName));\r
+ redirect(TicketsPage.class, WicketUtils.newOpenTicketsParameter(repositoryName));\r
} else {\r
// TODO error\r
}\r
if (ticket != null) {\r
TicketNotifier notifier = app().tickets().createNotifier();\r
notifier.sendMailing(ticket);\r
- setResponsePage(TicketsPage.class, WicketUtils.newObjectParameter(getRepositoryModel().name, "" + ticket.number));\r
+ redirect(TicketsPage.class, WicketUtils.newObjectParameter(getRepositoryModel().name, "" + ticket.number));\r
} else {\r
// TODO error\r
}\r
} else {\r
// nothing to change?!\r
- setResponsePage(TicketsPage.class, WicketUtils.newObjectParameter(getRepositoryModel().name, "" + ticket.number));\r
+ redirect(TicketsPage.class, WicketUtils.newObjectParameter(getRepositoryModel().name, "" + ticket.number));\r
}\r
}\r
});\r
if (milestone != null) {\r
milestone.due = due;\r
app().tickets().updateMilestone(getRepositoryModel(), milestone, createdBy);\r
- throw new RestartResponseException(TicketsPage.class, WicketUtils.newOpenTicketsParameter(repositoryName));\r
+ redirect(TicketsPage.class, WicketUtils.newOpenTicketsParameter(repositoryName));\r
} else {\r
// TODO error\r
}\r
if (ticket != null) {\r
TicketNotifier notifier = app().tickets().createNotifier();\r
notifier.sendMailing(ticket);\r
- setResponsePage(TicketsPage.class, WicketUtils.newObjectParameter(getRepositoryModel().name, "" + ticket.number));\r
+\r
+ redirect(TicketsPage.class, WicketUtils.newObjectParameter(getRepositoryModel().name, "" + ticket.number));\r
} else {\r
// TODO error\r
}\r
PageParameters params = getPageParameters();
if (params == null) {
// redirect to this page
- setResponsePage(getClass());
+ manualRedirect(getClass());
} else {
// Strip username and password and redirect to this page
params.remove("username");
params.remove("password");
- setResponsePage(getClass(), params);
+ redirect(getClass(), params);
}
}
}