【发布时间】:2011-07-11 13:37:43
【问题描述】:
您好,我有一些在 Tomcat 中运行良好的代码,但在 Websphere 下,返回的响应似乎没有采用我专门设置为“text/html”的 Content-Type 标头
public ResponseEntity<?> postAttachment(@ModelAttribute AttachmentDto attachmentDto) {
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.setContentType(MediaType.TEXT_HTML);
RestResponse<AttachmentDto> response = attachmentService.save(attachmentDto);
return new ResponseEntity<RestResponse<AttachmentDto>>(response, responseHeaders, HttpStatus.OK);
}
来自 Firebug - tomcat 的响应标头
通过:1.1 RENDMZISA01 连接:保持活动 代理连接:保持活动 传输编码:分块 日期:格林威治标准时间 2011 年 3 月 8 日星期二 23:28:29 内容类型:text/html; charset=UTF-8 服务器:Apache-Coyote/1.1 保活:超时=15,最大值=100
来自 Firebug - websphere 的响应标头
通过:1.1 RENDMZISA01 连接:保持活动 代理连接:保持活动 传输编码:分块 日期:格林威治标准时间 2011 年 3 月 8 日星期二 23:22:47 内容类型:application/json;charset=UTF-8 服务器:WebSphere Application Server/7.0 内容语言:en-AU 保活:超时=15,最大值=100
任何帮助表示赞赏。
【问题讨论】:
-
您是直接访问 WebSphere,还是通过 HTTP 服务器(例如 IHS)?
标签: header websphere response content-type