Show TOC

Configuring Headers That Affect Dynamic Response CompressionLocate this document in the navigation structure

Use

The Web Container Service provides an option for configuring two HTTP headers that determine (when they are present in the header part of the message) if the response generated by your servlet or JSP is compressed with the gzip mechanism. The use of these headers overrides the general compression rules that you have configured in the HTTP Provider Service.

More information about the rules for compressing HTTP messages that you can configure: Configuring Rules for HTTP Responses Compression .

The headers that prevent or force the compression of servlet and JSP responses are never really sent to the client; rather, they facilitate the inbound communication between the Web Container Service and the HTTP Provider Service. It is the responsibility of the HTTP Provider Service to remove the headers before it sends the response back to the client.

By default, the header that forces response compression is sap-enable-compress .

You configure the headers with the following properties of the Web Container Service:

  • HeaderForNoCompression

    This header prevents dynamic responses from being compressed, even if they should be according to the compression rules you have set in the HTTP Provider Service.

    Example

    By default, the header that prevents response compression has the name No-Compress . If you set this header to the response in your servlet or JSP using the response.setHeader (" No-Compress ", " true "); statement before committing the response or writing to the output stream, then this response is not compressed.

  • HeaderForCompression

    This header always forces the compression of dynamic responses (regardless of the compression rules in the HTTP Provider Service). The use of this header name in the code of your servlet or JSP is analogous to the one presented in the example above.

Procedure

You can use SAP NetWeaver Administrator only to configure the names of the headers that affect the compression of dynamic servlet or JSP responses. Proceed as follows:

  1. To modify the properties of the Web Container Service using SAP NetWeaver Administrator, use the Java System Properties function. For more information, see Java System Properties .

  2. In Start of the navigation path Java System Properties Next navigation step Services End of the navigation path, select Web Container Service.

    On the Extended Details tab page, a list of all service properties is displayed.

  3. Enter the names of the headers as values of the HeaderForNoCompression and HeaderForCompression properties.

  4. Choose Save .

    Caution

    We do not recommend you to change the default value of this property as it affects all applications deployed on AS Java. The feature itself, however, is strongly recommended to be used by applications that need to refine response compression settings.

    Note

    You need adapting the application for the feature to take effect. That is, the application implements login to add these headers where appropriate.