Encoding Negotiation - AFS

AFS Integration Guide

Reference Guide

AFS v7 replies can either be sent as-is by the reply web server (that is in plain text) or they can be compressed on the fly.

The compression can tremendously reduce the download times for XML or HTML reply feeds. This improves the user experience or speed up exchanges between AFS v7 and the front end servers of the portal.

The afs:encoding query parameter is used for encoding negotiation.

For more information, see afs:encoding.

Encoding negotiation requires the two following assertions to be true:

  • afs:encoding is set to gzip, or is not part of the query (gzip is the default value for this parameter).
  • HTTP Header contains a HTTP_ACCEPT_ENCODING line containing gzip

When none or only one of these properties is met, encoding negotiation fails and the contents are send as-is by the web server.

Web browsers always insert a valid HTTP_ACCEPT_ENCODING line in their requests and perform on-the-fly decompression of the result feed. In a browser, an AFS v7 reply feed looks exactly the same regardless of the value of afs:encoding — only that the version with afs:encoding is usually obtained faster.

When a web service calls AFS, to use encoding, it must insert the HTTP_ACCEPT_ENCODING request line and it must take care of the decompression.