@Test public void testAdjustRange() { MapResumableProcessor proc = new MapResumableProcessor(); ResumableAsyncHandler handler = new ResumableAsyncHandler(proc); Request request = get("http: Request newRequest = handler.adjustRequestRange(request); assertEquals(newRequest.getUri(), request.getUri()); String rangeHeader = newRequest.getHeaders().get(RANGE); assertNull(rangeHeader); proc.put("http: newRequest = handler.adjustRequestRange(request); assertEquals(newRequest.getUri(), request.getUri()); rangeHeader = newRequest.getHeaders().get(RANGE); assertEquals(rangeHeader, "bytes=5000-"); }
public Request adjustRequestRange(Request request) { Long ri = resumableIndex.get(request.getUrl()); if (ri != null) { byteTransferred.set(ri); } if (resumableListener != null && resumableListener.length() > 0 && byteTransferred.get() != resumableListener.length()) { byteTransferred.set(resumableListener.length()); } RequestBuilder builder = request.toBuilder(); if (request.getHeaders().get(RANGE) == null && byteTransferred.get() != 0) { builder.setHeader(RANGE, "bytes=" + byteTransferred.get() + "-"); } return builder.build(); }
ResumableAsyncHandler implements AsyncHandler<Response> { public Request adjustRequestRange(Request request) { Long ri = resumableIndex.get(request.getUrl()); if (ri != null) { byteTransferred.set(ri); } if (resumableListener != null && resumableListener.length() > 0 && byteTransferred.get() != resumableListener.length()) { byteTransferred.set(resumableListener.length()); } RequestBuilder builder = request.toBuilder(); if (request.getHeaders().get(RANGE) == null && byteTransferred.get() != 0) { builder.setHeader(RANGE, "bytes=" + byteTransferred.get() + "-"); } return builder.build(); } }
ResumableAsyncHandler implements AsyncHandler<Response> { public Request adjustRequestRange(Request request) { Long ri = resumableIndex.get(request.getUrl()); if (ri != null) { byteTransferred.set(ri); } if (resumableListener != null && resumableListener.length() > 0 && byteTransferred.get() != resumableListener.length()) { byteTransferred.set(resumableListener.length()); } RequestBuilder builder = request.toBuilder(); if (request.getHeaders().get(RANGE) == null && byteTransferred.get() != 0) { builder.setHeader(RANGE, "bytes=" + byteTransferred.get() + "-"); } return builder.build(); } private  ResumableAsyncHandler(long byteTransferred, ResumableProcessor resumableProcessor,
                                AsyncHandler<Response> decoratedAsyncHandler, boolean accumulateBody);  ResumableAsyncHandler(long byteTransferred);  ResumableAsyncHandler(boolean accumulateBody);  ResumableAsyncHandler();  ResumableAsyncHandler(AsyncHandler<Response> decoratedAsyncHandler);  ResumableAsyncHandler(long byteTransferred, AsyncHandler<Response> decoratedAsyncHandler);  ResumableAsyncHandler(ResumableProcessor resumableProcessor);  ResumableAsyncHandler(ResumableProcessor resumableProcessor, boolean accumulateBody); }
ResumableAsyncHandler implements AsyncHandler<Response> { public Request adjustRequestRange(Request request) { Long ri = resumableIndex.get(request.getUrl()); if (ri != null) { byteTransferred.set(ri); } if (resumableListener != null && resumableListener.length() > 0 && byteTransferred.get() != resumableListener.length()) { byteTransferred.set(resumableListener.length()); } RequestBuilder builder = request.toBuilder(); if (request.getHeaders().get(RANGE) == null && byteTransferred.get() != 0) { builder.setHeader(RANGE, "bytes=" + byteTransferred.get() + "-"); } return builder.build(); } private  ResumableAsyncHandler(long byteTransferred, ResumableProcessor resumableProcessor,
                                AsyncHandler<Response> decoratedAsyncHandler, boolean accumulateBody);  ResumableAsyncHandler(long byteTransferred);  ResumableAsyncHandler(boolean accumulateBody);  ResumableAsyncHandler();  ResumableAsyncHandler(AsyncHandler<Response> decoratedAsyncHandler);  ResumableAsyncHandler(long byteTransferred, AsyncHandler<Response> decoratedAsyncHandler);  ResumableAsyncHandler(ResumableProcessor resumableProcessor);  ResumableAsyncHandler(ResumableProcessor resumableProcessor, boolean accumulateBody); @Override State onStatusReceived(final HttpResponseStatus status); @Override void onThrowable(Throwable t); @Override State onBodyPartReceived(HttpResponseBodyPart bodyPart); @Override Response onCompleted(); @Override State onHeadersReceived(HttpHeaders headers); @Override State onTrailingHeadersReceived(HttpHeaders headers); Request adjustRequestRange(Request request); ResumableAsyncHandler setResumableListener(ResumableListener resumableListener); }
ResumableAsyncHandler implements AsyncHandler<Response> { public Request adjustRequestRange(Request request) { Long ri = resumableIndex.get(request.getUrl()); if (ri != null) { byteTransferred.set(ri); } if (resumableListener != null && resumableListener.length() > 0 && byteTransferred.get() != resumableListener.length()) { byteTransferred.set(resumableListener.length()); } RequestBuilder builder = request.toBuilder(); if (request.getHeaders().get(RANGE) == null && byteTransferred.get() != 0) { builder.setHeader(RANGE, "bytes=" + byteTransferred.get() + "-"); } return builder.build(); } private  ResumableAsyncHandler(long byteTransferred, ResumableProcessor resumableProcessor,
                                AsyncHandler<Response> decoratedAsyncHandler, boolean accumulateBody);  ResumableAsyncHandler(long byteTransferred);  ResumableAsyncHandler(boolean accumulateBody);  ResumableAsyncHandler();  ResumableAsyncHandler(AsyncHandler<Response> decoratedAsyncHandler);  ResumableAsyncHandler(long byteTransferred, AsyncHandler<Response> decoratedAsyncHandler);  ResumableAsyncHandler(ResumableProcessor resumableProcessor);  ResumableAsyncHandler(ResumableProcessor resumableProcessor, boolean accumulateBody); @Override State onStatusReceived(final HttpResponseStatus status); @Override void onThrowable(Throwable t); @Override State onBodyPartReceived(HttpResponseBodyPart bodyPart); @Override Response onCompleted(); @Override State onHeadersReceived(HttpHeaders headers); @Override State onTrailingHeadersReceived(HttpHeaders headers); Request adjustRequestRange(Request request); ResumableAsyncHandler setResumableListener(ResumableListener resumableListener);  }