SOA Governance and API Management : Administering Mediator : Introduction : Mediator's GZIP Functionality : Mediator's Behavior in Various GZIP Scenarios
Mediator's Behavior in Various GZIP Scenarios
The table below shows Mediator's behavior under various client and service configuration scenarios. These scenarios assume that the native service responds without any error.
Accept-Encoding Header Setting in Request
Content-Encoding Header Setting in Response
Original Content by Native Service
Mediator Behavior
gzip
not set
not encoded
Dynamically zips the response with Content-Encoding header set to gzip.
gzip,deflate compress;q=0.5, gzip;q=1.0
not set
not encoded
Dynamically zips the response with Content-Encoding header set to gzip.
* (any)
not set (or any encoding other than gzip)
not set (or any encoding other than gzip)
Passes the response to client (does not zip or unzip), with Content-Encoding set to the original content-encoding from the native service.
* (any)
gzip
encoded
Passes the zipped response to the client, with Content-Encoding set to gzip.
gzip
gzip
encoded
Passes the zipped response to client, with Content-Encoding set to gzip.
NULL (no encoding)
gzip
encoded
Unzips the content and removes the header, with Content-Encoding set to NULL.
NULL (no encoding)
null
not encoded
Passes the unzipped native service response to the client, with Content-Encoding set to NULL.
Mediator Response When Native Services Return Incorrect Content Encoding
In the above scenarios the native service responds with correct content encoding and correct content. But if the native service fails to do that (for example, if it zips the response but does not set the Content-Encoding error, or vice-versa), an Exception is thrown to the client and the error is logged. Such scenarios are shown in the table below.
Accept-Encoding Header Setting in Request
Content-Encoding Header Setting in Response
Original Content by Native Service
Mediator Response
gzip
not set
encoded
Throws Exception and logs error.
gzip
gzip
not encoded
Throws Exception and logs error.
gzip,deflate compress;q=0.5, gzip;q=1.0
gzip
not encoded
Throws Axis2 Exception and logs error.
* (any)
gzip
not encoded
Throws Axis2 Exception and logs error.
NULL
gzip
not encoded
Throws Axis2 Exception and logs error.
Response To Policy Violations
If Mediator rejects the request due to a policy violation, then only a plain response would reach the client, regardless of the Accept-Encoding.
Accept-Encoding Header Setting in Request
Content-Encoding Header Setting in Response
Original Content in Native Service
Mediator Response
gzip or gzip,deflate compress;q=0.5, gzip;q=1.0
any
any
1. Mediator rejects the request from the client and not the response from the native service. In this case, the request will not go to the native service.
2. Mediator sends an uncompressed response to the client.
Response When Native Services Return SOAP Faults
If the native service returns a SOAP fault, then Mediator will compress or decompress the response, based on the Accept-Encoding headers.
Accept-Encoding Header Setting in Request
Content-Encoding Header Setting in Response
Original Content in Native Service
Mediator Response
gzip or gzip,deflate compress;q=0.5, gzip;q=1.0
any
any
1. Mediator passes the request to the native service.
2. The server returns a SOAP fault.
3. Mediator compresses or uncompresses depending on the Accept-Encoding.
Behavior with Zipped Requests
Mediator also has the ability to process "gzipped" requests sent by the client:
*When the client sets the Content-Encoding:gzip and sends a zipped request to Mediator, then Mediator sends the zipped request to the native service with the Content-Encoding header unchanged.
*If the client sends to Mediator any Content-Encoding other then GZIP, then the header is removed and an uncompressed plain request is sent to the native service.
Copyright © 2015- 2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback