Package org.jets3t.service.impl.rest.XmlResponsesSaxParser

Examples of org.jets3t.service.impl.rest.XmlResponsesSaxParser.CopyObjectResultHandler


        }       
       
        HttpMethodAndByteCount methodAndByteCount = performRestPut(
            destinationBucketName, destinationObjectKey, metadata, null, null, false);
       
        CopyObjectResultHandler handler = (new XmlResponsesSaxParser()).parseCopyObjectResponse(
                new HttpMethodReleaseInputStream(methodAndByteCount.getHttpMethod()));
       
        // Release HTTP connection manually. This should already have been done by the
        // HttpMethodReleaseInputStream class, but you can never be too sure...
        methodAndByteCount.getHttpMethod().releaseConnection();
       
        if (handler.isErrorResponse()) {
            throw new S3ServiceException(
                "Copy failed: Code=" + handler.getErrorCode() +
                ", Message=" + handler.getErrorMessage() +
                ", RequestId=" + handler.getErrorRequestId() +
                ", HostId=" + handler.getErrorHostId());
        }           

        Map map = new HashMap();

        // Result fields returned when copy is successful.
        map.put("Last-Modified", handler.getLastModified());
        map.put("ETag", handler.getETag());

        // Include response headers in result map.
        map.putAll(convertHeadersToMap(methodAndByteCount.getHttpMethod().getResponseHeaders()));
        map = ServiceUtils.cleanRestMetadataMap(map);
View Full Code Here


        }       
       
        HttpMethodAndByteCount methodAndByteCount = performRestPut(
            destinationBucketName, destinationObjectKey, metadata, null, null, false);
       
        CopyObjectResultHandler handler = (new XmlResponsesSaxParser()).parseCopyObjectResponse(
                new HttpMethodReleaseInputStream(methodAndByteCount.getHttpMethod()));
       
        // Release HTTP connection manually. This should already have been done by the
        // HttpMethodReleaseInputStream class, but you can never be too sure...
        methodAndByteCount.getHttpMethod().releaseConnection();
       
        if (handler.isErrorResponse()) {
            throw new S3ServiceException(
                "Copy failed: Code=" + handler.getErrorCode() +
                ", Message=" + handler.getErrorMessage() +
                ", RequestId=" + handler.getErrorRequestId() +
                ", HostId=" + handler.getErrorHostId());
        }           

        Map map = new HashMap();

        // Result fields returned when copy is successful.
        map.put("Last-Modified", handler.getLastModified());
        map.put("ETag", handler.getETag());

        // Include response headers in result map.
        map.putAll(convertHeadersToMap(methodAndByteCount.getHttpMethod().getResponseHeaders()));
        map = ServiceUtils.cleanRestMetadataMap(map);
View Full Code Here

        }

        HttpResponseAndByteCount methodAndByteCount = performRestPut(
                destinationBucketName, destinationObjectKey, metadata, null, null, false);

        CopyObjectResultHandler handler = getXmlResponseSaxParser()
                .parseCopyObjectResponse(
                        new HttpMethodReleaseInputStream(methodAndByteCount.getHttpResponse()));

        // Release HTTP connection manually. This should already have been done by the
        // HttpMethodReleaseInputStream class, but you can never be too sure...
        releaseConnection(methodAndByteCount.getHttpResponse());

        if(handler.isErrorResponse()) {
            throw new ServiceException(
                    "Copy failed: Code=" + handler.getErrorCode() +
                            ", Message=" + handler.getErrorMessage() +
                            ", RequestId=" + handler.getErrorRequestId() +
                            ", HostId=" + handler.getErrorHostId());
        }

        Map<String, Object> map = new HashMap<String, Object>();

        // Result fields returned when copy is successful.
        map.put("Last-Modified", handler.getLastModified());
        map.put("ETag", handler.getETag());

        // Include information about copy operation in result map, issue #192
        map.put("X-JetS3t-SourceBucketName", sourceBucketName);
        map.put("X-JetS3t-SourceObjectKey", sourceObjectKey);
        map.put("X-JetS3t-DestinationBucketName", destinationBucketName);
View Full Code Here

TOP

Related Classes of org.jets3t.service.impl.rest.XmlResponsesSaxParser.CopyObjectResultHandler

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.