/** * The object's eTag hash should match the parameter <code>eTag</code>. * * <p /> * Not compatible with {@link #ifETagDoesntMatch(byte[])} or {@link #ifModifiedSince(Date)} * * @param eTag * hash representing the payload */ public GetOptions ifETagMatches(String eTag) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifETagMatches()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifETagMatches()"); this.headers.put(IF_MATCH, String.format("\"%1$s\"", checkNotNull(eTag, "eTag"))); return this; }
/** * The object's eTag hash should match the parameter <code>eTag</code>. * * <p /> * Not compatible with {@link #ifETagDoesntMatch(byte[])} or {@link #ifModifiedSince(Date)} * * @param eTag * hash representing the payload */ public GetOptions ifETagMatches(String eTag) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifETagMatches()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifETagMatches()"); this.headers.put(IF_MATCH, String.format("\"%1$s\"", checkNotNull(eTag, "eTag"))); return this; }
/** * Only return the object if it hasn't changed since this time. * <p /> * Not compatible with {@link #ifETagDoesntMatch(String)} or {@link #ifModifiedSince(Date)} */ public GetOptions ifUnmodifiedSince(Date ifUnmodifiedSince) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifUnmodifiedSince()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifUnmodifiedSince()"); this.headers.put(IF_UNMODIFIED_SINCE, dateService.rfc822DateFormat(checkNotNull(ifUnmodifiedSince, "ifUnmodifiedSince"))); return this; }
/** * The object's eTag hash should match the parameter <code>eTag</code>. * * <p /> * Not compatible with {@link #ifETagDoesntMatch(byte[])} or {@link #ifModifiedSince(Date)} * * @param eTag * hash representing the payload */ public GetOptions ifETagMatches(String eTag) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifETagMatches()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifETagMatches()"); this.headers.put(IF_MATCH, String.format("\"%1$s\"", checkNotNull(eTag, "eTag"))); return this; }
/** * Only return the object if it hasn't changed since this time. * <p /> * Not compatible with {@link #ifETagDoesntMatch(String)} or {@link #ifModifiedSince(Date)} */ public GetOptions ifUnmodifiedSince(Date ifUnmodifiedSince) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifUnmodifiedSince()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifUnmodifiedSince()"); this.headers.put(IF_UNMODIFIED_SINCE, dateService.rfc822DateFormat(checkNotNull(ifUnmodifiedSince, "ifUnmodifiedSince"))); return this; }
/** * Only return the object if it hasn't changed since this time. * <p /> * Not compatible with {@link #ifETagDoesntMatch(String)} or {@link #ifModifiedSince(Date)} */ public GetOptions ifUnmodifiedSince(Date ifUnmodifiedSince) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifUnmodifiedSince()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifUnmodifiedSince()"); this.headers.put(IF_UNMODIFIED_SINCE, dateService.rfc822DateFormat(checkNotNull(ifUnmodifiedSince, "ifUnmodifiedSince"))); return this; }
/** * Only return the object if it hasn't changed since this time. * <p /> * Not compatible with {@link #ifETagDoesntMatch(String)} or {@link #ifModifiedSince(Date)} */ public GetOptions ifUnmodifiedSince(Date ifUnmodifiedSince) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifUnmodifiedSince()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifUnmodifiedSince()"); this.headers.put(IF_UNMODIFIED_SINCE, dateService.rfc822DateFormat(checkNotNull(ifUnmodifiedSince, "ifUnmodifiedSince"))); return this; }
/** * Only return the object if it hasn't changed since this time. * <p /> * Not compatible with {@link #ifETagDoesntMatch(String)} or {@link #ifModifiedSince(Date)} */ public GetOptions ifUnmodifiedSince(Date ifUnmodifiedSince) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifUnmodifiedSince()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifUnmodifiedSince()"); this.headers.put(IF_UNMODIFIED_SINCE, dateService.rfc822DateFormat(checkNotNull(ifUnmodifiedSince, "ifUnmodifiedSince"))); return this; }
/** * Only return the object if it hasn't changed since this time. * <p /> * Not compatible with {@link #ifETagDoesntMatch(String)} or {@link #ifModifiedSince(Date)} */ public GetOptions ifUnmodifiedSince(Date ifUnmodifiedSince) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifUnmodifiedSince()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifUnmodifiedSince()"); this.headers.put(IF_UNMODIFIED_SINCE, dateService.rfc822DateFormat(checkNotNull(ifUnmodifiedSince, "ifUnmodifiedSince"))); return this; }
/** * The object's eTag hash should match the parameter <code>eTag</code>. * * <p /> * Not compatible with {@link #ifETagDoesntMatch(byte[])} or {@link #ifModifiedSince(Date)} * * @param eTag * hash representing the payload */ public GetOptions ifETagMatches(String eTag) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifETagMatches()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifETagMatches()"); this.headers.put(IF_MATCH, maybeQuoteETag(checkNotNull(eTag, "eTag"))); return this; }
/** * The object's eTag hash should match the parameter <code>eTag</code>. * * <p /> * Not compatible with {@link #ifETagDoesntMatch(byte[])} or {@link #ifModifiedSince(Date)} * * @param eTag * hash representing the payload */ public GetOptions ifETagMatches(String eTag) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifETagMatches()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifETagMatches()"); this.headers.put(IF_MATCH, maybeQuoteETag(checkNotNull(eTag, "eTag"))); return this; }
/** * The object's eTag hash should match the parameter <code>eTag</code>. * * <p /> * Not compatible with {@link #ifETagDoesntMatch(byte[])} or {@link #ifModifiedSince(Date)} * * @param eTag * hash representing the payload */ public GetOptions ifETagMatches(String eTag) { checkArgument(getIfNoneMatch() == null, "ifETagDoesntMatch() is not compatible with ifETagMatches()"); checkArgument(getIfModifiedSince() == null, "ifModifiedSince() is not compatible with ifETagMatches()"); this.headers.put(IF_MATCH, maybeQuoteETag(checkNotNull(eTag, "eTag"))); return this; }
@Test public void testIfModifiedSinceStatic() { GetOptions options = ifModifiedSince(now); assertEquals(options.getIfModifiedSince(), nowExpected); }
@Test public void testNullIfModifiedSince() { GetOptions options = new GetOptions(); assertNull(options.getIfModifiedSince()); }
@Test public void testIfModifiedSinceStatic() { GetOptions options = ifModifiedSince(now); assertEquals(options.getIfModifiedSince(), nowExpected); }
@Test public void testNullIfModifiedSince() { GetOptions options = new GetOptions(); assertNull(options.getIfModifiedSince()); }
@Test public void testIfModifiedSince() { GetOptions options = new GetOptions(); options.ifModifiedSince(now); assertEquals(options.getIfModifiedSince(), nowExpected); }
@Test public void testIfModifiedSince() { GetOptions options = new GetOptions(); options.ifModifiedSince(now); assertEquals(options.getIfModifiedSince(), nowExpected); }
public void testModifiedSinceAndRange() { GetOptions options = new GetOptions(); options.ifModifiedSince(now); options.range(0, 1024); assertEquals(options.getIfModifiedSince(), nowExpected); bytes1to1024(options); }
public void testModifiedSinceAndRange() { GetOptions options = new GetOptions(); options.ifModifiedSince(now); options.range(0, 1024); assertEquals(options.getIfModifiedSince(), nowExpected); bytes1to1024(options); }