upgrade to jetty 9.4 for archiva-rest-services module

Signed-off-by: olivier lamy <olamy@apache.org>
This commit is contained in:
olivier lamy 2017-05-11 21:38:51 +10:00
parent 1acc6e7b84
commit 52147ba057
6 changed files with 38 additions and 56 deletions

View 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>
@ -384,24 +385,14 @@
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<scope>test</scope>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<scope>test</scope>
</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>

View 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;
}
}

View 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}" />
@ -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.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">

View 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>

View File

@ -185,11 +185,6 @@
<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>
@ -234,7 +229,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>

View File

@ -1200,15 +1200,10 @@
<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>