this is fixed now

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1343830 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-05-29 16:35:33 +00:00
parent 2811968b93
commit d91a07b77b
2 changed files with 8 additions and 10 deletions

View File

@ -130,7 +130,7 @@ public abstract class AbstractRestService
: redbackRequestInformation.getUser().getUsername() ); : redbackRequestInformation.getUser().getUsername() );
} }
protected String getBaseUrl( HttpServletRequest req ) protected String getBaseUrl()
throws RepositoryAdminException throws RepositoryAdminException
{ {
String applicationUrl = archivaAdministration.getUiConfiguration().getApplicationUrl(); String applicationUrl = archivaAdministration.getUiConfiguration().getApplicationUrl();
@ -138,9 +138,9 @@ public abstract class AbstractRestService
{ {
return applicationUrl; return applicationUrl;
} }
return req.getScheme() + "://" + req.getServerName() + ( req.getServerPort() == 80 return httpServletRequest.getScheme() + "://" + httpServletRequest.getServerName() + (
? "" httpServletRequest.getServerPort() == 80 ? "" : ":" + httpServletRequest.getServerPort() )
: ":" + req.getServerPort() ) + req.getContextPath(); + httpServletRequest.getContextPath();
} }
protected <T> Map<String, T> getBeansOfType( ApplicationContext applicationContext, Class<T> clazz ) 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 * @param artifact
* @return * @return
*/ */
@ -189,7 +187,7 @@ public abstract class AbstractRestService
return null; return null;
} }
StringBuilder sb = new StringBuilder( getBaseUrl( httpServletRequest ) ); StringBuilder sb = new StringBuilder( getBaseUrl() );
sb.append( "/repository" ); sb.append( "/repository" );

View File

@ -218,7 +218,7 @@ public class DefaultManagedRepositoriesService
snippet.append( " <" ).append( distRepoName ).append( ">\n" ); snippet.append( " <" ).append( distRepoName ).append( ">\n" );
snippet.append( " <id>" ).append( repo.getId() ).append( "</id>\n" ); snippet.append( " <id>" ).append( repo.getId() ).append( "</id>\n" );
snippet.append( " <url>" ); snippet.append( " <url>" );
snippet.append( getBaseUrl( httpServletRequest ) + "/repository" ); snippet.append( getBaseUrl( ) + "/repository" );
snippet.append( "/" ).append( repo.getId() ).append( "/" ).append( "</url>\n" ); snippet.append( "/" ).append( repo.getId() ).append( "/" ).append( "</url>\n" );
if ( !"default".equals( repo.getLayout() ) ) if ( !"default".equals( repo.getLayout() ) )
@ -236,7 +236,7 @@ public class DefaultManagedRepositoriesService
snippet.append( " <name>" ).append( repo.getName() ).append( "</name>\n" ); snippet.append( " <name>" ).append( repo.getName() ).append( "</name>\n" );
snippet.append( " <url>" ); snippet.append( " <url>" );
snippet.append( getBaseUrl( httpServletRequest ) + "/repository" ); snippet.append( getBaseUrl( ) + "/repository" );
snippet.append( "/" ).append( repo.getId() ).append( "/" ); snippet.append( "/" ).append( repo.getId() ).append( "/" );
snippet.append( "</url>\n" ); snippet.append( "</url>\n" );
@ -262,7 +262,7 @@ public class DefaultManagedRepositoriesService
snippet.append( " <name>" ).append( repo.getName() ).append( "</name>\n" ); snippet.append( " <name>" ).append( repo.getName() ).append( "</name>\n" );
snippet.append( " <url>" ); snippet.append( " <url>" );
snippet.append( getBaseUrl( httpServletRequest ) + "/repository" ); snippet.append( getBaseUrl( ) + "/repository" );
snippet.append( "/" ).append( repo.getId() ).append( "/" ); snippet.append( "/" ).append( repo.getId() ).append( "/" );
snippet.append( "</url>\n" ); snippet.append( "</url>\n" );