获取HttpServletRequest头文件信息

/**
	 * 获取头文件信息
	 * 
	 * @param request
	 * @return
	 */
	public static Map getHeadersInfo(HttpServletRequest request) {
		Map map = new HashMap();
		Enumeration headerNames = request.getHeaderNames();
		while (headerNames.hasMoreElements()) {
			String key = (String) headerNames.nextElement();
			String value = request.getHeader(key);
			System.out.println(key + ":" + value);
			map.put(key, value);
		}
		return map;
	}

你可能感兴趣的:(Java技术)