Permalink
Browse files

Polishing

  • Loading branch information...
jhoeller committed Mar 11, 2014
1 parent 8b2b165 commit 4d3ca4319e66e6a9e2470838b8b7627da757e3e5
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2014 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.
@@ -18,27 +18,30 @@
/**
- * A property accessor is able to read (and possibly write) to object properties. The
- * interface places no restrictions and so implementors are free to access properties
- * directly as fields or through getters or in any other way they see as appropriate. A
- * resolver can optionally specify an array of target classes for which it should be
- * called - but if it returns null from getSpecificTargetClasses() then it will be called
- * for all property references and given a chance to determine if it can read or write
- * them. Property resolvers are considered to be ordered and each will be called in turn.
+ * A property accessor is able to read from (and possibly write to) an object's properties.
+ * This interface places no restrictions, and so implementors are free to access properties
+ * directly as fields or through getters or in any other way they see as appropriate.
+ *
+ * <p>A resolver can optionally specify an array of target classes for which it should be
+ * called. However, if it returns {@code null} from {@link #getSpecificTargetClasses()},
+ * it will be called for all property references and given a chance to determine if it
+ * can read or write them.
+ *
+ * <p>Property resolvers are considered to be ordered and each will be called in turn.
* The only rule that affects the call order is that any naming the target class directly
- * in getSpecifiedTargetClasses() will be called first, before the general resolvers.
+ * in {@link #getSpecificTargetClasses()} will be called first, before the general resolvers.
*
* @author Andy Clement
* @since 3.0
*/
public interface PropertyAccessor {
/**
- * Return an array of classes for which this resolver should be called. Returning null
- * indicates this is a general resolver that can be called in an attempt to resolve a
- * property on any type.
- * @return an array of classes that this resolver is suitable for (or null if a
- * general resolver)
+ * Return an array of classes for which this resolver should be called.
+ * <p>>Returning {@code null} indicates this is a general resolver that
+ * can be called in an attempt to resolve a property on any type.
+ * @return an array of classes that this resolver is suitable for
+ * (or {@code null} if a general resolver)
*/
Class<?>[] getSpecificTargetClasses();
@@ -49,13 +52,13 @@
* @param target the target object upon which the property is being accessed
* @param name the name of the property being accessed
* @return true if this resolver is able to read the property
- * @throws AccessException if there is any problem determining whether the property
- * can be read
+ * @throws AccessException if there is any problem determining whether the property can be read
*/
boolean canRead(EvaluationContext context, Object target, String name) throws AccessException;
/**
- * Called to read a property from a specified target object
+ * Called to read a property from a specified target object.
+ * Should only succeed if {@link #canRead} also returns {@code true}.
* @param context the evaluation context in which the access is being attempted
* @param target the target object upon which the property is being accessed
* @param name the name of the property being accessed
@@ -65,20 +68,20 @@
TypedValue read(EvaluationContext context, Object target, String name) throws AccessException;
/**
- * Called to determine if a resolver instance is able to write to a specified property
- * on a specified target object.
+ * Called to determine if a resolver instance is able to write to a specified
+ * property on a specified target object.
* @param context the evaluation context in which the access is being attempted
* @param target the target object upon which the property is being accessed
* @param name the name of the property being accessed
* @return true if this resolver is able to write to the property
- * @throws AccessException if there is any problem determining whether the property
- * can be written to
+ * @throws AccessException if there is any problem determining whether the
+ * property can be written to
*/
boolean canWrite(EvaluationContext context, Object target, String name) throws AccessException;
/**
- * Called to write to a property on a specified target object. Should only succeed if
- * canWrite() also returns true.
+ * Called to write to a property on a specified target object.
+ * Should only succeed if {@link #canWrite} also returns {@code true}.
* @param context the evaluation context in which the access is being attempted
* @param target the target object upon which the property is being accessed
* @param name the name of the property being accessed
@@ -31,6 +31,7 @@
* that use JAXB2. Creates {@link JAXBContext} object lazily.
*
* @author Arjen Poutsma
+ * @author Rossen Stoyanchev
* @since 3.0
*/
public abstract class AbstractJaxb2HttpMessageConverter<T> extends AbstractXmlHttpMessageConverter<T> {
@@ -61,8 +62,8 @@ protected final Marshaller createMarshaller(Class<?> clazz) {
* Customize the {@link Marshaller} created by this
* message converter before using it to write the object to the output.
* @param marshaller the marshaller to customize
- * @see #createMarshaller(Class)
* @since 4.0.3
+ * @see #createMarshaller(Class)
*/
protected void customizeMarshaller(Marshaller marshaller) {
}
@@ -90,8 +91,8 @@ protected final Unmarshaller createUnmarshaller(Class<?> clazz) throws JAXBExcep
* Customize the {@link Unmarshaller} created by this
* message converter before using it to read the object from the input.
* @param unmarshaller the unmarshaller to customize
- * @see #createUnmarshaller(Class)
* @since 4.0.3
+ * @see #createUnmarshaller(Class)
*/
protected void customizeUnmarshaller(Unmarshaller unmarshaller) {
}
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 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.
@@ -22,7 +22,6 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
-
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.HttpHeaders;
@@ -116,11 +115,12 @@ private void writeHeaders() {
}
}
+
/**
* Extends HttpHeaders with the ability to look up headers already present in
* the underlying HttpServletResponse.
*
- * The intent is merely to expose what is available through the HttpServletResponse
+ * <p>The intent is merely to expose what is available through the HttpServletResponse
* i.e. the ability to look up specific header values by name. All other
* map-related operations (e.g. iteration, removal, etc) apply only to values
* added directly through HttpHeaders methods.
@@ -144,8 +144,8 @@ public String getFirst(String headerName) {
@Override
public List<String> get(Object key) {
+ Assert.isInstanceOf(String.class, key, "Key must be a String-based header name");
- Assert.isInstanceOf(String.class, key, "key must be a String-based header name");
Collection<String> values1 = servletResponse.getHeaders((String) key);
boolean isEmpty1 = CollectionUtils.isEmpty(values1);
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2014 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.
@@ -277,7 +277,7 @@ public static Object getSessionAttribute(HttpServletRequest request, String name
* @throws IllegalStateException if the session attribute could not be found
*/
public static Object getRequiredSessionAttribute(HttpServletRequest request, String name)
- throws IllegalStateException {
+ throws IllegalStateException {
Object attr = getSessionAttribute(request, name);
if (attr == null) {
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 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.
@@ -25,7 +25,6 @@
*
* @author Rossen Stoyanchev
* @since 3.1
- *
* @see FlashMap
*/
public interface FlashMapManager {
@@ -46,7 +45,7 @@
/**
* Save the given FlashMap, in some underlying storage and set the start
* of its expiration period.
- * <p><strong>Note:</strong> Invoke this method prior to a redirect in order
+ * <p><strong>NOTE:</strong> Invoke this method prior to a redirect in order
* to allow saving the FlashMap in the HTTP session or in a response
* cookie before the response is committed.
* @param flashMap the FlashMap to save
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.web.servlet.config.annotation;
import org.springframework.util.PathMatcher;
@@ -29,11 +30,16 @@
public class PathMatchConfigurer {
private Boolean useSuffixPatternMatch;
+
private Boolean useTrailingSlashMatch;
+
private Boolean useRegisteredSuffixPatternMatch;
+
private UrlPathHelper urlPathHelper;
+
private PathMatcher pathMatcher;
+
/**
* Whether to use suffix pattern match (".*") when matching patterns to
* requests. If enabled a method mapped to "/users" also matches to "/users.*".
@@ -95,23 +101,25 @@ public PathMatchConfigurer setPathMatcher(PathMatcher pathMatcher) {
return this;
}
+
public Boolean isUseSuffixPatternMatch() {
- return useSuffixPatternMatch;
+ return this.useSuffixPatternMatch;
}
public Boolean isUseTrailingSlashMatch() {
- return useTrailingSlashMatch;
+ return this.useTrailingSlashMatch;
}
public Boolean isUseRegisteredSuffixPatternMatch() {
- return useRegisteredSuffixPatternMatch;
+ return this.useRegisteredSuffixPatternMatch;
}
public UrlPathHelper getUrlPathHelper() {
- return urlPathHelper;
+ return this.urlPathHelper;
}
public PathMatcher getPathMatcher() {
- return pathMatcher;
+ return this.pathMatcher;
}
+
}
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2014 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.
@@ -26,7 +26,6 @@
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
-
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
@@ -114,8 +113,8 @@
* @see HandlerMethodArgumentResolver
* @see HandlerMethodReturnValueHandler
*/
-public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter implements BeanFactoryAware,
- InitializingBean {
+public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
+ implements BeanFactoryAware, InitializingBean {
private List<HandlerMethodArgumentResolver> customArgumentResolvers;
@@ -698,7 +697,7 @@ private SessionAttributesHandler getSessionAttributesHandler(HandlerMethod handl
Class<?> handlerType = handlerMethod.getBeanType();
SessionAttributesHandler sessionAttrHandler = this.sessionAttributesHandlerCache.get(handlerType);
if (sessionAttrHandler == null) {
- synchronized(this.sessionAttributesHandlerCache) {
+ synchronized (this.sessionAttributesHandlerCache) {
sessionAttrHandler = this.sessionAttributesHandlerCache.get(handlerType);
if (sessionAttrHandler == null) {
sessionAttrHandler = new SessionAttributesHandler(handlerType, sessionAttributeStore);
@@ -710,7 +709,8 @@ private SessionAttributesHandler getSessionAttributesHandler(HandlerMethod handl
}
/**
- * Invoke the {@link RequestMapping} handler method preparing a {@link ModelAndView} if view resolution is required.
+ * Invoke the {@link RequestMapping} handler method preparing a {@link ModelAndView}
+ * if view resolution is required.
*/
private ModelAndView invokeHandleMethod(HttpServletRequest request,
HttpServletResponse response, HandlerMethod handlerMethod) throws Exception {
@@ -778,7 +778,7 @@ private ModelFactory getModelFactory(HandlerMethod handlerMethod, WebDataBinderF
List<InvocableHandlerMethod> attrMethods = new ArrayList<InvocableHandlerMethod>();
// Global methods first
for (Entry<ControllerAdviceBean, Set<Method>> entry : this.modelAttributeAdviceCache.entrySet()) {
- if(entry.getKey().isApplicableToBeanType(handlerType)) {
+ if (entry.getKey().isApplicableToBeanType(handlerType)) {
Object bean = entry.getKey().resolveBean();
for (Method method : entry.getValue()) {
attrMethods.add(createModelAttributeMethod(binderFactory, bean, method));
@@ -810,7 +810,7 @@ private WebDataBinderFactory getDataBinderFactory(HandlerMethod handlerMethod) t
List<InvocableHandlerMethod> initBinderMethods = new ArrayList<InvocableHandlerMethod>();
// Global methods first
for (Entry<ControllerAdviceBean, Set<Method>> entry : this.initBinderAdviceCache .entrySet()) {
- if(entry.getKey().isApplicableToBeanType(handlerType)) {
+ if (entry.getKey().isApplicableToBeanType(handlerType)) {
Object bean = entry.getKey().resolveBean();
for (Method method : entry.getValue()) {
initBinderMethods.add(createInitBinderMethod(bean, method));
@@ -850,7 +850,6 @@ private ModelAndView getModelAndView(ModelAndViewContainer mavContainer,
ModelFactory modelFactory, NativeWebRequest webRequest) throws Exception {
modelFactory.updateModel(webRequest, mavContainer);
-
if (mavContainer.isRequestHandled()) {
return null;
}
Oops, something went wrong.

0 comments on commit 4d3ca43

Please sign in to comment.