Package org.apache.archiva.rest.api.model

Examples of org.apache.archiva.rest.api.model.ArtifactContent


                    // 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();
    }
View Full Code Here


                    JarFile jarFile = new JarFile( file );
                    ZipEntry zipEntry = jarFile.getEntry( path );
                    InputStream inputStream = jarFile.getInputStream( zipEntry );
                    try
                    {
                        return new ArtifactContent( IOUtils.toString( inputStream ), repoId );
                    }
                    finally
                    {
                        closeQuietly( jarFile );
                        IOUtils.closeQuietly( inputStream );
                    }
                }
                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();
    }
View Full Code Here

                    JarFile jarFile = new JarFile( file );
                    ZipEntry zipEntry = jarFile.getEntry( path );
                    InputStream inputStream = jarFile.getInputStream( zipEntry );
                    try
                    {
                        return new ArtifactContent( IOUtils.toString( inputStream ), repoId );
                    }
                    finally
                    {
                        closeQuietly( jarFile );
                        IOUtils.closeQuietly( inputStream );
                    }
                }
                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();
    }
View Full Code Here

                    JarFile jarFile = new JarFile( file );
                    ZipEntry zipEntry = jarFile.getEntry( path );
                    InputStream inputStream = jarFile.getInputStream( zipEntry );
                    try
                    {
                        return new ArtifactContent( IOUtils.toString( inputStream ), repoId );
                    }
                    finally
                    {
                        closeQuietly( jarFile );
                        IOUtils.closeQuietly( inputStream );
                    }
                }
                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();
    }
View Full Code Here

                    JarFile jarFile = new JarFile( file );
                    ZipEntry zipEntry = jarFile.getEntry( path );
                    InputStream inputStream = jarFile.getInputStream( zipEntry );
                    try
                    {
                        return new ArtifactContent( IOUtils.toString( inputStream ), repoId );
                    }
                    finally
                    {
                        closeQuietly( jarFile );
                        IOUtils.closeQuietly( inputStream );
                    }
                }
                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();
    }
View Full Code Here

TOP

Related Classes of org.apache.archiva.rest.api.model.ArtifactContent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.