private UIInputMany<String> accessControlRequestHeaders;
189851
@Override
   public void initializeUI(UIBuilder builder) throws Exception
   {
      super.initializeUI(builder);
      getNamed().setDefaultValue("NewCrossOriginResourceSharingFilter");
      accessControlAllowHeaders.setValue(Arrays.asList("Content-Type", "User-Agent", "X-Requested-With",
               "X-Requested-By", "Cache-Control"));
      accessControlAllowMethods.setValueChoices(Arrays.asList(HttpMethod.GET, HttpMethod.POST, HttpMethod.PUT,
               HttpMethod.DELETE, HttpMethod.HEAD, HttpMethod.OPTIONS));
      accessControlAllowMethods.setValue(Arrays.asList(HttpMethod.GET, HttpMethod.POST, HttpMethod.PUT,
               HttpMethod.DELETE));
      builder.add(accessControlAllowMethods).add(accessControlAllowHeaders)
               .add(accessControlAllowOrigin).add(accessControlAllowCredentials);
   }
1370431
public final void fromHttpHeaders(HttpHeaders headers) {
    try {
      ParseHeaderState state = new ParseHeaderState(this, null);
      serializeHeaders(
          headers, null, null, null, new HeaderParsingFakeLevelHttpRequest(this, state));
      state.finish();
    } catch (IOException ex) {
      // Should never occur as we are dealing with a FakeLowLevelHttpRequest
      throw Throwables.propagate(ex);
    }
  }
610034
String debugGetAllHttpHdrs(HttpServletRequest req) {
        if (req == null)
            return null;
        StringBuffer sb = new StringBuffer(512);
        Enumeration<String> headerNames = req.getHeaderNames();
        while (headerNames != null && headerNames.hasMoreElements()) {
            String headerName = headerNames.nextElement();
            sb.append(headerName).append("=");
            sb.append("[").append(SRTServletRequestUtils.getHeader(req, headerName)).append("]\n");
        }
        return sb.toString();
    }
65939
protected Optional<MutableHttpResponse<?>> handleRequest(HttpRequest request) {
        HttpHeaders headers = request.getHeaders();
        Optional<String> originHeader = headers.getOrigin();
        if (originHeader.isPresent()) {

            String requestOrigin = originHeader.get();
            boolean preflight = CorsUtil.isPreflightRequest(request);

            Optional<CorsOriginConfiguration> optionalConfig = getConfiguration(requestOrigin);

            if (optionalConfig.isPresent()) {
                CorsOriginConfiguration config = optionalConfig.get();

                HttpMethod requestMethod = request.getMethod();

                List<HttpMethod> allowedMethods = config.getAllowedMethods();

                if (!isAnyMethod(allowedMethods)) {
                    HttpMethod methodToMatch = preflight ? headers.getFirst(ACCESS_CONTROL_REQUEST_METHOD, HttpMethod.class).orElse(requestMethod) : requestMethod;
                    if (allowedMethods.stream().noneMatch(method -> method.equals(methodToMatch))) {
                        return Optional.of(HttpResponse.status(HttpStatus.FORBIDDEN));
                    }
                }

                if (preflight) {
                    Optional<List> accessControlHeaders = headers.get(ACCESS_CONTROL_REQUEST_HEADERS, Argument.of(List.class, String.class));

                    List<String> allowedHeaders = config.getAllowedHeaders();

                    if (!isAny(allowedHeaders) && accessControlHeaders.isPresent()) {
                        if (!accessControlHeaders.get().stream()
                            .allMatch(header -> allowedHeaders.stream()
                                .anyMatch(allowedHeader -> allowedHeader.equals(header.toString().trim())))) {
                            return Optional.of(HttpResponse.status(HttpStatus.FORBIDDEN));
                        }
                    }

                    MutableHttpResponse<Object> ok = HttpResponse.ok();
                    handleResponse(request, ok);
                    return Optional.of(ok);
                }
            }
        }

        return Optional.empty();
    }
878138
final private HttpResponseMessageImpl getResponseImpl() {
        if (null == getMyResponse()) {
            setMyResponse(getObjectFactory().getResponse(this));
            // use limits from the request (not config)
            getMyResponse().setLimitOfTokenSize(getMyRequest().getLimitOfTokenSize());
            getMyResponse().setLimitOnNumberOfHeaders(getMyRequest().getLimitOnNumberOfHeaders());
        }
        return getMyResponse();
    }
328009
function Request_addHeader(key, value) {
        var item;
        if (Type.isString(key)) {
            key = key.toLowerCase();
            if (!Type.isString(value) && !!value && Type.isFunction(value.toString)) {
                value = value.toString();
            }
            if (Type.isString(value)) {
                if (this.hasHeader(key) && !Type.isArray(this.headers[key])) {
                    item = this.getHeader(key);
                    this.headers[key] = [];
                    this.headers[key].push(item);
                    this.headers[key].push(value);
                } else if (this.hasHeader(key) && Type.isArray(this.headers[key])) {
                    this.headers[key].push(value);
                } else {
                    this.headers[key] = value;
                }
            }
        } else {
            throw new error.HttpError(500, {
                key: key,
                value: value
            }, "Request.addHeader: Header key must be string type");
        }
    }
