Returns all headers from a request keyed by header name.

@return all headers from a request keyed by header name.
551075
public static Map<String, String> headers(){
        Map<String, String> headers = new HashMap<>();
        Enumeration<String> names = RequestContext.getHttpRequest().getHeaderNames();
        while (names.hasMoreElements()) {
            String name = names.nextElement();
            headers.put(name, RequestContext.getHttpRequest().getHeader(name));
        }
        return headers;
    }
329735
private static function getHeadersFromInput ()
	{
		// getallheaders available, use that
		if (function_exists('getallheaders')) return getallheaders();

		// getallheaders not available: manually extract 'm
		$headers = [];
		foreach ($_SERVER as $name => $value)
		{
			if (substr($name, 0, 5) == 'HTTP_') {
			    $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
				$headers[$key] = $value;
			} else if (strtolower (substr ($name, 0, 7)) == 'content') {
                $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $name))));
				$headers[$key] = $value;
			}
		}
		return $headers;
	}
1037481
public static function getallheaders()
    {
        if (function_exists('getallheaders')) {
            $return = getallheaders();
        } else {
            $return = array();
            foreach ($_SERVER as $name => $value) {
               if (substr($name, 0, 5) == 'HTTP_') {
                   $return[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
               }
            }
        }
        return !empty($return) ? $return : array();
    }
1024808
public static function getAllRequestHeaders() {
        static $_cached_headers = false;
        if($_cached_headers!==false) {
            return $_cached_headers;
        }
        $headers = array();
        if(function_exists('getallheaders')) {
            foreach( getallheaders() as $name => $value ) {
                $headers[strtolower($name)] = $value;
            }
        } else {
            foreach($_SERVER as $name => $value) {
                if(substr($name, 0, 5) == 'HTTP_') {
                    $headers[strtolower(str_replace(' ', '-', str_replace('_', ' ', substr($name, 5))))] = $value;
                }
            }
        }
        return $_cached_headers = $headers;
    }
797084
@Override
    public List<String> getHeaders() {
        List<HeaderField> hdrs = this.message.getAllHeaders();
        List<String> values = new ArrayList<String>(hdrs.size());
        for (HeaderField header : hdrs) {
            values.add(header.getName());
        }
        return values;
    }
1168876
public String[] getHeaders() {
        String[] headers = new String[columns.getColumns().size()];
        Column column = null;
        for (int i = 0; i < columns.getColumns().size(); i++) {
            column = columns.getColumns().get(i);
            if (column.getHeader() != null && !column.getHeader().equals("")) {
                headers[i] = columns.getColumns().get(i).getHeader();
            } else {
                headers[i] = column.getName();
            }
        }
        return headers;
    }
966172
public Collection<String> getAllowedHeaders(Collection<String> requestHeaders) {

		Constraint.ensureNotNull(requestHeaders, "Null headers");
		Set<String> rtAllowedHeaders = new HashSet<String>(allowedHeaders);
		rtAllowedHeaders.addAll(requestHeaders);

		return rtAllowedHeaders;
	}
169581
public List<String> getValuesList(HttpHeader header) {
        final List<String> list = new ArrayList<>();
        for (HttpField f : this)
            if (f.getHeader() == header)
                list.add(f.getValue());
        return list;
    }
51763
public function getAllHeaders()
    {
        $headers = $this->headers;
        if ($this->cookies) {
            $headers['Set-Cookie'] = array_values($this->cookies);
        }

        return $headers;
    }
7745
public function getHeaders()
    {
        if ($this->_headers === null) {
            $this->_headers = new HeaderCollection();
            foreach ($this->swooleRequest->server as $name => $value) {
                if (strncmp($name, 'HTTP_', 5) === 0) {
                    $name = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
                    $this->_headers->add($name, $value);
                }
            }
        }
        return $this->_headers;
    }
28269
@SuppressWarnings("unchecked")
    public <R> R getHeader(String name) {
        return (R) headers().get(name);
    }
297722
public ListIterator<String> getHeaders(String name) {
		String nameToSearch = getCorrectHeaderName(name);
		ArrayList<String> result = new ArrayList<String>();

		try {
			ListIterator<Header> list = this.message.getHeaders(nameToSearch);
			while (list != null && list.hasNext()) {
				Header h = list.next();
				result.add(((SIPHeader)h).getHeaderValue());
			}
		} catch (Exception e) {
			logger.fatal("Couldnt fetch headers, original name[" + name
					+ "], name searched[" + nameToSearch + "]", e);
			return result.listIterator();
		}
		return result.listIterator();
	}
46444
public String [] getNames() {
		String [] result = new String[headers.size()];
		headers.keySet().toArray(result);
		return result;
	}
955044
protected function getHeaders()
    {
        if (function_exists('getallheaders')) {
            return getallheaders();
        }
        $arr_headers = [];
        foreach ($_SERVER as $str_key => $str_value) {
            if (strpos($str_key, 'HTTP_') === 0) {
                $arr_headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($str_key, 5)))))] = $str_value;
            }
        }
        return $arr_headers;
    }
