@Test public void should_continue_chaining_when_ifnonematch_ne_etag() { HandlerContext handlerContext = new HandlerContext(context, request, response, "content-has-changed".getBytes()); request.addHeader(HttpHeader.IFNONEMATCH.getName(), "\"" + RESOURCE_MD5 + "\""); boolean shouldContinue = handler.handle(handlerContext); assertThat(shouldContinue).isTrue(); }
@Override public boolean handle(HandlerContext handlerContext) { String ifNoneMatchValue = handlerContext.getRequest().getHeader(HttpHeader.IFNONEMATCH.getName()); String etagValue = HttpHeaderUtils.computeETag(handlerContext.getResponseAsBytes(), handlerContext); if (StringUtils.isNotBlank(ifNoneMatchValue) && ifNoneMatchValue.equals(etagValue)) { handlerContext.getResponse().setStatus(HttpServletResponse.SC_NOT_MODIFIED); return false; } else { return true; } }
ETagPostHandler extends AbstractHandlerChain { @Override public boolean handle(HandlerContext handlerContext) { String ifNoneMatchValue = handlerContext.getRequest().getHeader(HttpHeader.IFNONEMATCH.getName()); String etagValue = HttpHeaderUtils.computeETag(handlerContext.getResponseAsBytes(), handlerContext); if (StringUtils.isNotBlank(ifNoneMatchValue) && ifNoneMatchValue.equals(etagValue)) { handlerContext.getResponse().setStatus(HttpServletResponse.SC_NOT_MODIFIED); return false; } else { return true; } } }
ETagPostHandler extends AbstractHandlerChain { @Override public boolean handle(HandlerContext handlerContext) { String ifNoneMatchValue = handlerContext.getRequest().getHeader(HttpHeader.IFNONEMATCH.getName()); String etagValue = HttpHeaderUtils.computeETag(handlerContext.getResponseAsBytes(), handlerContext); if (StringUtils.isNotBlank(ifNoneMatchValue) && ifNoneMatchValue.equals(etagValue)) { handlerContext.getResponse().setStatus(HttpServletResponse.SC_NOT_MODIFIED); return false; } else { return true; } }  }
ETagPostHandler extends AbstractHandlerChain { @Override public boolean handle(HandlerContext handlerContext) { String ifNoneMatchValue = handlerContext.getRequest().getHeader(HttpHeader.IFNONEMATCH.getName()); String etagValue = HttpHeaderUtils.computeETag(handlerContext.getResponseAsBytes(), handlerContext); if (StringUtils.isNotBlank(ifNoneMatchValue) && ifNoneMatchValue.equals(etagValue)) { handlerContext.getResponse().setStatus(HttpServletResponse.SC_NOT_MODIFIED); return false; } else { return true; } }  @Override boolean isAfterChaining(); @Override int getRank(); @Override boolean isApplicable(HandlerContext handlerContext); @Override boolean handle(HandlerContext handlerContext); }
ETagPostHandler extends AbstractHandlerChain { @Override public boolean handle(HandlerContext handlerContext) { String ifNoneMatchValue = handlerContext.getRequest().getHeader(HttpHeader.IFNONEMATCH.getName()); String etagValue = HttpHeaderUtils.computeETag(handlerContext.getResponseAsBytes(), handlerContext); if (StringUtils.isNotBlank(ifNoneMatchValue) && ifNoneMatchValue.equals(etagValue)) { handlerContext.getResponse().setStatus(HttpServletResponse.SC_NOT_MODIFIED); return false; } else { return true; } }  @Override boolean isAfterChaining(); @Override int getRank(); @Override boolean isApplicable(HandlerContext handlerContext); @Override boolean handle(HandlerContext handlerContext);  }