]> source.dussan.org Git - gitblit.git/commitdiff
Fixed broken urls for WAR builds.
authorJames Moger <james.moger@gitblit.com>
Mon, 26 Sep 2011 21:48:53 +0000 (17:48 -0400)
committerJames Moger <james.moger@gitblit.com>
Mon, 26 Sep 2011 21:48:53 +0000 (17:48 -0400)
13 files changed:
docs/00_index.mkd
docs/04_releases.mkd
src/com/gitblit/AccessRestrictionFilter.java
src/com/gitblit/FederationServlet.java
src/com/gitblit/SyndicationServlet.java
src/com/gitblit/utils/HttpUtils.java
src/com/gitblit/wicket/WicketUtils.java
src/com/gitblit/wicket/pages/CommitPage.java
src/com/gitblit/wicket/pages/SendProposalPage.java
src/com/gitblit/wicket/pages/SummaryPage.java
src/com/gitblit/wicket/pages/TreePage.java
src/com/gitblit/wicket/panels/FederationTokensPanel.java
src/com/gitblit/wicket/panels/RepositoriesPanel.java

index e499abe77c877a0ec6671026dce332cd05f23a76..5cf8173507e1b15c710e917c6bce8df9651a7a25 100644 (file)
@@ -15,16 +15,20 @@ Gitblit is available in two variations:
     All dependencies are bundled.\r
 </ul>\r
 \r
+### Tools\r
+<ul class='noBullets'>\r
+<li>*Gitblit Federation Client* - a command line tool to clone/pull groups of repositories and optionally users and settings\r
+</ul>\r
+\r
 ### Java Runtime Requirement\r
 \r
 Gitblit requires a Java 6 Runtime Environment (JRE) or a Java 6 Development Kit (JDK).\r
 \r
 ### Current Release\r
 \r
