polishing

This commit is contained in:
Juergen Hoeller 2011-12-12 15:04:11 +00:00
parent 23e58aa718
commit 450a3d7eee
3 changed files with 3 additions and 2 deletions

View File

@ -306,7 +306,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
private void updateContentTypeHeader() {
if (this.contentType != null) {
StringBuilder sb = new StringBuilder(this.contentType);
if (this.contentType.toLowerCase().indexOf(CHARSET_PREFIX) == -1 && this.characterEncoding != null) {
if (!this.contentType.toLowerCase().contains(CHARSET_PREFIX) && this.characterEncoding != null) {
sb.append(";").append(CHARSET_PREFIX).append(this.characterEncoding);
}
doAddHeaderValue(CONTENT_TYPE_HEADER, sb.toString(), true);

View File

@ -990,7 +990,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
HttpInputMessage inputMessage = createHttpInputMessage(webRequest);
HttpOutputMessage outputMessage = createHttpOutputMessage(webRequest);
if (responseEntity instanceof ResponseEntity && outputMessage instanceof ServerHttpResponse) {
((ServerHttpResponse)outputMessage).setStatusCode(((ResponseEntity) responseEntity).getStatusCode());
((ServerHttpResponse) outputMessage).setStatusCode(((ResponseEntity) responseEntity).getStatusCode());
}
HttpHeaders entityHeaders = responseEntity.getHeaders();
if (!entityHeaders.isEmpty()) {

View File

@ -79,6 +79,7 @@ public interface MultipartRequest {
* Determine the content type of the specified request part.
* @param paramOrFileName the name of the part
* @return the associated content type, or <code>null</code> if not defined
* @since 3.1
*/
String getMultipartContentType(String paramOrFileName);