Polishing (includes minor performance refinements from master)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,7 +50,7 @@ public interface HttpMessageWriter<T> {
|
||||
/**
|
||||
* Whether the given object type is supported by this writer.
|
||||
* @param elementType the type of object to check
|
||||
* @param mediaType the media type for the write, possibly {@code null}
|
||||
* @param mediaType the media type for the write (possibly {@code null})
|
||||
* @return {@code true} if writable, {@code false} otherwise
|
||||
*/
|
||||
boolean canWrite(ResolvableType elementType, @Nullable MediaType mediaType);
|
||||
@@ -60,8 +60,8 @@ public interface HttpMessageWriter<T> {
|
||||
* @param inputStream the objects to write
|
||||
* @param elementType the type of objects in the stream which must have been
|
||||
* previously checked via {@link #canWrite(ResolvableType, MediaType)}
|
||||
* @param mediaType the content type for the write, possibly {@code null} to
|
||||
* indicate that the default content type of the writer must be used.
|
||||
* @param mediaType the content type for the write (possibly {@code null} to
|
||||
* indicate that the default content type of the writer must be used)
|
||||
* @param message the message to write to
|
||||
* @param hints additional information about how to encode and write
|
||||
* @return indicates completion or error
|
||||
@@ -77,8 +77,8 @@ public interface HttpMessageWriter<T> {
|
||||
* value; for annotated controllers, the {@link MethodParameter} can be
|
||||
* accessed via {@link ResolvableType#getSource()}.
|
||||
* @param elementType the type of Objects in the input stream
|
||||
* @param mediaType the content type to use, possibly {@code null} indicating
|
||||
* the default content type of the writer should be used.
|
||||
* @param mediaType the content type to use (possibly {@code null} indicating
|
||||
* the default content type of the writer should be used)
|
||||
* @param request the current request
|
||||
* @param response the current response
|
||||
* @return a {@link Mono} that indicates completion of writing or error
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,7 +68,7 @@ public class Jaxb2RootElementHttpMessageConverter extends AbstractJaxb2HttpMessa
|
||||
|
||||
|
||||
/**
|
||||
* Indicates whether DTD parsing should be supported.
|
||||
* Indicate whether DTD parsing should be supported.
|
||||
* <p>Default is {@code false} meaning that DTD is disabled.
|
||||
*/
|
||||
public void setSupportDtd(boolean supportDtd) {
|
||||
@@ -76,14 +76,14 @@ public class Jaxb2RootElementHttpMessageConverter extends AbstractJaxb2HttpMessa
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether DTD parsing is supported.
|
||||
* Return whether DTD parsing is supported.
|
||||
*/
|
||||
public boolean isSupportDtd() {
|
||||
return this.supportDtd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether external XML entities are processed when converting to a Source.
|
||||
* Indicate whether external XML entities are processed when converting to a Source.
|
||||
* <p>Default is {@code false}, meaning that external entities are not resolved.
|
||||
* <p><strong>Note:</strong> setting this option to {@code true} also
|
||||
* automatically sets {@link #setSupportDtd} to {@code true}.
|
||||
@@ -91,12 +91,12 @@ public class Jaxb2RootElementHttpMessageConverter extends AbstractJaxb2HttpMessa
|
||||
public void setProcessExternalEntities(boolean processExternalEntities) {
|
||||
this.processExternalEntities = processExternalEntities;
|
||||
if (processExternalEntities) {
|
||||
setSupportDtd(true);
|
||||
this.supportDtd = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configured value for whether XML external entities are allowed.
|
||||
* Return whether XML external entities are allowed.
|
||||
*/
|
||||
public boolean isProcessExternalEntities() {
|
||||
return this.processExternalEntities;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -100,7 +100,7 @@ public class SourceHttpMessageConverter<T extends Source> extends AbstractHttpMe
|
||||
|
||||
|
||||
/**
|
||||
* Indicates whether DTD parsing should be supported.
|
||||
* Indicate whether DTD parsing should be supported.
|
||||
* <p>Default is {@code false} meaning that DTD is disabled.
|
||||
*/
|
||||
public void setSupportDtd(boolean supportDtd) {
|
||||
@@ -108,14 +108,14 @@ public class SourceHttpMessageConverter<T extends Source> extends AbstractHttpMe
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether DTD parsing is supported.
|
||||
* Return whether DTD parsing is supported.
|
||||
*/
|
||||
public boolean isSupportDtd() {
|
||||
return this.supportDtd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether external XML entities are processed when converting to a Source.
|
||||
* Indicate whether external XML entities are processed when converting to a Source.
|
||||
* <p>Default is {@code false}, meaning that external entities are not resolved.
|
||||
* <p><strong>Note:</strong> setting this option to {@code true} also
|
||||
* automatically sets {@link #setSupportDtd} to {@code true}.
|
||||
@@ -123,12 +123,12 @@ public class SourceHttpMessageConverter<T extends Source> extends AbstractHttpMe
|
||||
public void setProcessExternalEntities(boolean processExternalEntities) {
|
||||
this.processExternalEntities = processExternalEntities;
|
||||
if (processExternalEntities) {
|
||||
setSupportDtd(true);
|
||||
this.supportDtd = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configured value for whether XML external entities are allowed.
|
||||
* Return whether XML external entities are allowed.
|
||||
*/
|
||||
public boolean isProcessExternalEntities() {
|
||||
return this.processExternalEntities;
|
||||
|
||||
@@ -950,9 +950,9 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
return;
|
||||
}
|
||||
}
|
||||
String message = "No HttpMessageConverter for [" + requestBodyClass.getName() + "]";
|
||||
String message = "No HttpMessageConverter for " + requestBodyClass.getName();
|
||||
if (requestContentType != null) {
|
||||
message += " and content type [" + requestContentType + "]";
|
||||
message += " and content type \"" + requestContentType + "\"";
|
||||
}
|
||||
throw new RestClientException(message);
|
||||
}
|
||||
@@ -964,8 +964,7 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
|
||||
logger.debug("Writing [" + body + "] as \"" + mediaType + "\"");
|
||||
}
|
||||
else {
|
||||
String classname = converter.getClass().getName();
|
||||
logger.debug("Writing [" + body + "] with " + classname);
|
||||
logger.debug("Writing [" + body + "] with " + converter.getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,9 +38,9 @@ public interface AsyncHandlerMethodReturnValueHandler extends HandlerMethodRetur
|
||||
|
||||
/**
|
||||
* Whether the given return value represents asynchronous computation.
|
||||
* @param returnValue the return value
|
||||
* @param returnValue the value returned from the handler method
|
||||
* @param returnType the return type
|
||||
* @return {@code true} if the return value is asynchronous
|
||||
* @return {@code true} if the return value type represents an async value
|
||||
*/
|
||||
boolean isAsyncReturnValue(@Nullable Object returnValue, MethodParameter returnType);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,10 +43,10 @@ public class NotAcceptableStatusException extends ResponseStatusException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for when requested Content-Type is not supported.
|
||||
* Constructor for when the requested Content-Type is not supported.
|
||||
*/
|
||||
public NotAcceptableStatusException(List<MediaType> supportedMediaTypes) {
|
||||
super(HttpStatus.NOT_ACCEPTABLE, "Could not find acceptable representation", null);
|
||||
super(HttpStatus.NOT_ACCEPTABLE, "Could not find acceptable representation");
|
||||
this.supportedMediaTypes = Collections.unmodifiableList(supportedMediaTypes);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user