368279
@Override
    public void handleRequest(final HttpServerExchange exchange) throws Exception
    {
        if (this.defaultResponseListener != null) {
            exchange.addDefaultResponseListener(defaultResponseListener);
        }

        long fiGlobal = this.headers.fastIterateNonEmpty();

        while (fiGlobal != -1) {
            final HeaderValues headerValues = headers.fiCurrent(fiGlobal);

            exchange.getResponseHeaders().addAll(headerValues.getHeaderName(), headerValues);

            fiGlobal = headers.fiNextNonEmpty(fiGlobal);
        }

        next.handleRequest(exchange);
    }
497965
@Override
    public int getIntHeader(String name) {
        int rc = -1;
        String value = this.request.getHeader(name);
        if (null != value) {
            rc = Integer.parseInt(value);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "getIntHeader: " + name + " " + rc);
        }
        return rc;
    }
65971
function() {
      var req = self.apos.templates.contextReq;
      return self.partial('controls', { controls: self.getEditControls(req), options: self.options });
    }
392554
private static Map<String, String> __getRequestHeaderMap(HttpServletRequest req) {
        Map<String, String> reqHeaders = new LinkedHashMap<>();
        Enumeration<String> headerNames = req.getHeaderNames();
        if (headerNames != null) {
            while (headerNames.hasMoreElements()) {
                String headerName = headerNames.nextElement();
                Enumeration<String> headerValues = req.getHeaders(headerName);

                if (headerValues != null) {
                    StringBuilder headerValueBuilder = new StringBuilder();
                    int i = 0;
                    while (headerValues.hasMoreElements()) {
                        if (i > 0) {
                            headerValueBuilder.append(", ");
                        }

                        headerValueBuilder.append(headerValues.nextElement());
                        i++;
                    }

                    reqHeaders.put(headerName, headerValueBuilder.toString());
                } else {
                    reqHeaders.put(headerName, "");
                }
            }
        }
        return reqHeaders;
    }
774452
private void addHeaders(HttpRequest request, Map<String, String> headers) {
		for (Map.Entry<String, String> key : headers.entrySet()) {
			request.addHeader(key.getKey(), key.getValue());
		}
	}
962755
private void setupHeaders(HttpURLConnection connection) {
        for (Map.Entry<String, Object> entry : getHeaders().entrySet()) {
            connection.setRequestProperty(entry.getKey(), String.valueOf(entry.getValue()));
        }
        connection.setDoOutput(true);
        connection.setDoInput(true);
        connection.setUseCaches(false);
        connection.setAllowUserInteraction(false);
    }
436093
@Override
    public Map<String, String> getRequestHeaders() {
        Map<String, String> requestHeaders = super.getRequestHeaders();
        if (requestHeaders == null)
            requestHeaders = new HashMap<>();
        try {
            requestHeaders.put(Request.REQUEST_ID, getMasterRequestId());
            String httpMethod = getHttpMethod();
            if ("GET".equals(httpMethod))
                requestHeaders.put("Accept", "application/json");
            else
                requestHeaders.put("Content-Type", "application/json");
        }
        catch (ActivityException ex) {
            logexception(ex.getMessage(), ex);
        }
        return requestHeaders;
    }
511641
def _setHeaders(self, request):
        
        request.responseHeaders.addRawHeader(b'content-type', b'application/json')
        request.responseHeaders.addRawHeader(b'Access-Control-Allow-Origin', b'*')
        request.responseHeaders.addRawHeader(b'Access-Control-Allow-Methods', b'GET, POST, PUT, DELETE')
        request.responseHeaders.addRawHeader(b'Access-Control-Allow-Headers', b'x-prototype-version,x-requested-with')
        request.responseHeaders.addRawHeader(b'Access-Control-Max-Age', 2520)
        return request
181634
@Override
    public boolean isPortletRenderHeaderRequested(
            IPortletWindowId portletWindowId,
            HttpServletRequest request,
            HttpServletResponse response) {
        final Map<IPortletWindowId, IPortletRenderExecutionWorker> portletRenderingMap =
                this.getPortletHeaderRenderingMap(request);
        final IPortletRenderExecutionWorker tracker = portletRenderingMap.get(portletWindowId);

        return tracker != null;
    }
1358668
private void setHeaders(HttpRequest req, HttpURLConnection connection) {
        if (logger.isDebugEnabled()) {
            logger.debug("Request: ");
            logger.debug(req.getMethod().name() + " ", req.getURL());
        }

        String authorizationHeader;
        if (req.getAuthorization() != null && (authorizationHeader = req.getAuthorization().getAuthorizationHeader(req)) != null) {
            if (logger.isDebugEnabled()) {
                logger.debug("Authorization: ", authorizationHeader.replaceAll(".", "*"));
            }
            connection.addRequestProperty("Authorization", authorizationHeader);
        }
        if (req.getRequestHeaders() != null) {
            for (String key : req.getRequestHeaders().keySet()) {
                connection.addRequestProperty(key, req.getRequestHeaders().get(key));
                logger.debug(key + ": " + req.getRequestHeaders().get(key));
            }
        }
    }
1320279
public RequestTemplate headers(Map<String, Collection<String>> headers) {
    if (headers != null && !headers.isEmpty()) {
      headers.forEach(this::header);
    } else {
      this.headers.clear();
    }
    return this;
  }