當前位置: 首頁>>代碼示例>>Java>>正文


Java HttpServletResponse.getHeaderNames方法代碼示例

本文整理匯總了Java中javax.servlet.http.HttpServletResponse.getHeaderNames方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpServletResponse.getHeaderNames方法的具體用法?Java HttpServletResponse.getHeaderNames怎麽用?Java HttpServletResponse.getHeaderNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.servlet.http.HttpServletResponse的用法示例。


在下文中一共展示了HttpServletResponse.getHeaderNames方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: responseMsgLog

import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
/** send response message to client */
public static void responseMsgLog(HttpServletResponse response) {
	response.setContentType("text/html");
	response.setCharacterEncoding("UTF-8");

	System.out.println("Http Post Response: " + response.toString());

	/* response status info */
	System.out.println("==================STARTLINE==================");
	System.out.println("Response Status: " + response.getStatus());
	System.out.println("Response ContentType: " + response.getContentType());

	/* response header info */
	System.out.println("==================HEADER=====================");
	Collection<String> headerNames = response.getHeaderNames();

	while (!headerNames.isEmpty()) {
		String headerName = (String) headerNames.toString();

		System.out.println(headerName + ": " + response.getHeader(headerName));
	}
	System.out.println("===================ENTITY====================");
}
 
開發者ID:Team-Sprout,項目名稱:Clipcon-Server,代碼行數:24,代碼來源:Logging.java

示例2: getResponseHeaders

import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
private static Map<String, String> getResponseHeaders(HttpServletResponse response) {
    Map<String, String> headers = new LinkedHashMap<>();
    for (String header : response.getHeaderNames()) {
        String value = response.getHeader(header);
        headers.put(header.toLowerCase(), value);
    }
    headers.remove("set-cookie");
    return headers;
}
 
開發者ID:xm-online,項目名稱:xm-commons,代碼行數:10,代碼來源:TimelineEventProducer.java

示例3: toApmResponse

import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
protected ApmResponse toApmResponse (final HttpServletResponse response) {
  final ApmResponse apmResponse;
  if (response != null) {
    final ApmHeaders apmHeaders = new ApmHeaders ()
        .withContent_type (response.getContentType ());
    for (final String headerName : response.getHeaderNames ()) {
      apmHeaders.withAdditionalProperty (headerName, response.getHeader (headerName));
    }

    apmResponse = new ApmResponse ()
        .withHeaders (apmHeaders)
        .withStatus_code ((double) response.getStatus ())
      //TODO add missing props
    ;
  } else {
    apmResponse = null;
  }
  return apmResponse;
}
 
開發者ID:davidecavestro,項目名稱:elastic-apm-java-agent-poc,代碼行數:20,代碼來源:ApmAgent.java

示例4: buildResponseLog

import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
/**
 * Build log message for response out bound.
 *
 * @param response Response out bound.
 * @return Log message.
 * @since 1.0.0
 */
protected String buildResponseLog(HttpServletResponse response) {
	StringBuilder sb = new StringBuilder("Server responded with a response").append(StringUtils.LF)
			.append(" > ").append(response.getStatus()).append(StringUtils.LF);

	Collection<String> keys = response.getHeaderNames();
	for (String key : keys) {
		sb.append(" > ").append(key).append(": ").append(response.getHeader(key)).append(StringUtils.LF);
	}

	sb.append(extractResponsePayload(response));

	return sb.toString();
}
 
開發者ID:cmateosl,項目名稱:role-api,代碼行數:21,代碼來源:BaseLoggingFilter.java

示例5: getResponHeaders

import javax.servlet.http.HttpServletResponse; //導入方法依賴的package包/類
/**
 * 根據HttpServletRequest獲取指定格式的headers
 * 
 * @param request
 * @return
 */
private String getResponHeaders(HttpServletResponse response) {

    Map<String, String> result = new HashMap<String, String>();
    for (String key : response.getHeaderNames()) {
        result.put(key, response.getHeader(key));
    }
    return JSONHelper.toString(result);
}
 
開發者ID:uavorg,項目名稱:uavstack,代碼行數:15,代碼來源:ServerSpanAdapter.java


注:本文中的javax.servlet.http.HttpServletResponse.getHeaderNames方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。