当前位置: 首页>>代码示例>>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;未经允许,请勿转载。