893666
public static function GetRequestHeaders()
	{

		if (function_exists('getallheaders')) return getallheaders();

		$headers = array();
		foreach ($_SERVER as $k => $v)
		{
			if (substr($k, 0, 5) == "HTTP_")
			{
				$k = str_replace('_', ' ', substr($k, 5));
				$k = str_replace(' ', '-', ucwords(strtolower($k)));
				$headers[$k] = $v;
			}
		}
		return $headers;
	}
928508
public function getHeaders()
    {
        $headerLines = [];
        foreach ($this->response->getHeaders() as $name => $lines)
        {
            foreach ($lines as $line)
            {
                $headerLines[] = "$name: $line";
            }
        }

        return HeaderBag::fromHeaderLines($headerLines);
    }
183963
public Map<String,String> getRequestHeaders() {

        // If we already set the headers when logging request metadata, use them
        if (super.getRequestHeaders() != null)
            return super.getRequestHeaders();

        try {
            Map<String,String> headers = null;
            String headersVar = getAttributeValueSmart(HEADERS_VARIABLE);
            if (headersVar != null) {
                Process processVO = getProcessDefinition();
                Variable variableVO = processVO.getVariable(headersVar);
                if (variableVO == null)
                    throw new ActivityException("Headers variable '" + headersVar + "' is not defined for process " + processVO.getLabel());
                if (!variableVO.getType().startsWith("java.util.Map"))
                    throw new ActivityException("Headers variable '" + headersVar + "' must be of type java.util.Map");
                Object headersObj = getVariableValue(headersVar);
                if (headersObj != null) {
                    headers = new HashMap<>();
                    for (Object key : ((Map<?,?>)headersObj).keySet()) {
                        headers.put(key.toString(), ((Map<?,?>)headersObj).get(key).toString());
                    }
                }
            }
            Object authProvider = getAuthProvider();
            if (authProvider instanceof AuthTokenProvider) {
                if (headers == null)
                    headers = new HashMap<>();
                URL endpoint = new URL(getEndpointUri());
                String user = getAttribute(AUTH_USER);
                String password = getAttribute(AUTH_PASSWORD);
                String appId = getAttribute(AUTH_APP_ID);
                if (appId != null && appId.length() > 0) {
                    Map<String,String> options = new HashMap<>();
                    options.put("appId", appId);
                    ((AuthTokenProvider) authProvider).setOptions(options);
                }
                String token = new String(((AuthTokenProvider)authProvider).getToken(endpoint, user, password));
                headers.put("Authorization", "Bearer " + token);
            }
            // Set the headers so that we don't try and set them next time this method gets called
            super.setRequestHeaders(headers);
            return headers;
        }
        catch (Exception ex) {
            logger.severeException(ex.getMessage(), ex);
            return null;
        }
    }