]> source.dussan.org Git - archiva.git/commitdiff
this is fixed now
authorOlivier Lamy <olamy@apache.org>
Tue, 29 May 2012 16:35:33 +0000 (16:35 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 29 May 2012 16:35:33 +0000 (16:35 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1343830 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java

index 9f76d191a39e3005b40d3bb2577bc656e2123808..f7aaf895eb0db02b33d115e850120c485f7af945 100644 (file)
@@ -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" );
 
index 417c7b04802f30b9623b0c7f9600b7dd05a62aaa..5072e440e54d3da983625a3cb8cd5e35a5e4df0e 100644 (file)
@@ -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" );