Interface BodyPartEntity

    • Method Detail

      • withContentType

        BodyPartEntity withContentType​(ContentType contentType)
        Description copied from interface: HttpEntity
        Creates a copy of this HttpEntity with the contentType overridden with the given one.
        Specified by:
        withContentType in interface HttpEntity
        Parameters:
        contentType - (undocumented)
        Returns:
        (undocumented)
      • withSizeLimit

        BodyPartEntity withSizeLimit​(long maxBytes)
        Description copied from interface: HttpEntity
        Apply the given size limit to this entity by returning a new entity instance which automatically verifies that the data stream encapsulated by this instance produces at most maxBytes data bytes. In case this verification fails the respective stream will be terminated with an EntityStreamException either directly at materialization time (if the Content-Length is known) or whenever more data bytes than allowed have been read.

        When called on Strict entities the method will return the entity itself if the length is within the bound, otherwise a Default entity with a single element data stream. This allows for potential refinement of the entity size limit at a later point (before materialization of the data stream).

        By default all message entities produced by the HTTP layer automatically carry the limit that is defined in the application's max-content-length config setting. If the entity is transformed in a way that changes the Content-Length and then another limit is applied then this new limit will be evaluated against the new Content-Length. If the entity is transformed in a way that changes the Content-Length and no new limit is applied then the previous limit will be applied against the previous Content-Length.

        Specified by:
        withSizeLimit in interface HttpEntity
        Specified by:
        withSizeLimit in interface HttpEntity
        Parameters:
        maxBytes - (undocumented)
        Returns:
        (undocumented)
      • withoutSizeLimit

        BodyPartEntity withoutSizeLimit()
        Description copied from interface: HttpEntity
        Lift the size limit from this entity by returning a new entity instance which skips the size verification.

        By default all message entities produced by the HTTP layer automatically carry the limit that is defined in the application's max-content-length config setting. It is recommended to always keep an upper limit on accepted entities to avoid potential attackers flooding you with too large requests/responses, so use this method with caution.

        See HttpEntity.withSizeLimit(long) for more details.

        Specified by:
        withoutSizeLimit in interface HttpEntity
        Specified by:
        withoutSizeLimit in interface HttpEntity
        Returns:
        (undocumented)