]> source.dussan.org Git - archiva.git/commitdiff
upgrade to jetty 9.4 for archiva-rest-services module
authorolivier lamy <olamy@apache.org>
Thu, 11 May 2017 11:38:51 +0000 (21:38 +1000)
committerolivier lamy <olamy@apache.org>
Thu, 11 May 2017 11:38:51 +0000 (21:38 +1000)
Signed-off-by: olivier lamy <olamy@apache.org>
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/pom.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultPluginsServices.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/log4j2-test.xml
archiva-modules/archiva-web/archiva-security/pom.xml
archiva-modules/archiva-web/archiva-web-common/pom.xml
pom.xml

index cc4442230efd21f650a23baab1ab174be345c3db..f77fbc188dcf2c6b63d7133e3925bf2a5659149a 100644 (file)
@@ -37,6 +37,7 @@
     -->
     <redbackTestJdbcUrl>jdbc:hsqldb:mem:redback-test</redbackTestJdbcUrl>
     <redbackTestJdbcDriver>org.hsqldb.jdbcDriver</redbackTestJdbcDriver>
+    <jetty.version>9.4.5.v20170502</jetty.version>
   </properties>
 
   <dependencies>
     </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>${jetty.version}</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>${jetty.version}</version>
     </dependency>
     <dependency>
       <groupId>xerces</groupId>
index 4cab81d47284e476b59c4032c772628972e76254..208400c832021de19bad5644d7030627ad0310cf 100644 (file)
@@ -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;
     }
 }
index a7e01391654b782d7c98b7b450fe8d6a259fd566..4d7c9ab07b61cb4715f3ef566dbe12e031f85d67 100644 (file)
@@ -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}" />
   </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.springframework" level="error"/>
-
+    <logger name="org.apache.archiva.rest.services" level="info"/>
+    <logger name="org.springframework" level="info"/>
     <logger name="org.apache.commons.configuration" level="error"/>
 
     <root level="info">
index 66aa53b720d5e9cc87c2742c3a0e9a6ec0841af8..121316247d20022f59e17da1bb5c27a85d78c940 100644 (file)
@@ -47,7 +47,7 @@
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
-      <artifactId>servlet-api</artifactId>
+      <artifactId>javax.servlet-api</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>
index 6d9c94c156def96a0c030de964db18db2c2a3522..e3b113a375ce7b2b5a4e333dcfdde029c31d78c4 100644 (file)
       <groupId>org.apache.archiva</groupId>
       <artifactId>audit</artifactId>
     </dependency>
-    <dependency>
-      <groupId>javax.servlet</groupId>
-      <artifactId>javax.servlet-api</artifactId>
-      <scope>provided</scope>
-    </dependency>
     <dependency>
       <groupId>javax.ws.rs</groupId>
       <artifactId>javax.ws.rs-api</artifactId>
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
-      <artifactId>servlet-api</artifactId>
+      <artifactId>javax.servlet-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
diff --git a/pom.xml b/pom.xml
index 554c35e73ed8635c28655f04708272591d74f110..53b389a329967da81f12e12bc97eb6e398687d36 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         <artifactId>geronimo-jpa_2.0_spec</artifactId>
         <version>1.1</version>
       </dependency>
-      <dependency>
-        <groupId>javax.servlet</groupId>
-        <artifactId>servlet-api</artifactId>
-        <version>2.5</version>
-      </dependency>
       <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>javax.servlet-api</artifactId>
-        <version>3.0.1</version>
+        <version>3.1.0</version>
       </dependency>
       <dependency>
         <groupId>org.slf4j</groupId>