</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
- <artifactId>servlet-api-2.5</artifactId>
- <version>${jetty.version}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jsp-api-2.0</artifactId>
+ <artifactId>jsp-2.1-jetty</artifactId>
<version>${jetty.version}</version>
<scope>runtime</scope>
</dependency>
<version>1.6.5</version>
<scope>runtime</scope>
</dependency>
- <dependency>
- <groupId>commons-el</groupId>
- <artifactId>commons-el</artifactId>
- <version>1.0</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>jasper-compiler</artifactId>
- <version>5.5.15</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>jsp-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>jasper-runtime</artifactId>
- <version>5.5.15</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl104-over-slf4j</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>tomcat</groupId>
- <artifactId>jasper-compiler-jdt</artifactId>
- <version>5.5.15</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.jdt</groupId>
- <artifactId>core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
}
String logicalResource = RepositoryPathUtil.getLogicalResource( archivaLocator.getResourcePath() );
+ if ( logicalResource.endsWith( "/" ) )
+ {
+ logicalResource = logicalResource.substring( 1 );
+ }
resourcesInAbsolutePath.add( new File( managedRepository.getRepoRoot(), logicalResource ).getAbsolutePath() );
}
catch ( DavException e )
DavResource resource = null;
if ( isAuthorized( request, managedRepository.getId() ) )
{
- LogicalResource logicalResource =
- new LogicalResource( RepositoryPathUtil.getLogicalResource( archivaLocator.getResourcePath() ) );
+ String path = RepositoryPathUtil.getLogicalResource( archivaLocator.getResourcePath() );
+ if ( path.startsWith( "/" ) )
+ {
+ path = path.substring( 1 );
+ }
+ LogicalResource logicalResource = new LogicalResource( path );
- File resourceFile = new File( managedRepository.getRepoRoot(), logicalResource.getPath() );
+ File resourceFile = new File( managedRepository.getRepoRoot(), path );
resource =
- new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource.getPath(),
+ new ArchivaDavResource( resourceFile.getAbsolutePath(), path,
managedRepository.getRepository(), request.getRemoteAddr(), activePrincipal,
request.getDavSession(), archivaLocator, this, mimeTypes, auditListeners,
scheduler );
}
String logicalResource = RepositoryPathUtil.getLogicalResource( locator.getResourcePath() );
+ if ( logicalResource.startsWith( "/" ) )
+ {
+ logicalResource = logicalResource.substring( 1 );
+ }
File resourceFile = new File( managedRepository.getRepoRoot(), logicalResource );
DavResource resource =
new ArchivaDavResource( resourceFile.getAbsolutePath(), logicalResource, managedRepository.getRepository(),
throws DavException
{
List<File> mergedRepositoryContents = new ArrayList<File>();
- LogicalResource logicalResource =
- new LogicalResource( RepositoryPathUtil.getLogicalResource( locator.getResourcePath() ) );
+ String path = RepositoryPathUtil.getLogicalResource( locator.getResourcePath() );
+ if ( path.startsWith( "/" ) )
+ {
+ path = path.substring( 1 );
+ }
+ LogicalResource logicalResource = new LogicalResource( path );
// flow:
// if the current user logged in has permission to any of the repositories, allow user to
{
writer.println("<html>");
writer.println("<head>");
- writer.println("<title>Collection: " + logicalResource + "</title>");
+ writer.println("<title>Collection: /" + logicalResource + "</title>");
writer.println("</head>");
writer.println("<body>");
- writer.println("<h3>Collection: " + logicalResource + "</h3>");
+ writer.println("<h3>Collection: /" + logicalResource + "</h3>");
//Check if not root
- if (!"/".equals(logicalResource))
+ if (logicalResource.length() > 0)
{
File file = new File(logicalResource);
- String parentName = file.getParent().equals("") ? "/" : file.getParent();
+ String parentName = file.getParent() == null ? "/" : file.getParent();
//convert to unix path in case archiva is hosted on windows
parentName = StringUtils.replace(parentName, "\\", "/" );
* under the License.
*/
-import com.meterware.httpunit.WebConversation;
-import com.meterware.httpunit.WebResponse;
+import java.io.File;
import org.apache.commons.io.FileUtils;
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.maven.archiva.policies.ChecksumPolicy;
import org.apache.maven.archiva.policies.ReleasesPolicy;
import org.apache.maven.archiva.policies.SnapshotsPolicy;
-import org.mortbay.jetty.Connector;
import org.mortbay.jetty.Server;
-import org.mortbay.jetty.bio.SocketConnector;
import org.mortbay.jetty.handler.ContextHandler;
import org.mortbay.jetty.handler.ContextHandlerCollection;
import org.mortbay.jetty.servlet.DefaultServlet;
import org.mortbay.jetty.servlet.ServletHandler;
-import java.io.File;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebResponse;
/**
* AbstractRepositoryServletProxiedTestCase
repo.root.mkdirs();
}
- repo.server = new Server();
+ repo.server = new Server( 0 );
ContextHandlerCollection contexts = new ContextHandlerCollection();
repo.server.setHandler( contexts );
- SocketConnector connector = new SocketConnector();
- connector.setPort( 0 ); // 0 means, choose and empty port. (we'll find out which, later)
-
- repo.server.setConnectors( new Connector[] { connector } );
-
ContextHandler context = new ContextHandler();
context.setContextPath( repo.context );
context.setResourceBase( repo.root.getAbsolutePath() );
repo.server.start();
- int port = connector.getLocalPort();
+ int port = repo.server.getConnectors()[0].getLocalPort();
repo.url = "http://localhost:" + port + repo.context;
System.out.println( "Remote HTTP Server started on " + repo.url );
protected void assertResponseOK( WebResponse response )
{
assertNotNull( "Should have recieved a response", response );
- Assert.assertEquals( "Should have been an OK response code.", HttpServletResponse.SC_OK, response.getResponseCode() );
+ Assert.assertEquals( "Should have been an OK response code", HttpServletResponse.SC_OK,
+ response.getResponseCode() );
+ }
+
+ protected void assertResponseOK( WebResponse response, String path )
+ {
+ assertNotNull( "Should have recieved a response", response );
+ Assert.assertEquals( "Should have been an OK response code for path: " + path, HttpServletResponse.SC_OK,
+ response.getResponseCode() );
}
protected void assertResponseNotFound( WebResponse response )
assertEquals( "Expected managed file contents", expectedManagedContents, response.getText() );
break;
case EXPECT_REMOTE_CONTENTS:
- assertResponseOK( response );
+ assertResponseOK( response, path );
assertEquals( "Expected remote file contents", expectedRemoteContents, response.getText() );
break;
case EXPECT_NOT_FOUND:
<maven.version>2.0.8</maven.version>
<wagon.version>1.0-beta-5</wagon.version>
<redback.version>1.2.1</redback.version>
- <jetty.version>6.1.6</jetty.version>
+ <jetty.version>6.1.19</jetty.version>
<binder.version>0.9</binder.version>
<spring.version>2.5.6</spring.version>
</properties>