Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -42,8 +42,8 @@ public interface AsyncHandlerMethodReturnValueHandler extends HandlerMethodRetur
|
||||
* {@link #supportsReturnType(org.springframework.core.MethodParameter)}
|
||||
* is called and it returns {@code true}.
|
||||
* @param returnValue the value returned from the handler method
|
||||
* @param returnType the type of the return value.
|
||||
* @return true if the return value type represents an async value.
|
||||
* @param returnType the type of the return value
|
||||
* @return {@code true} if the return value type represents an async value
|
||||
*/
|
||||
boolean isAsyncReturnValue(Object returnValue, MethodParameter returnType);
|
||||
|
||||
@@ -57,9 +57,9 @@ public interface AsyncHandlerMethodReturnValueHandler extends HandlerMethodRetur
|
||||
* {@link #supportsReturnType(org.springframework.core.MethodParameter)}
|
||||
* is called and it returns {@code true}.
|
||||
* @param returnValue the value returned from the handler method
|
||||
* @param returnType the type of the return value.
|
||||
* @return the resulting ListenableFuture or {@code null} in which case no
|
||||
* further handling will be performed.
|
||||
* @param returnType the type of the return value
|
||||
* @return the resulting ListenableFuture, or {@code null} in which case
|
||||
* no further handling will be performed
|
||||
*/
|
||||
ListenableFuture<?> toListenableFuture(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.
|
||||
@@ -41,10 +41,10 @@ public abstract class AbstractMessageChannel implements MessageChannel, Intercep
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final List<ChannelInterceptor> interceptors = new ArrayList<ChannelInterceptor>(5);
|
||||
|
||||
private String beanName;
|
||||
|
||||
private final List<ChannelInterceptor> interceptors = new ArrayList<ChannelInterceptor>(5);
|
||||
|
||||
|
||||
public AbstractMessageChannel() {
|
||||
this.beanName = getClass().getSimpleName() + "@" + ObjectUtils.getIdentityHexString(this);
|
||||
|
||||
@@ -337,8 +337,8 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
||||
/**
|
||||
* Set the resource resolver, as used to load the schema resources.
|
||||
* @see SchemaFactory#setResourceResolver(org.w3c.dom.ls.LSResourceResolver)
|
||||
* @see #setSchema(Resource)
|
||||
* @see #setSchemas(Resource[])
|
||||
* @see #setSchema
|
||||
* @see #setSchemas
|
||||
*/
|
||||
public void setSchemaResourceResolver(LSResourceResolver schemaResourceResolver) {
|
||||
this.schemaResourceResolver = schemaResourceResolver;
|
||||
@@ -401,7 +401,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
@@ -409,14 +409,14 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 unmarshalling.
|
||||
* Indicate whether external XML entities are processed when unmarshalling.
|
||||
* <p>Default is {@code false}, meaning that external entities are not resolved.
|
||||
* Note that processing of external entities will only be enabled/disabled when the
|
||||
* {@code Source} passed to {@link #unmarshal(Source)} is a {@link SAXSource} or
|
||||
@@ -433,7 +433,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi
|
||||
}
|
||||
|
||||
/**
|
||||
* 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-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.
|
||||
@@ -82,7 +82,7 @@ public abstract class AbstractMarshaller implements Marshaller, Unmarshaller {
|
||||
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
@@ -90,14 +90,14 @@ public abstract class AbstractMarshaller implements Marshaller, Unmarshaller {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 unmarshalling.
|
||||
* Indicate whether external XML entities are processed when unmarshalling.
|
||||
* <p>Default is {@code false}, meaning that external entities are not resolved.
|
||||
* Note that processing of external entities will only be enabled/disabled when the
|
||||
* {@code Source} passed to {@link #unmarshal(Source)} is a {@link SAXSource} or
|
||||
@@ -114,7 +114,7 @@ public abstract class AbstractMarshaller implements Marshaller, Unmarshaller {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configured value for whether XML external entities are allowed.
|
||||
* Return whether XML external entities are allowed.
|
||||
* @see #createXmlReader()
|
||||
*/
|
||||
public boolean isProcessExternalEntities() {
|
||||
|
||||
@@ -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.
|
||||
@@ -40,7 +40,7 @@ public enum Propagation {
|
||||
* Support a current transaction, execute non-transactionally if none exists.
|
||||
* Analogous to EJB transaction attribute of the same name.
|
||||
* <p>Note: For transaction managers with transaction synchronization,
|
||||
* PROPAGATION_SUPPORTS is slightly different from no transaction at all,
|
||||
* {@code SUPPORTS} is slightly different from no transaction at all,
|
||||
* as it defines a transaction scope that synchronization will apply for.
|
||||
* As a consequence, the same resources (JDBC Connection, Hibernate Session, etc)
|
||||
* will be shared for the entire specified scope. Note that this depends on
|
||||
@@ -87,7 +87,7 @@ public enum Propagation {
|
||||
|
||||
/**
|
||||
* Execute within a nested transaction if a current transaction exists,
|
||||
* behave like PROPAGATION_REQUIRED else. There is no analogous feature in EJB.
|
||||
* behave like {@code REQUIRED} else. There is no analogous feature in EJB.
|
||||
* <p>Note: Actual creation of a nested transaction will only work on specific
|
||||
* transaction managers. Out of the box, this only applies to the JDBC
|
||||
* DataSourceTransactionManager when working on a JDBC 3.0 driver.
|
||||
|
||||
@@ -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.
|
||||
@@ -54,9 +54,8 @@ import org.springframework.util.ClassUtils;
|
||||
* {@link XmlType}, and write classes annotated with {@link XmlRootElement},
|
||||
* or subclasses thereof.
|
||||
*
|
||||
* <p>Note that if using Spring's Marshaller/Unmarshaller abstractions from the
|
||||
* {@code spring-oxm} module you should can the
|
||||
* {@link MarshallingHttpMessageConverter} instead.
|
||||
* <p>Note: When using Spring's Marshaller/Unmarshaller abstractions from {@code spring-oxm},
|
||||
* you should use the {@link MarshallingHttpMessageConverter} instead.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @author Sebastien Deleuze
|
||||
@@ -72,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) {
|
||||
@@ -80,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}.
|
||||
@@ -100,7 +99,7 @@ public class Jaxb2RootElementHttpMessageConverter extends AbstractJaxb2HttpMessa
|
||||
}
|
||||
|
||||
/**
|
||||
* 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-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.
|
||||
@@ -94,7 +94,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) {
|
||||
@@ -102,14 +102,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,7 +122,7 @@ public class SourceHttpMessageConverter<T extends Source> extends AbstractHttpMe
|
||||
}
|
||||
|
||||
/**
|
||||
* 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-2015 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.
|
||||
@@ -27,7 +27,8 @@ import org.springframework.core.MethodParameter;
|
||||
* For example custom (async) handlers, by default ordered after built-in
|
||||
* handlers, should take precedence over {@code @ResponseBody} or
|
||||
* {@code @ModelAttribute} handling, which should occur once the async value is
|
||||
* ready.
|
||||
* ready. By contrast, built-in (async) handlers are already ordered ahead of
|
||||
* sync handlers.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 4.2
|
||||
@@ -36,9 +37,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(Object returnValue, MethodParameter returnType);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -256,9 +256,8 @@ public abstract class RequestContextUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a read-only {@link Map} with "input" flash attributes saved on a
|
||||
* previous request.
|
||||
* @param request the current request
|
||||
* Return read-only "input" flash attributes from request before redirect.
|
||||
* @param request current request
|
||||
* @return a read-only Map, or {@code null} if not found
|
||||
* @see FlashMap
|
||||
*/
|
||||
@@ -268,20 +267,20 @@ public abstract class RequestContextUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the "output" FlashMap with attributes to save for a subsequent request.
|
||||
* @param request the current request
|
||||
* @return a {@link FlashMap} instance (never {@code null} within a DispatcherServlet request)
|
||||
* @see FlashMap
|
||||
* Return "output" FlashMap to save attributes for request after redirect.
|
||||
* @param request current request
|
||||
* @return a {@link FlashMap} instance, never {@code null} within a
|
||||
* {@code DispatcherServlet}-handled request
|
||||
*/
|
||||
public static FlashMap getOutputFlashMap(HttpServletRequest request) {
|
||||
return (FlashMap) request.getAttribute(DispatcherServlet.OUTPUT_FLASH_MAP_ATTRIBUTE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the FlashMapManager instance to save flash attributes with
|
||||
* before a redirect.
|
||||
* Return the {@code FlashMapManager} instance to save flash attributes.
|
||||
* @param request the current request
|
||||
* @return a {@link FlashMapManager} instance (never {@code null} within a DispatcherServlet request)
|
||||
* @return a {@link FlashMapManager} instance, never {@code null} within a
|
||||
* {@code DispatcherServlet}-handled request
|
||||
*/
|
||||
public static FlashMapManager getFlashMapManager(HttpServletRequest request) {
|
||||
return (FlashMapManager) request.getAttribute(DispatcherServlet.FLASH_MAP_MANAGER_ATTRIBUTE);
|
||||
|
||||
@@ -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.
|
||||
@@ -371,7 +371,7 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
|
||||
* attributes or URI variables from the current request. Model attributes
|
||||
* referenced in the URL are removed from the model.
|
||||
* @param targetUrl the redirect URL
|
||||
* @param model Map that contains model attributes
|
||||
* @param model a Map that contains model attributes
|
||||
* @param currentUriVariables current request URI variables to use
|
||||
* @param encodingScheme the encoding scheme to use
|
||||
* @throws UnsupportedEncodingException if string encoding failed
|
||||
@@ -438,7 +438,7 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
|
||||
* Append query properties to the redirect URL.
|
||||
* Stringifies, URL-encodes and formats model attributes as query properties.
|
||||
* @param targetUrl the StringBuilder to append the properties to
|
||||
* @param model Map that contains model attributes
|
||||
* @param model a Map that contains model attributes
|
||||
* @param encodingScheme the encoding scheme to use
|
||||
* @throws UnsupportedEncodingException if string encoding failed
|
||||
* @see #queryProperties
|
||||
@@ -557,8 +557,9 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
|
||||
|
||||
/**
|
||||
* Determine whether the given model element value is eligible for exposure.
|
||||
* <p>The default implementation considers primitives, Strings, Numbers, Dates,
|
||||
* URIs, URLs and Locale objects as eligible. This can be overridden in subclasses.
|
||||
* <p>The default implementation considers primitives, strings, numbers, dates,
|
||||
* URIs, URLs etc as eligible, according to {@link BeanUtils#isSimpleValueType}.
|
||||
* This can be overridden in subclasses.
|
||||
* @param value the model element value
|
||||
* @return whether the element value is eligible
|
||||
* @see BeanUtils#isSimpleValueType
|
||||
@@ -575,7 +576,6 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
|
||||
* @return the encoded output String
|
||||
* @throws UnsupportedEncodingException if thrown by the JDK URLEncoder
|
||||
* @see java.net.URLEncoder#encode(String, String)
|
||||
* @see java.net.URLEncoder#encode(String)
|
||||
*/
|
||||
protected String urlEncode(String input, String encodingScheme) throws UnsupportedEncodingException {
|
||||
return (input != null ? URLEncoder.encode(input, encodingScheme) : null);
|
||||
@@ -605,7 +605,7 @@ public class RedirectView extends AbstractUrlBasedView implements SmartView {
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a redirect back to the HTTP client
|
||||
* Send a redirect back to the HTTP client.
|
||||
* @param request current HTTP request (allows for reacting to request method)
|
||||
* @param response current HTTP response (for sending response headers)
|
||||
* @param targetUrl the target URL to redirect to
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -47,10 +47,6 @@ public class SimpleWebApplicationContext extends StaticWebApplicationContext {
|
||||
|
||||
@Override
|
||||
public void refresh() throws BeansException {
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.add("commandClass", "org.springframework.tests.sample.beans.TestBean");
|
||||
pvs.add("formView", "form");
|
||||
|
||||
registerSingleton("/locale.do", LocaleChecker.class);
|
||||
|
||||
addMessage("test", Locale.ENGLISH, "test message");
|
||||
@@ -63,7 +59,7 @@ public class SimpleWebApplicationContext extends StaticWebApplicationContext {
|
||||
registerSingleton("handlerMapping", BeanNameUrlHandlerMapping.class);
|
||||
registerSingleton("viewResolver", InternalResourceViewResolver.class);
|
||||
|
||||
pvs = new MutablePropertyValues();
|
||||
MutablePropertyValues pvs = new MutablePropertyValues();
|
||||
pvs.add("location", "org/springframework/web/context/WEB-INF/sessionContext.xml");
|
||||
registerSingleton("viewResolver2", XmlViewResolver.class, pvs);
|
||||
|
||||
@@ -74,10 +70,10 @@ public class SimpleWebApplicationContext extends StaticWebApplicationContext {
|
||||
public static class LocaleChecker implements Controller, LastModified {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
if (!(RequestContextUtils.getWebApplicationContext(request) instanceof SimpleWebApplicationContext)) {
|
||||
|
||||
if (!(RequestContextUtils.findWebApplicationContext(request) instanceof SimpleWebApplicationContext)) {
|
||||
throw new ServletException("Incorrect WebApplicationContext");
|
||||
}
|
||||
if (!(RequestContextUtils.getLocaleResolver(request) instanceof AcceptHeaderLocaleResolver)) {
|
||||
|
||||
Reference in New Issue
Block a user