Polishing

This commit is contained in:
Juergen Hoeller 2015-03-31 17:32:39 +02:00
parent 39bc8b7992
commit f926f6cb3e
3 changed files with 41 additions and 42 deletions

View File

@ -38,7 +38,7 @@ configure(allprojects) { project ->
ext.hibernate3Version = "3.6.10.Final" ext.hibernate3Version = "3.6.10.Final"
ext.hibernate4Version = "4.3.8.Final" ext.hibernate4Version = "4.3.8.Final"
ext.hibval4Version = "4.3.2.Final" ext.hibval4Version = "4.3.2.Final"
ext.hibval5Version = "5.2.0.Beta1" ext.hibval5Version = "5.2.0.Beta1" // to be upgraded to 5.2 final in time for Spring Framework 4.2 GA
ext.hsqldbVersion = "2.3.2" ext.hsqldbVersion = "2.3.2"
ext.httpclientVersion = "4.4" ext.httpclientVersion = "4.4"
ext.httpasyncVersion = "4.0.2" ext.httpasyncVersion = "4.0.2"
@ -1031,7 +1031,7 @@ project("spring-aspects") {
dependencies { dependencies {
aspects(project(":spring-orm")) aspects(project(":spring-orm"))
ajc("org.aspectj:aspectjtools:1.9.0.BETA-1") // for the ability to build on JDK 9, not exposed in the POMs yet ajc("org.aspectj:aspectjtools:1.9.0.BETA-1") // for the ability to build on JDK 9, not exposed in the POMs yet
rt("org.aspectj:aspectjrt:${aspectjVersion}") rt("org.aspectj:aspectjrt:${aspectjVersion}") // regular AspectJ version here, to be exposed in the POMs
compile("org.aspectj:aspectjweaver:${aspectjVersion}") compile("org.aspectj:aspectjweaver:${aspectjVersion}")
provided("org.eclipse.persistence:javax.persistence:2.0.0") provided("org.eclipse.persistence:javax.persistence:2.0.0")
optional(project(":spring-aop")) // for @Async support optional(project(":spring-aop")) // for @Async support

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2015 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -232,7 +232,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
* having a chance to resolve an argument value before the standard * having a chance to resolve an argument value before the standard
* argument handling kicks in. * argument handling kicks in.
*/ */
public void setCustomArgumentResolvers(WebArgumentResolver[] argumentResolvers) { public void setCustomArgumentResolvers(WebArgumentResolver... argumentResolvers) {
this.customArgumentResolvers = argumentResolvers; this.customArgumentResolvers = argumentResolvers;
} }
@ -250,7 +250,7 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
* Any such custom ModelAndViewResolver will kick in first, having a chance to * Any such custom ModelAndViewResolver will kick in first, having a chance to
* resolve an return value before the standard ModelAndView handling kicks in. * resolve an return value before the standard ModelAndView handling kicks in.
*/ */
public void setCustomModelAndViewResolvers(ModelAndViewResolver[] customModelAndViewResolvers) { public void setCustomModelAndViewResolvers(ModelAndViewResolver... customModelAndViewResolvers) {
this.customModelAndViewResolvers = customModelAndViewResolvers; this.customModelAndViewResolvers = customModelAndViewResolvers;
} }
@ -381,7 +381,8 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
if (response instanceof EventResponse) { if (response instanceof EventResponse) {
// Update the existing model, if any, when responding to an event - // Update the existing model, if any, when responding to an event -
// whereas we're replacing the model in case of an action response. // whereas we're replacing the model in case of an action response.
Map<String, Object> existingModel = (Map<String, Object>) request.getPortletSession().getAttribute(IMPLICIT_MODEL_SESSION_ATTRIBUTE); Map<String, Object> existingModel = (Map<String, Object>)
request.getPortletSession().getAttribute(IMPLICIT_MODEL_SESSION_ATTRIBUTE);
if (existingModel != null) { if (existingModel != null) {
existingModel.putAll(implicitModel); existingModel.putAll(implicitModel);
modelToStore = existingModel; modelToStore = existingModel;
@ -812,9 +813,9 @@ public class AnnotationMethodHandlerAdapter extends PortletContentGenerator
} }
} }
} }
return PortletAnnotationMappingUtils.checkRequestMethod(this.methods, request) && return (PortletAnnotationMappingUtils.checkRequestMethod(this.methods, request) &&
PortletAnnotationMappingUtils.checkParameters(this.params, request) && PortletAnnotationMappingUtils.checkParameters(this.params, request) &&
PortletAnnotationMappingUtils.checkHeaders(this.headers, request); PortletAnnotationMappingUtils.checkHeaders(this.headers, request));
} }
public boolean isBetterMatchThan(RequestMappingInfo other) { public boolean isBetterMatchThan(RequestMappingInfo other) {

View File

@ -334,7 +334,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
* <p>Any such custom WebArgumentResolver will kick in first, having a chance to resolve * <p>Any such custom WebArgumentResolver will kick in first, having a chance to resolve
* an argument value before the standard argument handling kicks in. * an argument value before the standard argument handling kicks in.
*/ */
public void setCustomArgumentResolvers(WebArgumentResolver[] argumentResolvers) { public void setCustomArgumentResolvers(WebArgumentResolver... argumentResolvers) {
this.customArgumentResolvers = argumentResolvers; this.customArgumentResolvers = argumentResolvers;
} }
@ -352,7 +352,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
* <p>Any such custom ModelAndViewResolver will kick in first, having a chance to resolve * <p>Any such custom ModelAndViewResolver will kick in first, having a chance to resolve
* a return value before the standard ModelAndView handling kicks in. * a return value before the standard ModelAndView handling kicks in.
*/ */
public void setCustomModelAndViewResolvers(ModelAndViewResolver[] customModelAndViewResolvers) { public void setCustomModelAndViewResolvers(ModelAndViewResolver... customModelAndViewResolvers) {
this.customModelAndViewResolvers = customModelAndViewResolvers; this.customModelAndViewResolvers = customModelAndViewResolvers;
} }
@ -929,7 +929,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
// to be picked up by the RedirectView // to be picked up by the RedirectView
webRequest.getRequest().setAttribute(View.RESPONSE_STATUS_ATTRIBUTE, responseStatus); webRequest.getRequest().setAttribute(View.RESPONSE_STATUS_ATTRIBUTE, responseStatus);
responseArgumentUsed = true; this.responseArgumentUsed = true;
} }
// Invoke custom resolvers if present... // Invoke custom resolvers if present...
@ -992,8 +992,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
} }
} }
private void handleResponseBody(Object returnValue, ServletWebRequest webRequest) private void handleResponseBody(Object returnValue, ServletWebRequest webRequest) throws Exception {
throws Exception {
if (returnValue == null) { if (returnValue == null) {
return; return;
} }
@ -1002,8 +1001,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
writeWithMessageConverters(returnValue, inputMessage, outputMessage); writeWithMessageConverters(returnValue, inputMessage, outputMessage);
} }
private void handleHttpEntityResponse(HttpEntity<?> responseEntity, ServletWebRequest webRequest) private void handleHttpEntityResponse(HttpEntity<?> responseEntity, ServletWebRequest webRequest) throws Exception {
throws Exception {
if (responseEntity == null) { if (responseEntity == null) {
return; return;
} }
@ -1030,6 +1028,7 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
private void writeWithMessageConverters(Object returnValue, private void writeWithMessageConverters(Object returnValue,
HttpInputMessage inputMessage, HttpOutputMessage outputMessage) HttpInputMessage inputMessage, HttpOutputMessage outputMessage)
throws IOException, HttpMediaTypeNotAcceptableException { throws IOException, HttpMediaTypeNotAcceptableException {
List<MediaType> acceptedMediaTypes = inputMessage.getHeaders().getAccept(); List<MediaType> acceptedMediaTypes = inputMessage.getHeaders().getAccept();
if (acceptedMediaTypes.isEmpty()) { if (acceptedMediaTypes.isEmpty()) {
acceptedMediaTypes = Collections.singletonList(MediaType.ALL); acceptedMediaTypes = Collections.singletonList(MediaType.ALL);
@ -1061,7 +1060,6 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
} }
throw new HttpMediaTypeNotAcceptableException(allSupportedMediaTypes); throw new HttpMediaTypeNotAcceptableException(allSupportedMediaTypes);
} }
} }
@ -1079,30 +1077,30 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
private final String[] headers; private final String[] headers;
RequestMappingInfo(String[] patterns, RequestMethod[] methods, String[] params, String[] headers) { RequestMappingInfo(String[] patterns, RequestMethod[] methods, String[] params, String[] headers) {
this.patterns = patterns != null ? patterns : new String[0]; this.patterns = (patterns != null ? patterns : new String[0]);
this.methods = methods != null ? methods : new RequestMethod[0]; this.methods = (methods != null ? methods : new RequestMethod[0]);
this.params = params != null ? params : new String[0]; this.params = (params != null ? params : new String[0]);
this.headers = headers != null ? headers : new String[0]; this.headers = (headers != null ? headers : new String[0]);
} }
public boolean hasPatterns() { public boolean hasPatterns() {
return patterns.length > 0; return (this.patterns.length > 0);
} }
public String[] getPatterns() { public String[] getPatterns() {
return patterns; return this.patterns;
} }
public int getMethodCount() { public int getMethodCount() {
return methods.length; return this.methods.length;
} }
public int getParamCount() { public int getParamCount() {
return params.length; return this.params.length;
} }
public int getHeaderCount() { public int getHeaderCount() {
return headers.length; return this.headers.length;
} }
public boolean matches(HttpServletRequest request) { public boolean matches(HttpServletRequest request) {
@ -1122,8 +1120,8 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
} }
public Set<String> methodNames() { public Set<String> methodNames() {
Set<String> methodNames = new LinkedHashSet<String>(methods.length); Set<String> methodNames = new LinkedHashSet<String>(this.methods.length);
for (RequestMethod method : methods) { for (RequestMethod method : this.methods) {
methodNames.add(method.name()); methodNames.add(method.name());
} }
return methodNames; return methodNames;
@ -1145,18 +1143,18 @@ public class AnnotationMethodHandlerAdapter extends WebContentGenerator
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append(Arrays.asList(patterns)); builder.append(Arrays.asList(this.patterns));
if (methods.length > 0) { if (this.methods.length > 0) {
builder.append(','); builder.append(',');
builder.append(Arrays.asList(methods)); builder.append(Arrays.asList(this.methods));
} }
if (headers.length > 0) { if (this.headers.length > 0) {
builder.append(','); builder.append(',');
builder.append(Arrays.asList(headers)); builder.append(Arrays.asList(this.headers));
} }
if (params.length > 0) { if (this.params.length > 0) {
builder.append(','); builder.append(',');
builder.append(Arrays.asList(params)); builder.append(Arrays.asList(this.params));
} }
return builder.toString(); return builder.toString();
} }