Sets the response header based on the retrieved token.

@param context the context
184188
private void setResponseHeader(final RequestContext context) {
        val credential = WebUtils.getCredential(context);

        if (credential == null) {
            LOGGER.debug("No credential was provided. No response header set.");
            return;
        }

        val response = WebUtils.getHttpServletResponseFromExternalWebflowContext(context);
        val spnegoCredentials = (SpnegoCredential) credential;
        val nextToken = spnegoCredentials.getNextToken();
        if (nextToken != null) {
            LOGGER.debug("Obtained output token: [{}]", new String(nextToken, Charset.defaultCharset()));
            response.setHeader(SpnegoConstants.HEADER_AUTHENTICATE, (this.ntlm
                ? SpnegoConstants.NTLM : SpnegoConstants.NEGOTIATE)
                + ' ' + EncodingUtils.encodeBase64(nextToken));
        } else {
            LOGGER.debug("Unable to obtain the output token required.");
        }

        if (spnegoCredentials.getPrincipal() == null && this.send401OnAuthenticationFailure) {
            LOGGER.debug("Setting HTTP Status to 401");
            response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
        }
    }
1155456
public void setRequestHeader(String header, String value) {
        LOG.entering(CLASS_NAME, "setRequestHeader", new Object[] {header, value});
        HttpRequestUtil.validateHeader(header);
        connection.addRequestProperty(header, value);
    }
1054372
public void setCustomHeader(String[] header) {
        if (header == null) {
            throw new IllegalArgumentException("Custom header can't be null.");
        }
        customHeader = new CustomHeaderLine[header.length];
        for (int i = 0; i < header.length; i++) {
            customHeader[i] = new CustomHeaderLine(header[i]);
        }
    }
207727
private void setCorsHeader(HttpServletRequest pReq, HttpServletResponse pResp) {
        String origin = requestHandler.extractCorsOrigin(pReq.getHeader("Origin"));
        if (origin != null) {
            pResp.setHeader("Access-Control-Allow-Origin", origin);
            pResp.setHeader("Access-Control-Allow-Credentials","true");
        }
    }
486703
@Override
    public void setIntHeader(String hdr, int value) {
        if (-1 == value) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "setIntHeader(" + hdr + ", -1), removing header");
            }
            this.response.removeHeader(hdr);
        } else {
            this.response.setHeader(hdr, Integer.toString(value));
        }
    }
387694
public HttpSessionTokensSet getHttpSessionTokensSetForContext(Context context){
		//TODO: Proper implementation. Hack for now
		for (Entry<String, HttpSessionTokensSet> e : this.sessionTokens.entrySet()) {
			String siteName = e.getKey();
			siteName = "http://" + siteName;
			if (context.isInContext(siteName))
				return e.getValue();
		}
		return null;
	}
900283
public void initialize(HttpContext context)
    {
        if (_context==null)
            _context=context;
        else if (_context!=context)
            throw new IllegalStateException("Can't initialize handler for different context");
    }
1018090
@Override
  public void header(String key, String value)
  {
    _is.header(key, value);
  }
1196655
public void setResponse(Object response)
    {
        ExternalContext ctx = _MyFacesExternalContextHelper.firstInstance.get();
        
        if (ctx == null)
        {
            throw new UnsupportedOperationException();
        }
        
        ctx.setResponse(response);
    }
1139695
function _setResponseHeaders(headers) {
            this.responseHeaders = {};

            for (var header in headers) {
                if (headers.hasOwnProperty(header)) {
                    this.responseHeaders[header] = headers[header];
                }
            }

            if (this.async) {
                this._readyStateChange(IsotropyXMLHttpRequest.HEADERS_RECEIVED);
            } else {
                this.readyState = IsotropyXMLHttpRequest.HEADERS_RECEIVED;
            }
        }
960403
public static void addAuthorizationHeader(URLConnection urlConnection, String header) {
        if (header != null) {
            urlConnection.setRequestProperty(AUTHORIZATION_HEADER, header);
        }
    }
