org.apache.hc.client5.http.protocol

## 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 Object
      implements org.apache.hc.core5.http.HttpRequestInterceptor

  The `RequestIfRange` interceptor 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 and Description
    --- | ---
    `static RequestIfRange` | `INSTANCE` Default instance of `RequestIfRange`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RequestIfRange()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `process(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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### INSTANCE

          public static final RequestIfRange INSTANCE

      Default instance of `RequestIfRange`.
      Since:
        5.4

  - ### Constructor Detail

    - #### RequestIfRange

          public RequestIfRange()

  - ### 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,
                              IOException

      Processes the given request to ensure it adheres to the RFC guidelines for the 'If-Range' header.
      Specified by:
        `process` in interface `org.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.
        `IOException` - If an I/O error occurs.

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.