/** * The object should not have a eTag hash corresponding with the parameter <code>eTag</code>. * <p /> * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} * * @param eTag * hash representing the payload */ public GetOptions ifETagDoesntMatch(String eTag) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifETagDoesntMatch()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifETagDoesntMatch()"); this.headers.put(IF_NONE_MATCH, String.format("\"%1$s\"", checkNotNull(eTag, "ifETagDoesntMatch"))); return this; }
/** * The object should not have a eTag hash corresponding with the parameter <code>eTag</code>. * <p /> * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} * * @param eTag * hash representing the payload */ public GetOptions ifETagDoesntMatch(String eTag) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifETagDoesntMatch()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifETagDoesntMatch()"); this.headers.put(IF_NONE_MATCH, String.format("\"%1$s\"", checkNotNull(eTag, "ifETagDoesntMatch"))); return this; }
/** * The object should not have a eTag hash corresponding with the parameter <code>eTag</code>. * <p /> * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} * * @param eTag * hash representing the payload */ public GetOptions ifETagDoesntMatch(String eTag) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifETagDoesntMatch()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifETagDoesntMatch()"); this.headers.put(IF_NONE_MATCH, String.format("\"%1$s\"", checkNotNull(eTag, "ifETagDoesntMatch"))); return this; }
/** * Only return the object if it has changed since this time. * <p /> * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} */ public GetOptions ifModifiedSince(Date ifModifiedSince) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifModifiedSince()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifModifiedSince()"); this.headers.put(IF_MODIFIED_SINCE, dateService.rfc822DateFormat(checkNotNull(ifModifiedSince, "ifModifiedSince"))); return this; }
/** * Only return the object if it has changed since this time. * <p /> * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} */ public GetOptions ifModifiedSince(Date ifModifiedSince) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifModifiedSince()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifModifiedSince()"); this.headers.put(IF_MODIFIED_SINCE, dateService.rfc822DateFormat(checkNotNull(ifModifiedSince, "ifModifiedSince"))); return this; }
/** * Only return the object if it has changed since this time. * <p /> * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} */ public GetOptions ifModifiedSince(Date ifModifiedSince) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifModifiedSince()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifModifiedSince()"); this.headers.put(IF_MODIFIED_SINCE, dateService.rfc822DateFormat(checkNotNull(ifModifiedSince, "ifModifiedSince"))); return this; }
/** * Only return the object if it has changed since this time. * <p /> * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} */ public GetOptions ifModifiedSince(Date ifModifiedSince) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifModifiedSince()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifModifiedSince()"); this.headers.put(IF_MODIFIED_SINCE, dateService.rfc822DateFormat(checkNotNull(ifModifiedSince, "ifModifiedSince"))); return this; }
/** * Only return the object if it has changed since this time. * <p /> * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} */ public GetOptions ifModifiedSince(Date ifModifiedSince) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifModifiedSince()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifModifiedSince()"); this.headers.put(IF_MODIFIED_SINCE, dateService.rfc822DateFormat(checkNotNull(ifModifiedSince, "ifModifiedSince"))); return this; }
/** * Only return the object if it has changed since this time. * <p /> * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} */ public GetOptions ifModifiedSince(Date ifModifiedSince) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifModifiedSince()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifModifiedSince()"); this.headers.put(IF_MODIFIED_SINCE, dateService.rfc822DateFormat(checkNotNull(ifModifiedSince, "ifModifiedSince"))); return this; }
/** * The object should not have a eTag hash corresponding with the parameter <code>eTag</code>. * <p /> * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} * * @param eTag * hash representing the payload */ public GetOptions ifETagDoesntMatch(String eTag) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifETagDoesntMatch()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifETagDoesntMatch()"); this.headers.put(IF_NONE_MATCH, maybeQuoteETag(checkNotNull(eTag, "ifETagDoesntMatch"))); return this; }
/** * The object should not have a eTag hash corresponding with the parameter <code>eTag</code>. * <p /> * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} * * @param eTag * hash representing the payload */ public GetOptions ifETagDoesntMatch(String eTag) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifETagDoesntMatch()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifETagDoesntMatch()"); this.headers.put(IF_NONE_MATCH, maybeQuoteETag(checkNotNull(eTag, "ifETagDoesntMatch"))); return this; }
/** * The object should not have a eTag hash corresponding with the parameter <code>eTag</code>. * <p /> * Not compatible with {@link #ifETagMatches(String)} or {@link #ifUnmodifiedSince(Date)} * * @param eTag * hash representing the payload */ public GetOptions ifETagDoesntMatch(String eTag) { checkArgument(getIfMatch() == null, "ifETagMatches() is not compatible with ifETagDoesntMatch()"); checkArgument(getIfUnmodifiedSince() == null, "ifUnmodifiedSince() is not compatible with ifETagDoesntMatch()"); this.headers.put(IF_NONE_MATCH, maybeQuoteETag(checkNotNull(eTag, "ifETagDoesntMatch"))); return this; }
private void isNowExpected(GetOptions options) { assertEquals(options.getIfUnmodifiedSince(), nowExpected); }
private void isNowExpected(GetOptions options) { assertEquals(options.getIfUnmodifiedSince(), nowExpected); }
@Test public void testNullIfUnmodifiedSince() { GetOptions options = new GetOptions(); assertNull(options.getIfUnmodifiedSince()); }
@Test public void testNullIfUnmodifiedSince() { GetOptions options = new GetOptions(); assertNull(options.getIfUnmodifiedSince()); }
public GetOptions apply(org.jclouds.http.options.GetOptions[] from) { checkNotNull(from, "options"); org.jclouds.blobstore.options.GetOptions to = new org.jclouds.blobstore.options.GetOptions(); if (from.length != 0) { if (from[0].getIfMatch() != null) { to.ifETagMatches(from[0].getIfMatch().replace("\"", "")); } if (from[0].getIfModifiedSince() != null) { Date time = dateService.rfc822DateParse(from[0].getIfModifiedSince()); to.ifModifiedSince(time); } if (from[0].getIfNoneMatch() != null) { to.ifETagDoesntMatch(from[0].getIfNoneMatch().replace("\"", "")); } if (from[0].getIfUnmodifiedSince() != null) { Date time = dateService.rfc822DateParse(from[0].getIfUnmodifiedSince()); to.ifUnmodifiedSince(time); } for (String range : from[0].getRanges()) { String[] firstLast = range.split("\\-"); to.range(Long.parseLong(firstLast[0]), Long.parseLong(firstLast[1])); } } return to; }
public GetOptions apply(org.jclouds.http.options.GetOptions[] from) { checkNotNull(from, "options"); org.jclouds.blobstore.options.GetOptions to = new org.jclouds.blobstore.options.GetOptions(); if (from.length != 0) { if (from[0].getIfMatch() != null) { to.ifETagMatches(from[0].getIfMatch().replace("\"", "")); } if (from[0].getIfModifiedSince() != null) { Date time = dateService.rfc822DateParse(from[0].getIfModifiedSince()); to.ifModifiedSince(time); } if (from[0].getIfNoneMatch() != null) { to.ifETagDoesntMatch(from[0].getIfNoneMatch().replace("\"", "")); } if (from[0].getIfUnmodifiedSince() != null) { Date time = dateService.rfc822DateParse(from[0].getIfUnmodifiedSince()); to.ifUnmodifiedSince(time); } for (String range : from[0].getRanges()) { String[] firstLast = range.split("\\-"); to.range(Long.parseLong(firstLast[0]), Long.parseLong(firstLast[1])); } } return to; }
public GetOptions apply(org.jclouds.http.options.GetOptions[] from) { checkNotNull(from, "options"); org.jclouds.blobstore.options.GetOptions to = new org.jclouds.blobstore.options.GetOptions(); if (from.length != 0) { if (from[0].getIfMatch() != null) { to.ifETagMatches(Strings2.replaceAll(from[0].getIfMatch(), '"', "")); } if (from[0].getIfModifiedSince() != null) { Date time = dateService.rfc822DateParse(from[0].getIfModifiedSince()); to.ifModifiedSince(time); } if (from[0].getIfNoneMatch() != null) { to.ifETagDoesntMatch(Strings2.replaceAll(from[0].getIfNoneMatch(), '"', "")); } if (from[0].getIfUnmodifiedSince() != null) { Date time = dateService.rfc822DateParse(from[0].getIfUnmodifiedSince()); to.ifUnmodifiedSince(time); } for (String range : from[0].getRanges()) { String[] firstLast = range.split("\\-"); to.range(Long.parseLong(firstLast[0]), Long.parseLong(firstLast[1])); } } return to; }
public GetOptions apply(org.jclouds.http.options.GetOptions[] from) { checkNotNull(from, "options"); org.jclouds.blobstore.options.GetOptions to = new org.jclouds.blobstore.options.GetOptions(); if (from.length != 0) { if (from[0].getIfMatch() != null) { to.ifETagMatches(Strings2.replaceAll(from[0].getIfMatch(), '"', "")); } if (from[0].getIfModifiedSince() != null) { Date time = dateService.rfc822DateParse(from[0].getIfModifiedSince()); to.ifModifiedSince(time); } if (from[0].getIfNoneMatch() != null) { to.ifETagDoesntMatch(Strings2.replaceAll(from[0].getIfNoneMatch(), '"', "")); } if (from[0].getIfUnmodifiedSince() != null) { Date time = dateService.rfc822DateParse(from[0].getIfUnmodifiedSince()); to.ifUnmodifiedSince(time); } for (String range : from[0].getRanges()) { String[] firstLast = range.split("\\-"); to.range(Long.parseLong(firstLast[0]), Long.parseLong(firstLast[1])); } } return to; }