Skip to content

/AWS1/CL_FNT=>UPDATERESPONSEHEADERSPOLICY()

About UpdateResponseHeadersPolicy

Updates a response headers policy.

When you update a response headers policy, the entire policy is replaced. You cannot update some policy fields independent of others. To update a response headers policy configuration:

  1. Use GetResponseHeadersPolicyConfig to get the current policy's configuration.

  2. Modify the fields in the response headers policy configuration that you want to update.

  3. Call UpdateResponseHeadersPolicy, providing the entire response headers policy configuration, including the fields that you modified and those that you didn't.

Method Signature

IMPORTING

Required arguments:

io_rspheaderspolicyconfig TYPE REF TO /AWS1/CL_FNTRSPHEADERSPLYCFG /AWS1/CL_FNTRSPHEADERSPLYCFG

A response headers policy configuration.

iv_id TYPE /AWS1/FNTSTRING /AWS1/FNTSTRING

The identifier for the response headers policy that you are updating.

Optional arguments:

iv_ifmatch TYPE /AWS1/FNTSTRING /AWS1/FNTSTRING

The version of the response headers policy that you are updating.

The version is returned in the cache policy's ETag field in the response to GetResponseHeadersPolicyConfig.

RETURNING

oo_output TYPE REF TO /aws1/cl_fntuprspheadersplyrs /AWS1/CL_FNTUPRSPHEADERSPLYRS

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_fnt~updateresponseheaderspolicy(
  io_rspheaderspolicyconfig = new /aws1/cl_fntrspheadersplycfg(
    io_corsconfig = new /aws1/cl_fntrspheadersplycor00(
      io_accesscontrolallowheaders = new /aws1/cl_fntrspheadersplyacc01(
        it_items = VALUE /aws1/cl_fntaccctlalwheaders00=>tt_accessctlallowheaderslist(
          ( new /aws1/cl_fntaccctlalwheaders00( |string| ) )
        )
        iv_quantity = 123
      )
      io_accesscontrolallowmethods = new /aws1/cl_fntrspheadersplyacc02(
        it_items = VALUE /aws1/cl_fntaccctlalwmthslst_w=>tt_accessctlallowmethodslist(
          ( new /aws1/cl_fntaccctlalwmthslst_w( |string| ) )
        )
        iv_quantity = 123
      )
      io_accesscontrolalloworigins = new /aws1/cl_fntrspheadersplyacc00(
        it_items = VALUE /aws1/cl_fntaccctlalworigins00=>tt_accessctlalloworiginslist(
          ( new /aws1/cl_fntaccctlalworigins00( |string| ) )
        )
        iv_quantity = 123
      )
      io_accessctlexposeheaders = new /aws1/cl_fntrspheadersplyacc03(
        it_items = VALUE /aws1/cl_fntaccctlexposehead00=>tt_accessctlexposeheaderslist(
          ( new /aws1/cl_fntaccctlexposehead00( |string| ) )
        )
        iv_quantity = 123
      )
      iv_accesscontrolallowcreds = ABAP_TRUE
      iv_accesscontrolmaxagesec = 123
      iv_originoverride = ABAP_TRUE
    )
    io_customheadersconfig = new /aws1/cl_fntrspheadersplycus00(
      it_items = VALUE /aws1/cl_fntrspheadersplycus01=>tt_rspheadersplycustheaderlist(
        (
          new /aws1/cl_fntrspheadersplycus01(
            iv_header = |string|
            iv_override = ABAP_TRUE
            iv_value = |string|
          )
        )
      )
      iv_quantity = 123
    )
    io_removeheadersconfig = new /aws1/cl_fntrspheadersplyrem00(
      it_items = VALUE /aws1/cl_fntrspheadersplyrem01=>tt_rspheadersplyremheaderlist(
        ( new /aws1/cl_fntrspheadersplyrem01( |string| ) )
      )
      iv_quantity = 123
    )
    io_securityheadersconfig = new /aws1/cl_fntrspheadersplysec00(
      io_contentsecuritypolicy = new /aws1/cl_fntrspheadersplycon00(
        iv_contentsecuritypolicy = |string|
        iv_override = ABAP_TRUE
      )
      io_contenttypeoptions = new /aws1/cl_fntrspheadersplycon01( ABAP_TRUE )
      io_frameoptions = new /aws1/cl_fntrspheadersplyfra00(
        iv_frameoption = |string|
        iv_override = ABAP_TRUE
      )
      io_referrerpolicy = new /aws1/cl_fntrspheadersplyref00(
        iv_override = ABAP_TRUE
        iv_referrerpolicy = |string|
      )
      io_stricttransportsecurity = new /aws1/cl_fntrspheadersplystr00(
        iv_accesscontrolmaxagesec = 123
        iv_includesubdomains = ABAP_TRUE
        iv_override = ABAP_TRUE
        iv_preload = ABAP_TRUE
      )
      io_xssprotection = new /aws1/cl_fntrspheadersplyxss00(
        iv_modeblock = ABAP_TRUE
        iv_override = ABAP_TRUE
        iv_protection = ABAP_TRUE
        iv_reporturi = |string|
      )
    )
    io_servertimingheadersconfig = new /aws1/cl_fntrspheadersplyser00(
      iv_enabled = ABAP_TRUE
      iv_samplingrate = '0.1'
    )
    iv_comment = |string|
    iv_name = |string|
  )
  iv_id = |string|
  iv_ifmatch = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lo_responseheaderspolicy = lo_result->get_responseheaderspolicy( ).
  IF lo_responseheaderspolicy IS NOT INITIAL.
    lv_string = lo_responseheaderspolicy->get_id( ).
    lv_timestamp = lo_responseheaderspolicy->get_lastmodifiedtime( ).
    lo_responseheaderspolicyco = lo_responseheaderspolicy->get_rspheaderspolicyconfig( ).
    IF lo_responseheaderspolicyco IS NOT INITIAL.
      lv_string = lo_responseheaderspolicyco->get_comment( ).
      lv_string = lo_responseheaderspolicyco->get_name( ).
      lo_responseheaderspolicyco_1 = lo_responseheaderspolicyco->get_corsconfig( ).
      IF lo_responseheaderspolicyco_1 IS NOT INITIAL.
        lo_responseheaderspolicyac = lo_responseheaderspolicyco_1->get_accessctlalloworigins( ).
        IF lo_responseheaderspolicyac IS NOT INITIAL.
          lv_integer = lo_responseheaderspolicyac->get_quantity( ).
          LOOP AT lo_responseheaderspolicyac->get_items( ) into lo_row.
            lo_row_1 = lo_row.
            IF lo_row_1 IS NOT INITIAL.
              lv_string = lo_row_1->get_value( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
        lo_responseheaderspolicyac_1 = lo_responseheaderspolicyco_1->get_accessctlallowheaders( ).
        IF lo_responseheaderspolicyac_1 IS NOT INITIAL.
          lv_integer = lo_responseheaderspolicyac_1->get_quantity( ).
          LOOP AT lo_responseheaderspolicyac_1->get_items( ) into lo_row_2.
            lo_row_3 = lo_row_2.
            IF lo_row_3 IS NOT INITIAL.
              lv_string = lo_row_3->get_value( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
        lo_responseheaderspolicyac_2 = lo_responseheaderspolicyco_1->get_accessctlallowmethods( ).
        IF lo_responseheaderspolicyac_2 IS NOT INITIAL.
          lv_integer = lo_responseheaderspolicyac_2->get_quantity( ).
          LOOP AT lo_responseheaderspolicyac_2->get_items( ) into lo_row_4.
            lo_row_5 = lo_row_4.
            IF lo_row_5 IS NOT INITIAL.
              lv_responseheaderspolicyac_3 = lo_row_5->get_value( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
        lv_boolean = lo_responseheaderspolicyco_1->get_accesscontrolallowcreds( ).
        lo_responseheaderspolicyac_4 = lo_responseheaderspolicyco_1->get_accessctlexposeheaders( ).
        IF lo_responseheaderspolicyac_4 IS NOT INITIAL.
          lv_integer = lo_responseheaderspolicyac_4->get_quantity( ).
          LOOP AT lo_responseheaderspolicyac_4->get_items( ) into lo_row_6.
            lo_row_7 = lo_row_6.
            IF lo_row_7 IS NOT INITIAL.
              lv_string = lo_row_7->get_value( ).
            ENDIF.
          ENDLOOP.
        ENDIF.
        lv_integer = lo_responseheaderspolicyco_1->get_accesscontrolmaxagesec( ).
        lv_boolean = lo_responseheaderspolicyco_1->get_originoverride( ).
      ENDIF.
      lo_responseheaderspolicyse = lo_responseheaderspolicyco->get_securityheadersconfig( ).
      IF lo_responseheaderspolicyse IS NOT INITIAL.
        lo_responseheaderspolicyxs = lo_responseheaderspolicyse->get_xssprotection( ).
        IF lo_responseheaderspolicyxs IS NOT INITIAL.
          lv_boolean = lo_responseheaderspolicyxs->get_override( ).
          lv_boolean = lo_responseheaderspolicyxs->get_protection( ).
          lv_boolean = lo_responseheaderspolicyxs->get_modeblock( ).
          lv_string = lo_responseheaderspolicyxs->get_reporturi( ).
        ENDIF.
        lo_responseheaderspolicyfr = lo_responseheaderspolicyse->get_frameoptions( ).
        IF lo_responseheaderspolicyfr IS NOT INITIAL.
          lv_boolean = lo_responseheaderspolicyfr->get_override( ).
          lv_frameoptionslist = lo_responseheaderspolicyfr->get_frameoption( ).
        ENDIF.
        lo_responseheaderspolicyre = lo_responseheaderspolicyse->get_referrerpolicy( ).
        IF lo_responseheaderspolicyre IS NOT INITIAL.
          lv_boolean = lo_responseheaderspolicyre->get_override( ).
          lv_referrerpolicylist = lo_responseheaderspolicyre->get_referrerpolicy( ).
        ENDIF.
        lo_responseheaderspolicyco_2 = lo_responseheaderspolicyse->get_contentsecuritypolicy( ).
        IF lo_responseheaderspolicyco_2 IS NOT INITIAL.
          lv_boolean = lo_responseheaderspolicyco_2->get_override( ).
          lv_string = lo_responseheaderspolicyco_2->get_contentsecuritypolicy( ).
        ENDIF.
        lo_responseheaderspolicyco_3 = lo_responseheaderspolicyse->get_contenttypeoptions( ).
        IF lo_responseheaderspolicyco_3 IS NOT INITIAL.
          lv_boolean = lo_responseheaderspolicyco_3->get_override( ).
        ENDIF.
        lo_responseheaderspolicyst = lo_responseheaderspolicyse->get_stricttransportsecurity( ).
        IF lo_responseheaderspolicyst IS NOT INITIAL.
          lv_boolean = lo_responseheaderspolicyst->get_override( ).
          lv_boolean = lo_responseheaderspolicyst->get_includesubdomains( ).
          lv_boolean = lo_responseheaderspolicyst->get_preload( ).
          lv_integer = lo_responseheaderspolicyst->get_accesscontrolmaxagesec( ).
        ENDIF.
      ENDIF.
      lo_responseheaderspolicyse_1 = lo_responseheaderspolicyco->get_servertimingheaderscfg( ).
      IF lo_responseheaderspolicyse_1 IS NOT INITIAL.
        lv_boolean = lo_responseheaderspolicyse_1->get_enabled( ).
        lv_samplingrate = lo_responseheaderspolicyse_1->get_samplingrate( ).
      ENDIF.
      lo_responseheaderspolicycu = lo_responseheaderspolicyco->get_customheadersconfig( ).
      IF lo_responseheaderspolicycu IS NOT INITIAL.
        lv_integer = lo_responseheaderspolicycu->get_quantity( ).
        LOOP AT lo_responseheaderspolicycu->get_items( ) into lo_row_8.
          lo_row_9 = lo_row_8.
          IF lo_row_9 IS NOT INITIAL.
            lv_string = lo_row_9->get_header( ).
            lv_string = lo_row_9->get_value( ).
            lv_boolean = lo_row_9->get_override( ).
          ENDIF.
        ENDLOOP.
      ENDIF.
      lo_responseheaderspolicyre_1 = lo_responseheaderspolicyco->get_removeheadersconfig( ).
      IF lo_responseheaderspolicyre_1 IS NOT INITIAL.
        lv_integer = lo_responseheaderspolicyre_1->get_quantity( ).
        LOOP AT lo_responseheaderspolicyre_1->get_items( ) into lo_row_10.
          lo_row_11 = lo_row_10.
          IF lo_row_11 IS NOT INITIAL.
            lv_string = lo_row_11->get_header( ).
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDIF.
  ENDIF.
  lv_string = lo_result->get_etag( ).
ENDIF.