org.apache.http.impl.entity

## Class DisallowIdentityContentLengthStrategy

- java.lang.Object
- - org.apache.http.impl.entity.DisallowIdentityContentLengthStrategy

- All Implemented Interfaces:
    ContentLengthStrategy

      @Immutable
      public class DisallowIdentityContentLengthStrategy
      extends Object
      implements ContentLengthStrategy

  Decorator for `ContentLengthStrategy` implementations that disallows the use of identity transfer encoding.
  Since:
    4.2

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static DisallowIdentityContentLengthStrategy` | `INSTANCE`

    - ### Fields inherited from interface org.apache.http.entity.ContentLengthStrategy

      `CHUNKED, IDENTITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DisallowIdentityContentLengthStrategy(ContentLengthStrategy contentLengthStrategy)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `determineLength(HttpMessage message)` Returns length of the given message in bytes.

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

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

- - ### Field Detail

    - #### INSTANCE

          public static final DisallowIdentityContentLengthStrategy INSTANCE

  - ### Constructor Detail

    - #### DisallowIdentityContentLengthStrategy

          public DisallowIdentityContentLengthStrategy(ContentLengthStrategy contentLengthStrategy)

  - ### Method Detail

    - #### determineLength

          public long determineLength(HttpMessage message)
                               throws HttpException

      Description copied from interface: `ContentLengthStrategy`
      Returns length of the given message in bytes. The returned value must be a non-negative number, `ContentLengthStrategy.IDENTITY` if the end of the message will be delimited by the end of connection, or `ContentLengthStrategy.CHUNKED` if the message is chunk coded
      Specified by:
        `determineLength` in interface `ContentLengthStrategy`
      Parameters:
        `message` - HTTP message
      Returns:
        content length, `ContentLengthStrategy.IDENTITY`, or `ContentLengthStrategy.CHUNKED`
      Throws:
        `HttpException` - in case of HTTP protocol violation

Copyright © 2005–2013 The Apache Software Foundation. All rights reserved.