summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/wicket/panels
diff options
context:
space:
mode:
authorkrulls <stephan.krull@ecg-leipzig.de>2015-02-23 18:24:45 +0100
committerkrulls <stephan.krull@ecg-leipzig.de>2015-02-26 10:31:14 +0100
commit47a544e3ffcd20f968a505b0efa61e99cf3af46a (patch)
tree9fd49a9377fb41a026236b67c57b3f2face18d42 /src/main/java/com/gitblit/wicket/panels
parentc71e8bd9c4e55fc4f8eddc434066ab2414a9b659 (diff)
downloadgitblit-47a544e3ffcd20f968a505b0efa61e99cf3af46a.tar.gz
gitblit-47a544e3ffcd20f968a505b0efa61e99cf3af46a.zip
issue 564: enable ticket page update on tomcat with redirects
issue 564: fix imports issue 564
Diffstat (limited to 'src/main/java/com/gitblit/wicket/panels')
-rw-r--r--src/main/java/com/gitblit/wicket/panels/CommentPanel.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/wicket/panels/CommentPanel.java b/src/main/java/com/gitblit/wicket/panels/CommentPanel.java
index acf4dd9a..2bc08899 100644
--- a/src/main/java/com/gitblit/wicket/panels/CommentPanel.java
+++ b/src/main/java/com/gitblit/wicket/panels/CommentPanel.java
@@ -15,12 +15,15 @@
*/
package com.gitblit.wicket.panels;
+import org.apache.wicket.PageParameters;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
+import org.apache.wicket.protocol.http.RequestUtils;
+import org.apache.wicket.request.target.basic.RedirectRequestTarget;
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.TicketModel;
@@ -79,7 +82,7 @@ public class CommentPanel extends BasePanel {
TicketModel updatedTicket = app().tickets().updateTicket(repository, ticket.number, newComment);
if (updatedTicket != null) {
app().tickets().createNotifier().sendMailing(updatedTicket);
- setResponsePage(pageClass, WicketUtils.newObjectParameter(updatedTicket.repository, "" + ticket.number));
+ redirectTo(pageClass, WicketUtils.newObjectParameter(updatedTicket.repository, "" + ticket.number));
} else {
error("Failed to add comment!");
}
@@ -87,6 +90,24 @@ public class CommentPanel extends BasePanel {
// TODO update comment
}
}
+
+ /**
+ * Steal from BasePage to realize redirection.
+ *
+ * @see BasePage
+ * @author krulls@GitHub; ECG Leipzig GmbH, Germany, 2015
+ *
+ * @param pageClass
+ * @param parameters
+ * @return
+ */
+ private void redirectTo(Class<? extends BasePage> pageClass, PageParameters parameters)
+ {
+ String relativeUrl = urlFor(pageClass, parameters).toString();
+ String canonicalUrl = RequestUtils.toAbsolutePath(relativeUrl);
+ getRequestCycle().setRequestTarget(new RedirectRequestTarget(canonicalUrl));
+ }
+
}.setVisible(ticket != null && ticket.number > 0));
final IModel<String> markdownPreviewModel = Model.of();