@Override public List<Range> getRanges() { return wrappedRequest.getRanges(); }
/** * Sets the modifiable list of ranges to return from the target resource's * representation. Note that when used with HTTP connectors, this property * maps to the "Range" header. This method clears the current list and adds * all entries in the parameter list. * * @param ranges * A list of ranges. */ public void setRanges(List<Range> ranges) { synchronized (getRanges()) { if (ranges != getRanges()) { getRanges().clear(); if (ranges != null) { getRanges().addAll(ranges); } } } }
/** * Returns the ranges to return from the target resource's representation. * * @return The ranges to return. * @see Request#getRanges() */ public List<Range> getRanges() { return getRequest() == null ? null : getRequest().getRanges(); }
@Override public List<Range> getRanges() { final List<Range> result = super.getRanges(); if (!this.rangesAdded) { // Extract the header value final String ranges = getHttpCall().getRequestHeaders().getValues( HeaderConstants.HEADER_RANGE); result.addAll(RangeReader.read(ranges)); this.rangesAdded = true; } return result; }
@Override public Representation put(Representation entity) throws ResourceException { if (!this.directory.isModifiable()) { setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED, "The directory is not modifiable."); return null; } // Transfer of PUT calls is only allowed if the readOnly flag is not set. Request contextRequest = new Request(Method.PUT, this.targetUri); // Add support of partial PUT calls. contextRequest.getRanges().addAll(getRanges()); contextRequest.setEntity(entity); Response contextResponse = new Response(contextRequest); contextRequest.setResourceRef(this.targetUri); getClientDispatcher().handle(contextRequest, contextResponse); setStatus(contextResponse.getStatus()); return null; }
if (request.getRanges().size() == 1 && (!request.getConditions().hasSomeRange() || request.getConditions().getRangeStatus(response.getEntity()).isSuccess())) { Range requestedRange = request.getRanges().get(0); response.setStatus(Status.SUCCESS_PARTIAL_CONTENT); } else if (request.getRanges().size() > 1) {