diff options
author | olivier lamy <olamy@apache.org> | 2017-05-18 13:53:17 +1000 |
---|---|---|
committer | olivier lamy <olamy@apache.org> | 2017-05-18 13:53:17 +1000 |
commit | 84a1846854922ad3b7254f94840bf845fcbaaa56 (patch) | |
tree | d8bad266cea313ca2f8f3fdf34ee7498d9e499e5 /archiva-modules/archiva-web/archiva-rest | |
parent | 661634ca2098a56658fcfb994b429d3f5bf609d5 (diff) | |
parent | 6f286273991823611cca8733e64626a6ee90ae5f (diff) | |
download | archiva-84a1846854922ad3b7254f94840bf845fcbaaa56.tar.gz archiva-84a1846854922ad3b7254f94840bf845fcbaaa56.zip |
Merge branch 'feature/jetty_9.4'
Diffstat (limited to 'archiva-modules/archiva-web/archiva-rest')
3 files changed, 33 insertions, 42 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml index e620e9ff6..20c7c64d6 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml @@ -384,24 +384,14 @@ </dependency> <dependency> - <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.tomcat</groupId> - <artifactId>tomcat-juli</artifactId> - <scope>test</scope> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-server</artifactId> + <version>${jettyVersion}</version> </dependency> <dependency> - <groupId>org.apache.tomcat.embed</groupId> - <artifactId>tomcat-embed-logging-juli</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.tomcat</groupId> - <artifactId>tomcat-jsp-api</artifactId> - <scope>test</scope> + <groupId>org.eclipse.jetty</groupId> + <artifactId>jetty-servlet</artifactId> + <version>${jettyVersion}</version> </dependency> <dependency> <groupId>xerces</groupId> diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java index 4cab81d47..208400c83 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java @@ -18,26 +18,25 @@ package org.apache.archiva.rest.services; * under the License. */ -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import org.apache.archiva.rest.api.services.ArchivaRestServiceException; -import org.springframework.stereotype.Service; - -import javax.inject.Inject; - import org.apache.archiva.rest.api.services.PluginsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.core.io.Resource; +import org.springframework.stereotype.Service; + +import javax.inject.Inject; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; /** * @author Eric Barboni * @since 1.4.0 */ -@Service("pluginsService#rest") +@Service( "pluginsService#rest" ) public class DefaultPluginsServices implements PluginsService { @@ -46,7 +45,7 @@ public class DefaultPluginsServices private List<String> adminFeatures = new ArrayList<>(); - private ApplicationContext appCont; + private ApplicationContext applicationContext; private Logger log = LoggerFactory.getLogger( getClass() ); @@ -56,11 +55,14 @@ public class DefaultPluginsServices public DefaultPluginsServices( ApplicationContext applicationContext ) throws IOException { - this.appCont = applicationContext; + log.debug( "init DefaultPluginsServices" ); + this.applicationContext = applicationContext; // rebuild - feed( repositoryType, "repository" ); - feed( adminFeatures, "features" ); + repositoryType = feed( "repository" ); + log.debug( "feed {}:{}", "repository" , repositoryType); + adminFeatures = feed( "features" ); + log.debug( "feed {}:{}", "features", adminFeatures ); StringBuilder sb = new StringBuilder(); for ( String repoType : repositoryType ) { @@ -81,27 +83,29 @@ public class DefaultPluginsServices } } - private void feed( List<String> repository, String key ) + private List<String> feed( String key ) throws IOException { log.info( "Feeding: {}", key ); - repository.clear(); - Resource[] xmlResources; - - xmlResources = appCont.getResources( "/**/" + key + "/**/main.js" ); + Resource[] xmlResources = applicationContext.getResources( "/**/" + key + "/**/main.js" ); + if (xmlResources == null) + { + return Collections.emptyList(); + } + List<String> repository = new ArrayList<>( xmlResources.length ); for ( Resource rc : xmlResources ) { String tmp = rc.getURL().toString(); tmp = tmp.substring( tmp.lastIndexOf( key ) + key.length() + 1, tmp.length() - 8 ); repository.add( "archiva/admin/" + key + "/" + tmp + "/main" ); } - + return repository; } @Override public String getAdminPlugins() throws ArchivaRestServiceException { - return adminPlugins; + return adminPlugins; } } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml index a7e013916..1c258ef1e 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml @@ -19,7 +19,7 @@ --> -<configuration status="debug"> +<configuration> <!-- status="debug" --> <appenders> <Console name="console" target="SYSTEM_OUT"> <PatternLayout pattern="%highlight{%d{HH:mm:ss.SSS} [%L] [%t] %-5level %logger{3} - %msg%n}" /> @@ -27,13 +27,10 @@ </appenders> <loggers> - <logger name="org.codehaus.redback.rest.services" level="error"/> - + <logger name="org.apache.archiva.redback.rest.services" level="error"/> <logger name="JPOX" level="error"/> - - + <logger name="org.apache.archiva.rest.services" level="info"/> <logger name="org.springframework" level="error"/> - <logger name="org.apache.commons.configuration" level="error"/> <root level="info"> |