To read the HTTP request header if-modified-since, the application developer can use method /IWBEP/CL_MGW_REQUEST=>GET_IF_MODIFIED_SINCE().
DATA lv_if_modified_since TYPE tzntstmps. lv_if_modified_since = io_tech_request_context->get_if_modified_since( ).
If export parameter ES_RESPONSE_CONTEXT-MAX_AGE is set to a value, then SAP Gateway will generate the HTTP response header cache-control with a max-age directive.
cache-control: max-age=3600
Note that if export parameter ES_RESPONSE_CONTEXT-MAX_AGE is set to a value, you must also set the export parameter ES_RESPONSE_CONTEXT-DO_NOT_CACHE_ON_CLIENT to ‘-’ (meaning ‘can be cached’).
Default behavior: If export parameter ES_RESPONSE_CONTEXT-DO_NOT_CACHE_ON_CLIENT is left as undefined (that is, set to ‘ ‘) then the system automatically sets the default of ES_RESPONSE_CONTEXT-DO_NOT_CACHE_ON_CLIENT to the value ‘X’ and SAP Gateway will generate the following HTTP response header:
cache-control: no-store, no-cache
If export parameter ES_RESPONSE_CONTEXT-DO_NOT_CACHE_ON_CLIENT is set to 'X', then SAP Gateway will generate the following HTTP response header.
cache-control: no-store, no-cache
To enable caching the export parameter ES_RESPONSE_CONTEXT-DO_NOT_CACHE_ON_CLIENT must be set to ‘-’ and export parameter ES_RESPONSE_CONTEXT-MAX_AGE must be set to a value.
The export parameter ES_RESPONSE_CONTEXT-LAST_MODIFIED should be filled with a time stamp that indicates when the last change of the related business data occurred. If the ES_RESPONSE_CONTEXT-LAST_MODIFIED is filled with a time stamp, then SAP Gateway will generate the HTTP response header last-modified with the related date.
last-modified: Tue, 27 Nov 2012 09:41:40 GMT
Additionally, if the export parameter ES_RESPONSE_CONTEXT-LAST_MODIFIED contains a time stamp that is older than the HTTP request header if-modified-since, then an HTTP 304 response (‘not modified’) will be sent by SAP Gateway. In this case, an HTTP response header last-modified will not be sent.
The export parameter ES_RESPONSE_CONTEXT-IS_NOT_MODIFIED may be set to ABAP_TRUE only in case LAST_MODIFIED of the application data is older than the time stamp in HTTP request header if-modified-since. In such cases, the related application data is up-to-date and does not need to be sent at all. SAP Gateway will then generate an HTTP 304 response (‘not modified’).
It is also possible to use method /IWBEP/IF_MGW_CONV_SRV_RUNTIME~CHECK_IF_IS_NOT_MODIFIED( ) to calculate the value for export parameter ES_RESPONSE_CONTEXT-IS_NOT_MODIFIED.
DATA lv_if_modified_since TYPE tzntstmps. lv_if_modified_since = io_tech_request_context->get_if_modified_since( ). es_response_context-is_not_modified = /iwbep/if_mgw_conv_srv_runtime~check_if_is_not_modified( iv_if_modified_since = lv_if_modified_since iv_last_modified = es_response_context-last_modified ).
Additionally, if the export parameter ES_RESPONSE_CONTEXT-LAST_MODIFIED contains a time stamp that is older than the HTTP request header if-modified-since, then an HTTP 304 response (‘not modified’) will be sent by SAP Gateway. In this case, an HTTP response header last-modified will not be sent.