Package com.bradmcevoy.http

Examples of com.bradmcevoy.http.ReplaceableResource


    public OutputStream createOutputStream( long offset ) throws IOException {
        log.debug( "createOutputStream: " + offset );
        final BufferingOutputStream out = new BufferingOutputStream( 50000 );
        if( r instanceof ReplaceableResource ) {
            log.debug( "resource is replaceable" );
            final ReplaceableResource rr = (ReplaceableResource) r;
            Runnable runnable = new Runnable() {

                public void run() {
                    try {
                        rr.replaceContent(out.getInputStream(), out.getSize());
                    } catch (BadRequestException ex) {
                        throw new RuntimeException(ex);
                    } catch (ConflictException ex) {
                        throw new RuntimeException(ex);
                    } catch (NotAuthorizedException ex) {
View Full Code Here


      if (r instanceof ReplaceableResource) {
        log.trace("updateResourceContentActual: " + mergedFile.getAbsolutePath() + ", resource is replaceable");
        FileInputStream fin = null;
        try {
          fin = new FileInputStream(mergedFile);
          ReplaceableResource rr = (ReplaceableResource) r;
          rr.replaceContent(fin, mergedFile.length());
        } finally {
          StreamUtils.close(fin);
        }
      } else {
        log.trace("updateResourceContentActual: " + mergedFile.getAbsolutePath() + ", resource is NOT replaceable, try to replace through parent");
View Full Code Here

                in = file.getInputStream();
                Resource existing = wrapped.child(newName);
                if( existing != null ) {
                    if( existing instanceof ReplaceableResource ) {
                        log.trace("existing resource is replaceable, so replace content");
                        ReplaceableResource rr = (ReplaceableResource) existing;
                        rr.replaceContent(in, null);
                    } else {
                        log.trace("existing resource is not replaceable, will be deleted");
                        if( existing instanceof DeletableResource ) {
                            DeletableResource dr = (DeletableResource) existing;
                            dr.delete();
View Full Code Here

TOP

Related Classes of com.bradmcevoy.http.ReplaceableResource

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.