Class RequestIfRange
- java.lang.Object
-
- org.apache.hc.client5.http.protocol.RequestIfRange
-
- All Implemented Interfaces:
org.apache.hc.core5.http.HttpRequestInterceptor
@Contract(threading=IMMUTABLE) public class RequestIfRange extends java.lang.Object implements org.apache.hc.core5.http.HttpRequestInterceptorThe
RequestIfRangeinterceptor ensures that the request adheres to the RFC guidelines for the 'If-Range' header. The "If-Range" header field is used in conjunction with the Range header to conditionally request parts of a representation. If the validator given in the "If-Range" header matches the current validator for the representation, then the server should respond with the specified range of the document. If they do not match, the server should return the entire representation.Key points:
- A client MUST NOT generate an If-Range header field in a request that does not contain a Range header field.
- An origin server MUST ignore an If-Range header field received in a request for a target resource that does not support Range requests.
- A client MUST NOT generate an If-Range header field containing an entity tag that is marked as weak.
- A client MUST NOT generate an If-Range header field containing an HTTP-date unless the client has no entity tag for the corresponding representation and the date is a strong validator.
- A server that receives an If-Range header field on a Range request MUST evaluate the condition before performing the method.
- Since:
- 5.4
-
-
Field Summary
Fields Modifier and Type Field Description static RequestIfRangeINSTANCEDefault instance ofRequestIfRange.
-
Constructor Summary
Constructors Constructor Description RequestIfRange()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidprocess(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.EntityDetails entity, org.apache.hc.core5.http.protocol.HttpContext context)Processes the given request to ensure it adheres to the RFC guidelines for the 'If-Range' header.
-
-
-
Field Detail
-
INSTANCE
public static final RequestIfRange INSTANCE
Default instance ofRequestIfRange.- Since:
- 5.4
-
-
Method Detail
-
process
public void process(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.EntityDetails entity, org.apache.hc.core5.http.protocol.HttpContext context) throws org.apache.hc.core5.http.HttpException, java.io.IOExceptionProcesses the given request to ensure it adheres to the RFC guidelines for the 'If-Range' header.- Specified by:
processin interfaceorg.apache.hc.core5.http.HttpRequestInterceptor- Parameters:
request- The HTTP request to be processed.entity- The entity details of the request.context- The HTTP context.- Throws:
org.apache.hc.core5.http.HttpException- If the request does not adhere to the RFC guidelines.java.io.IOException- If an I/O error occurs.
-
-