499220
def token_endpoint(self, context):
        
        headers = {"Authorization": context.request_authorization}
        try:
            response = self.provider.handle_token_request(urlencode(context.request), headers)
            return Response(response.to_json(), content="application/json")
        except InvalidClientAuthentication as e:
            logger.debug('invalid client authentication at token endpoint', exc_info=True)
            error_resp = TokenErrorResponse(error='invalid_client', error_description=str(e))
            response = Unauthorized(error_resp.to_json(), headers=[("WWW-Authenticate", "Basic")],
                                    content="application/json")
            return response
        except OAuthError as e:
            logger.debug('invalid request: %s', str(e), exc_info=True)
            error_resp = TokenErrorResponse(error=e.oauth_error, error_description=str(e))
            return BadRequest(error_resp.to_json(), content="application/json")
757934
function _setResponseHeaders(headers) {
    this.responseHeaders = {};

    for (var header in headers) {
      if (headers.hasOwnProperty(header)) {
          this.responseHeaders[header] = headers[header];
      }
    }

    if (this.forceMimeType) {
      this.responseHeaders['Content-Type'] = this.forceMimeType;
    }

    if (this.async) {
      this._readyStateChange(FakeXMLHttpRequest.HEADERS_RECEIVED);
    } else {
      this.readyState = FakeXMLHttpRequest.HEADERS_RECEIVED;
    }
  }
254111
@SuppressWarnings("unchecked")
	public void setAccessToken(String token) {
		if (!StringUtils.isBlank(token)) {
			try {
				String payload = Utils.base64dec(StringUtils.substringBetween(token, ".", "."));
				Map<String, Object> decoded = ParaObjectUtils.getJsonMapper().readValue(payload, Map.class);
				if (decoded != null && decoded.containsKey("exp")) {
					this.tokenKeyExpires = (Long) decoded.get("exp");
					this.tokenKeyNextRefresh = (Long) decoded.get("refresh");
				}
			} catch (Exception ex) {
				this.tokenKeyExpires = null;
				this.tokenKeyNextRefresh = null;
			}
		}
		this.tokenKey = token;
	}
924961
private <T> void renderSoapHeader(final Marshallable<T> marshallable, final Map<String, String> context, T xmlContext) {
		try {
			final Marshaller marshaller = jaxbContext.createMarshaller();
			marshallable.marshal(marshaller, TpicMap.wrap(context), xmlContext);
		} catch (JAXBException e) {
			logger.warn("Unable to render TPIC header: {}", e.getMessage());
			logger.debug("WithStack: Unable to render TPIC header: {}", e.getMessage(), e);
		}
	}
891812
@Override
    public void setContext(DisplayContext context) {
        super.setContext(context);
        if (!capitalizationInfoIsSet &&
              (context==DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU || context==DisplayContext.CAPITALIZATION_FOR_STANDALONE)) {
            initCapitalizationContextInfo(fLocale);
            capitalizationInfoIsSet = true;
        }
        if (capitalizationBrkIter == null && (context==DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
              (context==DisplayContext.CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationOfRelativeUnitsForListOrMenu) ||
              (context==DisplayContext.CAPITALIZATION_FOR_STANDALONE && capitalizationOfRelativeUnitsForStandAlone) )) {
            capitalizationBrkIter = BreakIterator.getSentenceInstance(fLocale);
        }
    }
210796
public void setSbbContext(SbbContext context) {
		sbbContext = (SbbContextExt) context;
		sipActivityContextInterfaceFactory = (SipActivityContextInterfaceFactory) sbbContext
				.getActivityContextInterfaceFactory(sipRATypeID);
		sleeSipProvider = (SleeSipProvider) sbbContext
				.getResourceAdaptorInterface(sipRATypeID, sipRALink);
		addressFactory = sleeSipProvider.getAddressFactory();
		headerFactory = sleeSipProvider.getHeaderFactory();
		messageFactory = sleeSipProvider.getMessageFactory();
		timerFacility = sbbContext.getTimerFacility();
	}