1
votes

Hi i have some code that works fine in Tomcat, but under Websphere the response being returned does not seem to take on the Content-Type header that I am specifically setting to 'text/html'

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);

}

Response Headers from Firebug - tomcat

Via: 1.1 RENDMZISA01 Connection: Keep-Alive Proxy-Connection: Keep-Alive Transfer-Encoding: chunked Date: Tue, 08 Mar 2011 23:28:29 GMT Content-Type: text/html; charset=UTF-8 Server: Apache-Coyote/1.1 Keep-Alive: timeout=15, max=100

Response Headers from Firebug - websphere

Via: 1.1 RENDMZISA01 Connection: Keep-Alive Proxy-Connection: Keep-Alive Transfer-Encoding: chunked Date: Tue, 08 Mar 2011 23:22:47 GMT Content-Type: application/json;charset=UTF-8 Server: WebSphere Application Server/7.0 Content-Language: en-AU Keep-Alive: timeout=15, max=100

Any help appreciated.

1
Are you hitting WebSphere directly, or through an HTTP Server (such as IHS)?Isaac

1 Answers

0
votes

Please look at the Administrative Console more closely. You will find a view about mime types. WAS automatically sets mime types for everything that has defined suffixes and it ships with somewhat extensive list. These settings might overrule your application code.