Merge branch '3.2.x'

* 3.2.x: (28 commits)
  Hide 'doc' changes from jdiff reports
  Document @Bean 'lite' mode vs @Configuration
  Final preparations for 3.2.2
  Remove Tiles 3 configuration method
  Polishing
  Extracted buildRequestAttributes template method from FrameworkServlet
  Added "beforeExistingAdvisors" flag to AbstractAdvisingBeanPostProcessor
  Minor refinements along the way of researching static CGLIB callbacks
  Compare Kind references before checking log levels
  Polish Javadoc in RequestAttributes
  Fix copy-n-paste errors in NativeWebRequest
  Fix issue with restoring included attributes
  Add additional test for daylight savings glitch
  Document context hierarchy support in the TCF
  Fix test for daylight savings glitch
  Make the methodParameter field of HandlerMethod final
  Disable AsyncTests in spring-test-mvc
  Reformat the testing chapter
  Document context hierarchy support in the TCF
  Document context hierarchy support in the TCF
  ...
This commit is contained in:
Phillip Webb
2013-03-13 14:01:46 -07:00
267 changed files with 8384 additions and 6246 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
@@ -56,13 +56,13 @@ public interface NativeWebRequest extends WebRequest {
<T> T getNativeRequest(Class<T> requiredType);
/**
* Return the underlying native request object, if available.
* Return the underlying native response object, if available.
* @param requiredType the desired type of response object
* @return the matching response object, or {@code null} if none
* of that type is available
* @see javax.servlet.http.HttpServletRequest
* @see javax.portlet.ActionRequest
* @see javax.portlet.RenderRequest
* @see javax.servlet.http.HttpServletResponse
* @see javax.portlet.ActionResponse
* @see javax.portlet.RenderResponse
*/
<T> T getNativeResponse(Class<T> requiredType);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
@@ -135,14 +135,14 @@ public interface RequestAttributes {
/**
* Return an id for the current underlying session.
* @return the session id as String (never {@code null}
* @return the session id as String (never {@code null})
*/
String getSessionId();
/**
* Expose the best available mutex for the underlying session:
* that is, an object to synchronize on for the underlying session.
* @return the session mutex to use (never {@code null}
* @return the session mutex to use (never {@code null})
*/
Object getSessionMutex();

View File

@@ -54,7 +54,7 @@ public class HandlerMethod {
private final BeanFactory beanFactory;
private MethodParameter[] parameters;
private final MethodParameter[] parameters;
private final Method bridgedMethod;
@@ -69,6 +69,16 @@ public class HandlerMethod {
this.beanFactory = null;
this.method = method;
this.bridgedMethod = BridgeMethodResolver.findBridgedMethod(method);
this.parameters = initMethodParameters();
}
private MethodParameter[] initMethodParameters() {
int count = this.bridgedMethod.getParameterTypes().length;
MethodParameter[] result = new MethodParameter[count];
for (int i = 0; i < count; i++) {
result[i] = new HandlerMethodParameter(i);
}
return result;
}
/**
@@ -82,6 +92,7 @@ public class HandlerMethod {
this.beanFactory = null;
this.method = bean.getClass().getMethod(methodName, parameterTypes);
this.bridgedMethod = BridgeMethodResolver.findBridgedMethod(method);
this.parameters = initMethodParameters();
}
/**
@@ -99,10 +110,11 @@ public class HandlerMethod {
this.beanFactory = beanFactory;
this.method = method;
this.bridgedMethod = BridgeMethodResolver.findBridgedMethod(method);
this.parameters = initMethodParameters();
}
/**
* Create an instance from another {@code HandlerMethod}.
* Copy constructor for use in sub-classes.
*/
protected HandlerMethod(HandlerMethod handlerMethod) {
Assert.notNull(handlerMethod, "HandlerMethod is required");
@@ -113,6 +125,19 @@ public class HandlerMethod {
this.parameters = handlerMethod.parameters;
}
/**
* Re-create HandlerMethod with the resolved handler.
*/
private HandlerMethod(HandlerMethod handlerMethod, Object handler) {
Assert.notNull(handlerMethod, "handlerMethod is required");
Assert.notNull(handler, "handler is required");
this.bean = handler;
this.beanFactory = handlerMethod.beanFactory;
this.method = handlerMethod.method;
this.bridgedMethod = handlerMethod.bridgedMethod;
this.parameters = handlerMethod.parameters;
}
/**
* Returns the bean for this handler method.
*/
@@ -150,13 +175,6 @@ public class HandlerMethod {
* Returns the method parameters for this handler method.
*/
public MethodParameter[] getMethodParameters() {
if (this.parameters == null) {
int parameterCount = this.bridgedMethod.getParameterTypes().length;
this.parameters = new MethodParameter[parameterCount];
for (int i = 0; i < parameterCount; i++) {
this.parameters[i] = new HandlerMethodParameter(i);
}
}
return this.parameters;
}
@@ -201,9 +219,7 @@ public class HandlerMethod {
String beanName = (String) this.bean;
handler = this.beanFactory.getBean(beanName);
}
HandlerMethod handlerMethod = new HandlerMethod(handler, this.method);
handlerMethod.parameters = getMethodParameters();
return handlerMethod;
return new HandlerMethod(this, handler);
}
@Override

View File

@@ -48,6 +48,7 @@ import org.springframework.web.util.HierarchicalUriComponents.PathComponent;
* @author Arjen Poutsma
* @author Rossen Stoyanchev
* @author Phillip Webb
* @author Oliver Gierke
* @since 3.1
* @see #newInstance()
* @see #fromPath(String)
@@ -204,7 +205,10 @@ public class UriComponentsBuilder {
builder.path(path);
builder.query(query);
}
builder.fragment(fragment);
if (StringUtils.hasText(fragment)) {
builder.fragment(fragment);
}
return builder;
}