diff options
author | Olivier Lamy <olamy@apache.org> | 2012-05-29 16:35:33 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-05-29 16:35:33 +0000 |
commit | d91a07b77bed8e2c3db083e46cd0bfedac1b9d34 (patch) | |
tree | 7183f8770a147803f3cda8b013cfe9b6cc67d138 | |
parent | 2811968b935d747e5f72a83c467348a9b0cd5ff2 (diff) | |
download | archiva-d91a07b77bed8e2c3db083e46cd0bfedac1b9d34.tar.gz archiva-d91a07b77bed8e2c3db083e46cd0bfedac1b9d34.zip |
this is fixed now
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1343830 13f79535-47bb-0310-9956-ffa450edef68
2 files changed, 8 insertions, 10 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java index 9f76d191a..f7aaf895e 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java @@ -130,7 +130,7 @@ public abstract class AbstractRestService : redbackRequestInformation.getUser().getUsername() ); } - protected String getBaseUrl( HttpServletRequest req ) + protected String getBaseUrl() throws RepositoryAdminException { String applicationUrl = archivaAdministration.getUiConfiguration().getApplicationUrl(); @@ -138,9 +138,9 @@ public abstract class AbstractRestService { return applicationUrl; } - return req.getScheme() + "://" + req.getServerName() + ( req.getServerPort() == 80 - ? "" - : ":" + req.getServerPort() ) + req.getContextPath(); + return httpServletRequest.getScheme() + "://" + httpServletRequest.getServerName() + ( + httpServletRequest.getServerPort() == 80 ? "" : ":" + httpServletRequest.getServerPort() ) + + httpServletRequest.getContextPath(); } protected <T> Map<String, T> getBeansOfType( ApplicationContext applicationContext, Class<T> clazz ) @@ -173,8 +173,6 @@ public abstract class AbstractRestService } /** - * TODO add a configuration mechanism to have configured the base archiva url - * * @param artifact * @return */ @@ -189,7 +187,7 @@ public abstract class AbstractRestService return null; } - StringBuilder sb = new StringBuilder( getBaseUrl( httpServletRequest ) ); + StringBuilder sb = new StringBuilder( getBaseUrl() ); sb.append( "/repository" ); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java index 417c7b048..5072e440e 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java @@ -218,7 +218,7 @@ public class DefaultManagedRepositoriesService snippet.append( " <" ).append( distRepoName ).append( ">\n" ); snippet.append( " <id>" ).append( repo.getId() ).append( "</id>\n" ); snippet.append( " <url>" ); - snippet.append( getBaseUrl( httpServletRequest ) + "/repository" ); + snippet.append( getBaseUrl( ) + "/repository" ); snippet.append( "/" ).append( repo.getId() ).append( "/" ).append( "</url>\n" ); if ( !"default".equals( repo.getLayout() ) ) @@ -236,7 +236,7 @@ public class DefaultManagedRepositoriesService snippet.append( " <name>" ).append( repo.getName() ).append( "</name>\n" ); snippet.append( " <url>" ); - snippet.append( getBaseUrl( httpServletRequest ) + "/repository" ); + snippet.append( getBaseUrl( ) + "/repository" ); snippet.append( "/" ).append( repo.getId() ).append( "/" ); snippet.append( "</url>\n" ); @@ -262,7 +262,7 @@ public class DefaultManagedRepositoriesService snippet.append( " <name>" ).append( repo.getName() ).append( "</name>\n" ); snippet.append( " <url>" ); - snippet.append( getBaseUrl( httpServletRequest ) + "/repository" ); + snippet.append( getBaseUrl( ) + "/repository" ); snippet.append( "/" ).append( repo.getId() ).append( "/" ); snippet.append( "</url>\n" ); |