// zip entry of the path -> path must a real file entry of the archive
JarFile jarFile = new JarFile( file );
ZipEntry zipEntry = jarFile.getEntry( path );
try (InputStream inputStream = jarFile.getInputStream( zipEntry ))
{
return new ArtifactContent( IOUtils.toString( inputStream ), repoId );
}
finally
{
closeQuietly( jarFile );
}
}
return new ArtifactContent( FileUtils.readFileToString( file ), repoId );
}
}
catch ( IOException e )
{
log.error( e.getMessage(), e );
throw new ArchivaRestServiceException( e.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
}
catch ( RepositoryNotFoundException e )
{
log.error( e.getMessage(), e );
throw new ArchivaRestServiceException( e.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
}
catch ( RepositoryException e )
{
log.error( e.getMessage(), e );
throw new ArchivaRestServiceException( e.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
}
log.debug( "artifact: {}:{}:{}:{}:{} not found", groupId, artifactId, version, classifier, type );
// 404 ?
return new ArtifactContent();
}