docs: protected T encodeFinalResponse(final HttpServletRequest request,
                                      final HttpServletResponse response,
                                      final SamlRegisteredService service,
                                      final SamlRegisteredServiceServiceProviderMetadataFacade adaptor,
                                      final T finalResponse,
                                      final String binding,
                                      final RequestAbstractType authnRequest,
                                      final Object assertion,
                                      final MessageContext messageContext) {
  
          val scratch = messageContext.getSubcontext(ScratchContext.class, true);
          val encodeResponse = (Boolean) scratch.getMap().getOrDefault(SamlProtocolConstants.PARAMETER_ENCODE_RESPONSE, Boolean.TRUE);
  
          if (encodeResponse) {
              val relayState = request != null ? request.getParameter(SamlProtocolConstants.PARAMETER_SAML_RELAY_STATE) : StringUtils.EMPTY;
              LOGGER.trace("RelayState is [{}]", relayState);
              return encode(service, finalResponse, response, request, adaptor, relayState, binding, authnRequest, assertion);
          }
          return finalResponse;
      }