Polishing
This commit is contained in:
@@ -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.
|
||||
@@ -34,12 +34,11 @@ import org.springframework.lang.Nullable;
|
||||
* Strategy for encoding a stream of objects of type {@code <T>} and writing
|
||||
* the encoded stream of bytes to an {@link ReactiveHttpOutputMessage}.
|
||||
*
|
||||
* @param <T> the type of objects in the input stream
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @author Arjen Poutsma
|
||||
* @author Sebastien Deleuze
|
||||
* @since 5.0
|
||||
* @param <T> the type of objects in the input stream
|
||||
*/
|
||||
public interface HttpMessageWriter<T> {
|
||||
|
||||
@@ -51,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);
|
||||
@@ -61,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
|
||||
@@ -78,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.
|
||||
@@ -71,7 +71,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) {
|
||||
@@ -79,14 +79,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}.
|
||||
@@ -94,12 +94,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.
|
||||
@@ -62,6 +62,7 @@ import org.springframework.util.StreamUtils;
|
||||
* @author Arjen Poutsma
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.0
|
||||
* @param <T> the converted object type
|
||||
*/
|
||||
public class SourceHttpMessageConverter<T extends Source> extends AbstractHttpMessageConverter<T> {
|
||||
|
||||
@@ -99,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) {
|
||||
@@ -107,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}.
|
||||
@@ -122,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;
|
||||
|
||||
@@ -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