-**%VERSION%** ([go](http://code.google.com/p/gitblit/downloads/detail?name=%GO%)|[war](http://code.google.com/p/gitblit/downloads/detail?name=%WAR%)) based on [%JGIT%][jgit] &nbsp; *released %BUILDDATE%*\r
+**%VERSION%** ([go](http://code.google.com/p/gitblit/downloads/detail?name=%GO%)|[war](http://code.google.com/p/gitblit/downloads/detail?name=%WAR%)|[fedclient](http://code.google.com/p/gitblit/downloads/detail?name=%FEDCLIENT%)) based on [%JGIT%][jgit] &nbsp; *released %BUILDDATE%*\r
 \r
-- added: federation feature to allow gitblit instances to pull repositories and, optionally, settings and accounts from other gitblit instances.<br/>\r
-This is something like svn-sync for gitblit.\r
+- added: federation feature to allow gitblit instances (or gitblit federation clients) to pull repositories and, optionally, settings and accounts from other gitblit instances.  This is something like [svn-sync](http://svnbook.red-bean.com/en/1.5/svn.ref.svnsync.html) for gitblit.\r
 <br/>**New:** *federation.name =*\r
 <br/>**New:** *federation.passphrase =*\r
 <br/>**New:** *federation.allowProposals = false*\r
@@ -38,6 +42,7 @@ This is something like svn-sync for gitblit.
 - updated: MarkdownPapers 1.1.1\r
 - updated: Wicket 1.4.18\r
 - updated: JGit 1.1.0\r
+- fixed: syndication urls for WAR builds\r
 \r
 issues, binaries, and sources @ [Google Code][googlecode]<br/>\r
 sources @ [Github][gitbltsrc]\r
index ead799a75b432823123a5e370102ab47f365d60b..242af41902576119cc0f775952da5744b9c35562 100644 (file)
@@ -1,10 +1,9 @@
 ## Release History\r
 \r
 ### Current Release\r
-**%VERSION%** ([go](http://code.google.com/p/gitblit/downloads/detail?name=%GO%)|[war](http://code.google.com/p/gitblit/downloads/detail?name=%WAR%)) based on [%JGIT%][jgit] &nbsp; *released %BUILDDATE%*\r
+**%VERSION%** ([go](http://code.google.com/p/gitblit/downloads/detail?name=%GO%)|[war](http://code.google.com/p/gitblit/downloads/detail?name=%WAR%)|[fedclient](http://code.google.com/p/gitblit/downloads/detail?name=%FEDCLIENT%)) based on [%JGIT%][jgit] &nbsp; *released %BUILDDATE%*\r
 \r
-- added: federation feature to allow gitblit instances to pull repositories and, optionally, settings and accounts from other gitblit instances.<br/>\r
-This is something like svn-sync for gitblit.\r
+- added: federation feature to allow gitblit instances (or gitblit federation clients) to pull repositories and, optionally, settings and accounts from other gitblit instances.  This is something like [svn-sync](http://svnbook.red-bean.com/en/1.5/svn.ref.svnsync.html) for gitblit.\r
 <br/>**New:** *federation.name =*\r
 <br/>**New:** *federation.passphrase =*\r
 <br/>**New:** *federation.allowProposals = false*\r
@@ -18,6 +17,7 @@ This is something like svn-sync for gitblit.
 - updated: MarkdownPapers 1.1.1\r
 - updated: Wicket 1.4.18\r
 - updated: JGit 1.1.0\r
+- fixed: syndication urls for WAR builds\r
 \r
 ### Older Releases\r
 \r
index 6ec70dbd3aa6f1d5f80ed7a370a5e97a66aad893..e309b5957f9f52e38c96b7311d114df6789ef232 100644 (file)
@@ -130,7 +130,8 @@ public abstract class AccessRestrictionFilter implements Filter {
 \r
                AccessRestrictionRequest accessRequest = new AccessRestrictionRequest(httpRequest);\r
 \r
-               String url = httpRequest.getRequestURI().substring(httpRequest.getServletPath().length());\r
+               String servletUrl = httpRequest.getContextPath() + httpRequest.getServletPath();\r
+               String url = httpRequest.getRequestURI().substring(servletUrl.length());\r
                String params = httpRequest.getQueryString();\r
                if (url.length() > 0 && url.charAt(0) == '/') {\r
                        url = url.substring(1);\r
index 708ca921ead86c14abf8e885ebc031b9565d30b8..784ec33fdb2b7f5dde789a4fe4907ead507f0871 100644 (file)
@@ -159,9 +159,8 @@ public class FederationServlet extends HttpServlet {
                                return;\r
                        }\r
 \r
-                       String hosturl = HttpUtils.getHostURL(request);\r
-                       String gitblitUrl = hosturl + request.getContextPath();\r
-                       GitBlit.self().submitFederationProposal(proposal, gitblitUrl);\r
+                       String url = HttpUtils.getGitblitURL(request);\r
+                       GitBlit.self().submitFederationProposal(proposal, url);\r
                        logger.info(MessageFormat.format(\r
                                        "Submitted {0} federation proposal to pull {1} repositories from {2}",\r
                                        proposal.tokenType.name(), proposal.repositories.size(), proposal.url));\r
@@ -218,7 +217,7 @@ public class FederationServlet extends HttpServlet {
 \r
                Object result = null;\r
                if (FederationRequest.PULL_REPOSITORIES.equals(reqType)) {\r
-                       String gitblitUrl = HttpUtils.getHostURL(request);\r
+                       String gitblitUrl = HttpUtils.getGitblitURL(request);\r
                        result = GitBlit.self().getRepositories(gitblitUrl, token);\r
                } else {\r
                        if (FederationRequest.PULL_SETTINGS.equals(reqType)) {\r
index 99497544bfe3b2c6f67cb535a4b8646d96381c78..4ba278914a506333125f14b2a1f9d6c1fe08ab76 100644 (file)
@@ -116,8 +116,8 @@ public class SyndicationServlet extends HttpServlet {
                        javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException,\r
                        java.io.IOException {\r
 \r
-               String hostURL = HttpUtils.getHostURL(request);\r
-               String url = request.getRequestURI().substring(request.getServletPath().length());\r
+               String servletUrl = request.getContextPath() + request.getServletPath();\r
+               String url = request.getRequestURI().substring(servletUrl.length());\r
                if (url.charAt(0) == '/' && url.length() > 1) {\r
                        url = url.substring(1);\r
                }\r
@@ -139,7 +139,7 @@ public class SyndicationServlet extends HttpServlet {
                RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);\r
                List<RevCommit> commits = JGitUtils.getRevLog(repository, objectId, 0, length);\r
                try {\r
-                       SyndicationUtils.toRSS(hostURL, getTitle(model.name, objectId), model.description,\r
+                       SyndicationUtils.toRSS(HttpUtils.getGitblitURL(request), getTitle(model.name, objectId), model.description,\r
                                        model.name, commits, response.getOutputStream());\r
                } catch (Exception e) {\r
                        logger.error("An error occurred during feed generation", e);\r
index 6f0bedeb09937aa02aea140ccf991e1439401df8..079d1a6bac0ba716315bb75d76f5c7d41e1dc572 100644 (file)
@@ -26,12 +26,12 @@ import javax.servlet.http.HttpServletRequest;
 public class HttpUtils {\r
 \r
        /**\r
-        * Returns the host URL based on the request.\r
+        * Returns the Gitblit URL based on the request.\r
         * \r
         * @param request\r
         * @return the host url\r
         */\r
-       public static String getHostURL(HttpServletRequest request) {\r
+       public static String getGitblitURL(HttpServletRequest request) {\r
                StringBuilder sb = new StringBuilder();\r
                sb.append(request.getScheme());\r
                sb.append("://");\r
@@ -40,6 +40,7 @@ public class HttpUtils {
                                || (request.getScheme().equals("https") && request.getServerPort() != 443)) {\r
                        sb.append(":" + request.getServerPort());\r
                }\r
+               sb.append(request.getContextPath());\r
                return sb.toString();\r
        }\r
 }\r
index 1a24925b2b78bbca9ed112dbbec4d35af422c3b8..36f74a1595b501a2e526479dae80087688a9351a 100644 (file)
@@ -217,9 +217,9 @@ public class WicketUtils {
                return new ContextRelativeResource(file);\r
        }\r
 \r
-       public static String getHostURL(Request request) {\r
+       public static String getGitblitURL(Request request) {\r
                HttpServletRequest req = ((WebRequest) request).getHttpServletRequest();\r
-               return HttpUtils.getHostURL(req);\r
+               return HttpUtils.getGitblitURL(req);\r
        }\r
 \r
        public static HeaderContributor syndicationDiscoveryLink(final String feedTitle,\r
index b49b1d63aa985665866130fdaee2ad46ddb7d182..7bf7807718e5f984ac1ed951b9ad3b245c331728 100644 (file)
@@ -92,9 +92,9 @@ public class CommitPage extends RepositoryPage {
                add(new LinkPanel("commitTree", "list", c.getTree().getName(), TreePage.class,\r
                                newCommitParameter()));\r
                add(new BookmarkablePageLink<Void>("treeLink", TreePage.class, newCommitParameter()));\r
-               add(new ExternalLink("zipLink", DownloadZipServlet.asLink(getRequest()\r
-                               .getRelativePathPrefixToContextRoot(), repositoryName, objectId, null))\r
-                               .setVisible(GitBlit.getBoolean(Keys.web.allowZipDownloads, true)));\r
+               final String baseUrl = WicketUtils.getGitblitURL(getRequest());\r
+               add(new ExternalLink("zipLink", DownloadZipServlet.asLink(baseUrl, repositoryName,\r
+                               objectId, null)).setVisible(GitBlit.getBoolean(Keys.web.allowZipDownloads, true)));\r
 \r
                // Parent Commits\r
                ListDataProvider<String> parentsDp = new ListDataProvider<String>(parents);\r
index adef0c54bc1444c227306f5b4d826b6156f4e869..ea91f1b2f317814ed4e10ccd87179df3671c3766 100644 (file)
@@ -52,7 +52,7 @@ public class SendProposalPage extends BasePage {
 \r
                final String token = WicketUtils.getToken(params);\r
 \r
-               myUrl = WicketUtils.getHostURL(getRequest());\r
+               myUrl = WicketUtils.getGitblitURL(getRequest());\r
                destinationUrl = "https://";\r
 \r
                // temporary proposal\r
index 07d571447cc87d105ff2cfa7d9e42985e3dad9cf..9fd90c5f221110c0d2c40847e605a54857c59423 100644 (file)
@@ -114,7 +114,7 @@ public class SummaryPage extends RepositoryPage {
                                add(WicketUtils.newClearPixel("accessRestrictionIcon").setVisible(false));\r
                        }\r
                        StringBuilder sb = new StringBuilder();\r
-                       sb.append(WicketUtils.getHostURL(getRequestCycle().getRequest()));\r
+                       sb.append(WicketUtils.getGitblitURL(getRequestCycle().getRequest()));\r
                        sb.append(Constants.GIT_PATH);\r
                        sb.append(repositoryName);\r
                        repositoryUrls.add(sb.toString());\r
index 8695621e56373e84beecfc3b61f8c4b1035b045e..7fc91eeeb21a085a53ecd70b20a8765386a0e7dd 100644 (file)
@@ -78,6 +78,8 @@ public class TreePage extends RepositoryPage {
 \r
                final ByteFormat byteFormat = new ByteFormat();\r
 \r
+               final String baseUrl = WicketUtils.getGitblitURL(getRequest());\r
+\r
                // changed paths list\r
                ListDataProvider<PathModel> pathsDp = new ListDataProvider<PathModel>(paths);\r
                DataView<PathModel> pathsView = new DataView<PathModel>("changedPath", pathsDp) {\r
@@ -112,10 +114,9 @@ public class TreePage extends RepositoryPage {
                                                links.add(new BookmarkablePageLink<Void>("history", HistoryPage.class,\r
                                                                WicketUtils.newPathParameter(repositoryName, entry.commitId,\r
                                                                                entry.path)));\r
-                                               links.add(new ExternalLink("zip", DownloadZipServlet.asLink(getRequest()\r
-                                                               .getRelativePathPrefixToContextRoot(), repositoryName, objectId,\r
-                                                               entry.path)).setVisible(GitBlit.getBoolean(\r
-                                                               Keys.web.allowZipDownloads, true)));\r
+                                               links.add(new ExternalLink("zip", DownloadZipServlet.asLink(baseUrl,\r
+                                                               repositoryName, objectId, entry.path)).setVisible(GitBlit\r
+                                                               .getBoolean(Keys.web.allowZipDownloads, true)));\r
                                                item.add(links);\r
                                        } else {\r
                                                // blob link\r
index 5a2e1250e92d3c4412984b980b4429000bef9721..3a771886d1eb61e678ae9a9cb5e7cdd037827959 100644 (file)
@@ -41,7 +41,7 @@ public class FederationTokensPanel extends BasePanel {
        public FederationTokensPanel(String wicketId, final boolean showFederation) {\r
                super(wicketId);\r
 \r
-               final String baseUrl = getRequest().getRelativePathPrefixToContextRoot();\r
+               final String baseUrl = WicketUtils.getGitblitURL(getRequest());\r
                add(new ExternalLink("federatedUsers", FederationServlet.asFederationLink(baseUrl, GitBlit.self()\r
                                .getFederationToken(FederationToken.USERS_AND_REPOSITORIES),\r
                                FederationRequest.PULL_USERS)));\r
index f644546b0c61c031d584d8d04e8587f318b9394e..63b512c2750db4923cadaba9ee1754ed6fbe44f0 100644 (file)
@@ -125,6 +125,8 @@ public class RepositoriesPanel extends BasePanel {
                } else {\r
                        dp = new SortableRepositoriesProvider(models);\r
                }\r
+               \r
+               final String baseUrl = WicketUtils.getGitblitURL(getRequest());\r
 \r
                DataView<RepositoryModel> dataView = new DataView<RepositoryModel>("row", dp) {\r
                        private static final long serialVersionUID = 1L;\r
@@ -271,9 +273,8 @@ public class RepositoriesPanel extends BasePanel {
                                } else {\r
                                        row.add(new Label("repositoryLinks"));\r
                                }\r
-                               row.add(new ExternalLink("syndication", SyndicationServlet.asLink(getRequest()\r
-                                               .getRelativePathPrefixToContextRoot(), entry.name, null, 0))\r
-                                               .setVisible(linksActive));\r
+                               row.add(new ExternalLink("syndication", SyndicationServlet.asLink(baseUrl,\r
+                                               entry.name, null, 0)).setVisible(linksActive));\r
                                WicketUtils.setAlternatingBackground(item, counter);\r
                                counter++;\r
                        }\r