|
|
|
@ -16,6 +16,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.http.converter; |
|
|
|
package org.springframework.http.converter; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.FilterOutputStream; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.io.OutputStream; |
|
|
|
import java.net.URLDecoder; |
|
|
|
import java.net.URLDecoder; |
|
|
|
@ -618,7 +619,7 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue |
|
|
|
private boolean headersWritten = false; |
|
|
|
private boolean headersWritten = false; |
|
|
|
|
|
|
|
|
|
|
|
public MultipartHttpOutputMessage(OutputStream outputStream, Charset charset) { |
|
|
|
public MultipartHttpOutputMessage(OutputStream outputStream, Charset charset) { |
|
|
|
this.outputStream = outputStream; |
|
|
|
this.outputStream = new MultipartOutputStream(outputStream); |
|
|
|
this.charset = charset; |
|
|
|
this.charset = charset; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -654,6 +655,32 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue |
|
|
|
private byte[] getBytes(String name) { |
|
|
|
private byte[] getBytes(String name) { |
|
|
|
return name.getBytes(this.charset); |
|
|
|
return name.getBytes(this.charset); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* OutputStream that neither flushes nor closes. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static class MultipartOutputStream extends FilterOutputStream { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public MultipartOutputStream(OutputStream out) { |
|
|
|
|
|
|
|
super(out); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void write(byte[] b, int off, int let) throws IOException { |
|
|
|
|
|
|
|
this.out.write(b, off, let); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void flush() { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void close() { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|