Polishing
This commit is contained in:
parent
aa4ae7a750
commit
fd0132c7e6
|
@ -49,20 +49,22 @@ public class MockPart implements Part {
|
|||
|
||||
/**
|
||||
* Constructor for a part with byte[] content only.
|
||||
* @see #getHeaders()
|
||||
*/
|
||||
public MockPart(String name, byte[] content) {
|
||||
public MockPart(String name, @Nullable byte[] content) {
|
||||
this(name, null, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for a part with a filename.
|
||||
* Constructor for a part with a filename and streamed content.
|
||||
* @see #getHeaders()
|
||||
*/
|
||||
public MockPart(String name, @Nullable String filename, InputStream content) throws IOException {
|
||||
this(name, filename, FileCopyUtils.copyToByteArray(content));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for a part with byte[] content only.
|
||||
* Constructor for a part with a filename and byte[] content.
|
||||
* @see #getHeaders()
|
||||
*/
|
||||
private MockPart(String name, @Nullable String filename, @Nullable byte[] content) {
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import javax.servlet.http.Part;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
@ -27,7 +28,6 @@ import org.springframework.http.MediaType;
|
|||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
|
||||
/**
|
||||
* Mock implementation of {@code javax.servlet.http.Part}.
|
||||
*
|
||||
|
@ -47,20 +47,22 @@ public class MockPart implements Part {
|
|||
|
||||
/**
|
||||
* Constructor for a part with byte[] content only.
|
||||
* @see #getHeaders()
|
||||
*/
|
||||
public MockPart(String name, byte[] content) {
|
||||
this(name, null, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for a part with a filename.
|
||||
* Constructor for a part with a filename and streamed content.
|
||||
* @see #getHeaders()
|
||||
*/
|
||||
public MockPart(String name, String filename, InputStream content) throws IOException {
|
||||
this(name, filename, FileCopyUtils.copyToByteArray(content));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for a part with byte[] content only.
|
||||
* Constructor for a part with a filename and byte[] content.
|
||||
* @see #getHeaders()
|
||||
*/
|
||||
private MockPart(String name, String filename, byte[] content) {
|
||||
|
@ -105,7 +107,8 @@ public class MockPart implements Part {
|
|||
|
||||
@Override
|
||||
public Collection<String> getHeaders(String name) {
|
||||
return this.headers.get(name);
|
||||
Collection<String> headerValues = this.headers.get(name);
|
||||
return (headerValues != null ? headerValues : Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -146,6 +146,7 @@ public interface ClientResponse extends Closeable {
|
|||
@Override
|
||||
void close();
|
||||
|
||||
|
||||
/**
|
||||
* Represents the headers of the HTTP response.
|
||||
* @see ClientResponse#headers()
|
||||
|
@ -175,6 +176,6 @@ public interface ClientResponse extends Closeable {
|
|||
* Return the headers as a {@link HttpHeaders} instance.
|
||||
*/
|
||||
HttpHeaders asHttpHeaders();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -295,7 +295,7 @@ public abstract class AbstractHttpSockJsSession extends AbstractSockJsSession {
|
|||
synchronized (this.responseLock) {
|
||||
this.messageCache.add(message);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(this.messageCache.size() + " message(s) to flush in session " + this.getId());
|
||||
logger.trace(this.messageCache.size() + " message(s) to flush in session " + getId());
|
||||
}
|
||||
if (isActive() && this.readyToSend) {
|
||||
if (logger.isTraceEnabled()) {
|
||||
|
|
Loading…
Reference in New Issue