]> source.dussan.org Git - gitblit.git/commitdiff
Redirect to absolute url for repository search box (issue-111)
authorJames Moger <james.moger@gitblit.com>
Thu, 9 Aug 2012 20:56:57 +0000 (16:56 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 9 Aug 2012 20:56:57 +0000 (16:56 -0400)
docs/04_releases.mkd
src/com/gitblit/wicket/pages/RepositoryPage.java

index da1af63cfd02c287560c60a72516c242f1a70a93..e94d8c1585588e2c9c03ed005359e98db4350bc4 100644 (file)
@@ -19,6 +19,7 @@ If you are updating from an earlier release AND you have indexed branches with t
 - Repository URL uses `X-Forwarded-Proto` and `X-Forwarded-Port`, if available, for reverse proxy configurations (issue 115)\r
 - Output real RAW content, not simulated RAW content (issue 114)\r
 - Fixed Lucene charset encoding bug when reindexing a repository (issue 112)\r
+- Fixed search box linking to Lucene page for nested repository on Tomcat (issue 111)\r
 - Fixed null pointer in LdapUserSerivce if account has a null email address (issue 110)\r
 - Really fixed failure to update a GO setting from the manager (issue 85)\r
 \r
index 45822e16cc1a82bfc1d37267f7ebc93b4ca06c56..4b5e28d433faf17d05060c98ec83b568bf58beac 100644 (file)
@@ -32,6 +32,8 @@ import org.apache.wicket.markup.html.link.ExternalLink;
 import org.apache.wicket.markup.html.panel.Fragment;\r
 import org.apache.wicket.model.IModel;\r
 import org.apache.wicket.model.Model;\r
+import org.apache.wicket.protocol.http.RequestUtils;\r
+import org.apache.wicket.request.target.basic.RedirectRequestTarget;\r
 import org.eclipse.jgit.diff.DiffEntry.ChangeType;\r
 import org.eclipse.jgit.lib.PersonIdent;\r
 import org.eclipse.jgit.lib.Repository;\r
@@ -364,8 +366,12 @@ public abstract class RepositoryPage extends BasePage {
                                // this repository is Lucene-indexed\r
                                searchPageClass = LuceneSearchPage.class;\r
                        }\r
-                       setResponsePage(searchPageClass,\r
-                                       WicketUtils.newSearchParameter(repositoryName, null, searchString, searchType));\r
+                       // use an absolute url to workaround Wicket-Tomcat problems with\r
+                       // mounted url parameters (issue-111)\r
+                       PageParameters params = WicketUtils.newSearchParameter(repositoryName, null, searchString, searchType);\r
+                       String relativeUrl = urlFor(searchPageClass, params).toString();\r
+                       String absoluteUrl = RequestUtils.toAbsolutePath(relativeUrl);\r
+                       getRequestCycle().setRequestTarget(new RedirectRequestTarget(absoluteUrl));\r
                }\r
        }\r
 }\r