Fix formatting

This commit is contained in:
Rossen Stoyanchev 2015-03-05 22:50:42 -05:00
parent 8ab2e47556
commit b7dd520784
4 changed files with 13 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -210,26 +210,21 @@ public class BufferedImageHttpMessageConverter implements HttpMessageConverter<B
throws IOException, HttpMessageNotWritableException { throws IOException, HttpMessageNotWritableException {
if (outputMessage instanceof StreamingHttpOutputMessage) { if (outputMessage instanceof StreamingHttpOutputMessage) {
StreamingHttpOutputMessage streamingOutputMessage = StreamingHttpOutputMessage streamingOutputMessage = (StreamingHttpOutputMessage) outputMessage;
(StreamingHttpOutputMessage) outputMessage;
streamingOutputMessage.setBody(new StreamingHttpOutputMessage.Body() { streamingOutputMessage.setBody(new StreamingHttpOutputMessage.Body() {
@Override @Override
public void writeTo(OutputStream outputStream) throws IOException { public void writeTo(OutputStream outputStream) throws IOException {
writeInternal(image, contentType, outputMessage.getHeaders(), writeInternal(image, contentType, outputMessage.getHeaders(), outputStream);
outputStream);
} }
}); });
} }
else { else {
writeInternal(image, contentType, outputMessage.getHeaders(), writeInternal(image, contentType, outputMessage.getHeaders(), outputMessage.getBody());
outputMessage.getBody());
} }
} }
private void writeInternal(BufferedImage image, MediaType contentType, private void writeInternal(BufferedImage image, MediaType contentType, HttpHeaders headers,
HttpHeaders headers, OutputStream body) OutputStream body) throws IOException, HttpMessageNotWritableException {
throws IOException, HttpMessageNotWritableException {
if (contentType == null || contentType.isWildcardType() || contentType.isWildcardSubtype()) { if (contentType == null || contentType.isWildcardType() || contentType.isWildcardSubtype()) {
contentType = getDefaultContentType(); contentType = getDefaultContentType();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -257,8 +257,8 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
return false; return false;
} }
private void writeForm(MultiValueMap<String, String> form, MediaType contentType, HttpOutputMessage outputMessage) private void writeForm(MultiValueMap<String, String> form, MediaType contentType,
throws IOException { HttpOutputMessage outputMessage) throws IOException {
Charset charset; Charset charset;
if (contentType != null) { if (contentType != null) {
@ -291,8 +291,7 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
outputMessage.getHeaders().setContentLength(bytes.length); outputMessage.getHeaders().setContentLength(bytes.length);
if (outputMessage instanceof StreamingHttpOutputMessage) { if (outputMessage instanceof StreamingHttpOutputMessage) {
StreamingHttpOutputMessage streamingOutputMessage = StreamingHttpOutputMessage streamingOutputMessage = (StreamingHttpOutputMessage) outputMessage;
(StreamingHttpOutputMessage) outputMessage;
streamingOutputMessage.setBody(new StreamingHttpOutputMessage.Body() { streamingOutputMessage.setBody(new StreamingHttpOutputMessage.Body() {
@Override @Override
public void writeTo(OutputStream outputStream) throws IOException { public void writeTo(OutputStream outputStream) throws IOException {
@ -314,8 +313,7 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
headers.setContentType(contentType); headers.setContentType(contentType);
if (outputMessage instanceof StreamingHttpOutputMessage) { if (outputMessage instanceof StreamingHttpOutputMessage) {
StreamingHttpOutputMessage streamingOutputMessage = StreamingHttpOutputMessage streamingOutputMessage = (StreamingHttpOutputMessage) outputMessage;
(StreamingHttpOutputMessage) outputMessage;
streamingOutputMessage.setBody(new StreamingHttpOutputMessage.Body() { streamingOutputMessage.setBody(new StreamingHttpOutputMessage.Body() {
@Override @Override
public void writeTo(OutputStream outputStream) throws IOException { public void writeTo(OutputStream outputStream) throws IOException {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2014 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.