@VisibleForTesting void addUserMetadataTo(HttpResponse from, MutableContainerPropertiesWithMetadata metadata) { for (Entry<String, String> header : from.getHeaders().entries()) { if (header.getKey() != null && header.getKey().startsWith(metadataPrefix)) metadata.getMetadata().put((header.getKey().substring(metadataPrefix.length())).toLowerCase(), header.getValue()); } }
@VisibleForTesting void parseLastModifiedOrThrowException(HttpResponse from, MutableContainerPropertiesWithMetadata metadata) throws HttpException { String lastModified = from.getFirstHeaderOrNull(HttpHeaders.LAST_MODIFIED); if (lastModified == null) throw new HttpException(HttpHeaders.LAST_MODIFIED + " header not present in response: " + from); metadata.setLastModified(dateParser.rfc822DateParse(lastModified)); if (metadata.getLastModified() == null) throw new HttpException("could not parse: " + HttpHeaders.LAST_MODIFIED + ": " + lastModified); }
public ContainerProperties apply(HttpResponse from) { MutableContainerPropertiesWithMetadata to = new MutableContainerPropertiesWithMetadataImpl(); to.setName(request.getInvocation().getArgs().get(0).toString()); addUserMetadataTo(from, to); parseLastModifiedOrThrowException(from, to); addETagTo(from, to); to.setUrl(request.getEndpoint()); return to; }
public ContainerProperties apply(HttpResponse from) { MutableContainerPropertiesWithMetadata to = new MutableContainerPropertiesWithMetadataImpl(); to.setName(request.getInvocation().getArgs().get(0).toString()); addUserMetadataTo(from, to); parseLastModifiedOrThrowException(from, to); addETagTo(from, to); to.setUrl(request.getEndpoint()); to.setPublicAccess(new ParsePublicAccessHeader().apply(from)); return to; }
@VisibleForTesting void parseLastModifiedOrThrowException(HttpResponse from, MutableContainerPropertiesWithMetadata metadata) throws HttpException { String lastModified = from.getFirstHeaderOrNull(HttpHeaders.LAST_MODIFIED); if (lastModified == null) throw new HttpException(HttpHeaders.LAST_MODIFIED + " header not present in response: " + from); metadata.setLastModified(dateParser.rfc822DateParse(lastModified)); if (metadata.getLastModified() == null) throw new HttpException("could not parse: " + HttpHeaders.LAST_MODIFIED + ": " + lastModified); }
public ContainerProperties apply(HttpResponse from) { MutableContainerPropertiesWithMetadata to = new MutableContainerPropertiesWithMetadataImpl(); to.setName(request.getInvocation().getArgs().get(0).toString()); addUserMetadataTo(from, to); parseLastModifiedOrThrowException(from, to); addETagTo(from, to); to.setUrl(request.getEndpoint()); return to; }
@VisibleForTesting void parseLastModifiedOrThrowException(HttpResponse from, MutableContainerPropertiesWithMetadata metadata) throws HttpException { String lastModified = from.getFirstHeaderOrNull(HttpHeaders.LAST_MODIFIED); if (lastModified == null) throw new HttpException(HttpHeaders.LAST_MODIFIED + " header not present in response: " + from); metadata.setLastModified(dateParser.rfc822DateParse(lastModified)); if (metadata.getLastModified() == null) throw new HttpException("could not parse: " + HttpHeaders.LAST_MODIFIED + ": " + lastModified); }
public ContainerProperties apply(HttpResponse from) { MutableContainerPropertiesWithMetadata to = new MutableContainerPropertiesWithMetadataImpl(); to.setName(request.getInvocation().getArgs().get(0).toString()); addUserMetadataTo(from, to); parseLastModifiedOrThrowException(from, to); addETagTo(from, to); to.setUrl(request.getEndpoint()); return to; }
@VisibleForTesting void addUserMetadataTo(HttpResponse from, MutableContainerPropertiesWithMetadata metadata) { for (Entry<String, String> header : from.getHeaders().entries()) { if (header.getKey() != null && header.getKey().startsWith(metadataPrefix)) metadata.getMetadata().put((header.getKey().substring(metadataPrefix.length())).toLowerCase(), header.getValue()); } }
@VisibleForTesting void parseLastModifiedOrThrowException(HttpResponse from, MutableContainerPropertiesWithMetadata metadata) throws HttpException { String lastModified = from.getFirstHeaderOrNull(HttpHeaders.LAST_MODIFIED); if (lastModified == null) throw new HttpException(HttpHeaders.LAST_MODIFIED + " header not present in response: " + from); metadata.setLastModified(dateParser.rfc822DateParse(lastModified)); if (metadata.getLastModified() == null) throw new HttpException("could not parse: " + HttpHeaders.LAST_MODIFIED + ": " + lastModified); }
public ContainerProperties apply(HttpResponse from) { MutableContainerPropertiesWithMetadata to = new MutableContainerPropertiesWithMetadataImpl(); to.setName(request.getInvocation().getArgs().get(0).toString()); addUserMetadataTo(from, to); parseLastModifiedOrThrowException(from, to); addETagTo(from, to); to.setUrl(request.getEndpoint()); return to; }
@VisibleForTesting void addUserMetadataTo(HttpResponse from, MutableContainerPropertiesWithMetadata metadata) { for (Entry<String, String> header : from.getHeaders().entries()) { if (header.getKey() != null && header.getKey().startsWith(metadataPrefix)) metadata.getMetadata().put((header.getKey().substring(metadataPrefix.length())).toLowerCase(), header.getValue()); } }
@VisibleForTesting void parseLastModifiedOrThrowException(HttpResponse from, MutableContainerPropertiesWithMetadata metadata) throws HttpException { String lastModified = from.getFirstHeaderOrNull(HttpHeaders.LAST_MODIFIED); if (lastModified == null) throw new HttpException(HttpHeaders.LAST_MODIFIED + " header not present in response: " + from); metadata.setLastModified(dateParser.rfc822DateParse(lastModified)); if (metadata.getLastModified() == null) throw new HttpException("could not parse: " + HttpHeaders.LAST_MODIFIED + ": " + lastModified); }
@VisibleForTesting void addUserMetadataTo(HttpResponse from, MutableContainerPropertiesWithMetadata metadata) { for (Entry<String, String> header : from.getHeaders().entries()) { if (header.getKey() != null && header.getKey().startsWith(metadataPrefix)) metadata.getMetadata().put((header.getKey().substring(metadataPrefix.length())).toLowerCase(), header.getValue()); } }
@VisibleForTesting void addUserMetadataTo(HttpResponse from, MutableContainerPropertiesWithMetadata metadata) { for (Entry<String, String> header : from.getHeaders().entries()) { if (header.getKey() != null && header.getKey().startsWith(metadataPrefix)) metadata.getMetadata().put((header.getKey().substring(metadataPrefix.length())).toLowerCase(), header.getValue()); } }