Class RequestSizeLimits

java.lang.Object
org.apache.axis2.builder.RequestSizeLimits

public final class RequestSizeLimits extends Object
Size ceilings applied by the message builders that read a request body directly from the transport stream.

Those builders consume the raw InputStream rather than the servlet parameter API, so a container-level post limit (Tomcat's maxPostSize, for example) never sees the body and does not constrain it. Without a ceiling here an anonymous client can size the allocation itself.

Each limit resolves through the usual Axis2 parameter chain — message, operation, service, service group, then axis2.xml — so a deployment that legitimately accepts large uploads can raise it for one service without loosening the global default. A value of -1 restores the unbounded behaviour.

  • Field Details

    • MULTIPART_MAX_REQUEST_SIZE

      public static final String MULTIPART_MAX_REQUEST_SIZE
      Ceiling on a whole multipart/form-data request.
      See Also:
    • MULTIPART_MAX_FILE_SIZE

      public static final String MULTIPART_MAX_FILE_SIZE
      Ceiling on any single part within a multipart/form-data request.
      See Also:
    • FORM_URLENCODED_MAX_REQUEST_SIZE

      public static final String FORM_URLENCODED_MAX_REQUEST_SIZE
      Ceiling on an application/x-www-form-urlencoded request body.
      See Also:
    • DEFAULT_MULTIPART_MAX_REQUEST_SIZE

      public static final long DEFAULT_MULTIPART_MAX_REQUEST_SIZE
      100 MB: generous for document and attachment uploads, but finite.
      See Also:
    • DEFAULT_MULTIPART_MAX_FILE_SIZE

      public static final long DEFAULT_MULTIPART_MAX_FILE_SIZE
      100 MB, matching the whole-request ceiling for the single-part case.
      See Also:
    • DEFAULT_FORM_URLENCODED_MAX_REQUEST_SIZE

      public static final long DEFAULT_FORM_URLENCODED_MAX_REQUEST_SIZE
      2 MB: form encoding is for field data, not bulk transfer.
      See Also:
    • MTOM_MAX_REQUEST_SIZE

      public static final String MTOM_MAX_REQUEST_SIZE
      Ceiling on a multipart/related body: MTOM and SwA.

      The same reasoning as the form builders, which is why this belongs here: the MIME builder reads the transport stream directly, so a servlet container's post-size limit never sees the body. It also means the caller picks which builder runs by choosing the Content-Type, so bounding only the form builders bounds nothing -- an attacker simply sends multipart/related.

      See Also:
    • SOAP_MAX_REQUEST_SIZE

      public static final String SOAP_MAX_REQUEST_SIZE
      Ceiling on a plain SOAP or POX body.
      See Also:
    • DEFAULT_MTOM_MAX_REQUEST_SIZE

      public static final long DEFAULT_MTOM_MAX_REQUEST_SIZE
      Default MTOM_MAX_REQUEST_SIZE: 100 MB.
      See Also:
    • DEFAULT_SOAP_MAX_REQUEST_SIZE

      public static final long DEFAULT_SOAP_MAX_REQUEST_SIZE
      Default SOAP_MAX_REQUEST_SIZE: 100 MB.
      See Also:
    • JSON_MAX_REQUEST_SIZE

      public static final String JSON_MAX_REQUEST_SIZE
      Ceiling on a JSON body, for every builder in the axis2-json module.

      JSON is the primary protocol, so this is the ceiling most deployments actually rely on. Streaming does not make a JSON builder safe to leave unbounded: a single string token is still materialised whole.

      See Also:
    • DEFAULT_JSON_MAX_REQUEST_SIZE

      public static final long DEFAULT_JSON_MAX_REQUEST_SIZE
      Default JSON_MAX_REQUEST_SIZE: 100 MB, matching SOAP. The HTTP/2 JSON builders are tuned for payloads of 50 MB and more, so a smaller default would break the deployments they were written for.
      See Also:
    • UNLIMITED

      public static final long UNLIMITED
      Sentinel for "no ceiling", matching the commons-fileupload2 convention.
      See Also:
  • Method Details

    • resolve

      public static long resolve(MessageContext messageContext, String parameterName, long defaultValue)
      Resolve a size limit for the message being built.
      Parameters:
      messageContext - the message being built; null yields the default
      parameterName - one of the parameter name constants on this class
      defaultValue - the limit to apply when the parameter is not set
      Returns:
      the configured limit in bytes, or UNLIMITED