populateRequesterPaysHeader(request, isRequesterPays); byte[] aclAsXml = new AclXmlFactory().convertToXmlByteArray(acl); request.addHeader("Content-Type", "application/xml"); request.addHeader("Content-Length", String.valueOf(aclAsXml.length));
/** * Returns an XML fragment representing the specified Grantee. * * @param grantee * The grantee to convert to an XML representation that can be * sent to Amazon S3 as part of a request. * @param xml * The XmlWriter to which to concatenate this node to. * * @return The given XmlWriter containing the specified grantee. * * @throws SdkClientException * If the specified grantee type isn't recognized. */ protected XmlWriter convertToXml(Grantee grantee, XmlWriter xml) throws SdkClientException { if (grantee instanceof CanonicalGrantee) { return convertToXml((CanonicalGrantee)grantee, xml); } else if (grantee instanceof EmailAddressGrantee) { return convertToXml((EmailAddressGrantee)grantee, xml); } else if (grantee instanceof GroupGrantee) { return convertToXml((GroupGrantee)grantee, xml); } else { throw new SdkClientException("Unknown Grantee type: " + grantee.getClass().getName()); } }
private static void addGrantsIfNotNull(XmlWriter xml, AccessControlList accessControlList) { if (accessControlList == null) { return; } AclXmlFactory aclXmlFactory = new AclXmlFactory(); xml.start("AccessControlList"); for(Grant grant: accessControlList.getGrantsAsList()) { xml.start("Grant"); if (grant.getGrantee() != null) { aclXmlFactory.convertToXml(grant.getGrantee(), xml); } addIfNotNull(xml, "Permission", grant.getPermission()); xml.end(); } xml.end(); }
final byte[] aclAsXml = new AclXmlFactory().convertToXmlByteArray(acl); request.addHeader("Content-Type", "application/xml"); request.addHeader("Content-Length", String.valueOf(aclAsXml.length));
/** * Returns an XML fragment representing the specified Grantee. * * @param grantee The grantee to convert to an XML representation that can * be sent to Amazon S3 as part of a request. * @param xml The XmlWriter to which to concatenate this node to. * @return The given XmlWriter containing the specified grantee. * @throws AmazonClientException If the specified grantee type isn't * recognized. */ protected XmlWriter convertToXml(Grantee grantee, XmlWriter xml) throws AmazonClientException { if (grantee instanceof CanonicalGrantee) { return convertToXml((CanonicalGrantee) grantee, xml); } else if (grantee instanceof EmailAddressGrantee) { return convertToXml((EmailAddressGrantee) grantee, xml); } else if (grantee instanceof GroupGrantee) { return convertToXml((GroupGrantee) grantee, xml); } else { throw new AmazonClientException("Unknown Grantee type: " + grantee.getClass().getName()); } }
populateRequesterPaysHeader(request, isRequesterPays); byte[] aclAsXml = new AclXmlFactory().convertToXmlByteArray(acl); request.addHeader("Content-Type", "application/xml"); request.addHeader("Content-Length", String.valueOf(aclAsXml.length));
for (Grant grant : acl.getGrantsAsList()) { xml.start("Grant"); convertToXml(grant.getGrantee(), xml); xml.start("Permission").value(grant.getPermission().toString()).end(); xml.end();
final byte[] aclAsXml = new AclXmlFactory().convertToXmlByteArray(acl); request.addHeader("Content-Type", "application/xml"); request.addHeader("Content-Length", String.valueOf(aclAsXml.length));
/** * Returns an XML fragment representing the specified Grantee. * * @param grantee * The grantee to convert to an XML representation that can be * sent to Amazon S3 as part of a request. * @param xml * The XmlWriter to which to concatenate this node to. * * @return The given XmlWriter containing the specified grantee. * * @throws SdkClientException * If the specified grantee type isn't recognized. */ protected XmlWriter convertToXml(Grantee grantee, XmlWriter xml) throws SdkClientException { if (grantee instanceof CanonicalGrantee) { return convertToXml((CanonicalGrantee)grantee, xml); } else if (grantee instanceof EmailAddressGrantee) { return convertToXml((EmailAddressGrantee)grantee, xml); } else if (grantee instanceof GroupGrantee) { return convertToXml((GroupGrantee)grantee, xml); } else { throw new SdkClientException("Unknown Grantee type: " + grantee.getClass().getName()); } }
/** * Returns an XML fragment representing the specified Grantee. * * @param grantee The grantee to convert to an XML representation that can * be sent to Amazon S3 as part of a request. * @param xml The XmlWriter to which to concatenate this node to. * @return The given XmlWriter containing the specified grantee. * @throws AmazonClientException If the specified grantee type isn't * recognized. */ protected XmlWriter convertToXml(Grantee grantee, XmlWriter xml) throws AmazonClientException { if (grantee instanceof CanonicalGrantee) { return convertToXml((CanonicalGrantee) grantee, xml); } else if (grantee instanceof EmailAddressGrantee) { return convertToXml((EmailAddressGrantee) grantee, xml); } else if (grantee instanceof GroupGrantee) { return convertToXml((GroupGrantee) grantee, xml); } else { throw new AmazonClientException("Unknown Grantee type: " + grantee.getClass().getName()); } }
for (Grant grant : acl.getGrants()) { xml.start("Grant"); convertToXml(grant.getGrantee(), xml); xml.start("Permission").value(grant.getPermission().toString()).end(); xml.end();
for (Grant grant : acl.getGrantsAsList()) { xml.start("Grant"); convertToXml(grant.getGrantee(), xml); xml.start("Permission").value(grant.getPermission().toString()).end(); xml.end();
for (Grant grant : acl.getGrants()) { xml.start("Grant"); convertToXml(grant.getGrantee(), xml); xml.start("Permission").value(grant.getPermission().toString()).end(); xml.end();