Polishing

(cherry picked from commit 3726c6f)
This commit is contained in:
Juergen Hoeller
2016-10-21 12:26:27 +02:00
parent adb9dc7ede
commit 9de28d640e
32 changed files with 86 additions and 105 deletions

View File

@@ -127,7 +127,7 @@ public class ResourceRegionHttpMessageConverter extends AbstractGenericHttpMessa
Long resourceLength = region.getResource().contentLength();
end = Math.min(end, resourceLength - 1);
long rangeLength = end - start + 1;
responseHeaders.add("Content-Range", "bytes " + start + "-" + end + "/" + resourceLength);
responseHeaders.add("Content-Range", "bytes " + start + '-' + end + '/' + resourceLength);
responseHeaders.setContentLength(rangeLength);
InputStream in = region.getResource().getInputStream();
try {
@@ -166,7 +166,7 @@ public class ResourceRegionHttpMessageConverter extends AbstractGenericHttpMessa
}
Long resourceLength = region.getResource().contentLength();
end = Math.min(end, resourceLength - 1);
print(out, "Content-Range: bytes " + start + "-" + end + "/" + resourceLength);
print(out, "Content-Range: bytes " + start + '-' + end + '/' + resourceLength);
println(out);
println(out);
// Printing content

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2016 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.
@@ -182,7 +182,7 @@ public class HessianExporter extends RemoteExporter implements InitializingBean
major = isToUse.read();
minor = isToUse.read();
if (major != 0x02) {
throw new IOException("Version " + major + "." + minor + " is not understood");
throw new IOException("Version " + major + '.' + minor + " is not understood");
}
in = new Hessian2Input(isToUse);
out = new Hessian2Output(osToUse);

View File

@@ -144,6 +144,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
* Set whether the request payload (body) should be included in the log message.
* <p>Should be configured using an {@code <init-param>} for parameter name
* "includePayload" in the filter definition in {@code web.xml}.
* @since 3.0
*/
public void setIncludePayload(boolean includePayload) {
this.includePayload = includePayload;
@@ -151,6 +152,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
/**
* Return whether the request payload (body) should be included in the log message.
* @since 3.0
*/
protected boolean isIncludePayload() {
return this.includePayload;
@@ -159,6 +161,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
/**
* Sets the maximum length of the payload body to be included in the log message.
* Default is 50 characters.
* @since 3.0
*/
public void setMaxPayloadLength(int maxPayloadLength) {
Assert.isTrue(maxPayloadLength >= 0, "'maxPayloadLength' should be larger than or equal to 0");
@@ -167,6 +170,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter
/**
* Return the maximum length of the payload body to be included in the log message.
* @since 3.0
*/
protected int getMaxPayloadLength() {
return this.maxPayloadLength;

View File

@@ -24,6 +24,7 @@ import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.GenericTypeResolver;
import org.springframework.core.MethodParameter;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.support.SessionStatus;
@@ -127,15 +128,13 @@ public class InvocableHandlerMethod extends HandlerMethod {
Object[] args = getMethodArgumentValues(request, mavContainer, providedArgs);
if (logger.isTraceEnabled()) {
StringBuilder sb = new StringBuilder("Invoking [");
sb.append(getBeanType().getSimpleName()).append(".");
sb.append(getMethod().getName()).append("] method with arguments ");
sb.append(Arrays.asList(args));
logger.trace(sb.toString());
logger.trace("Invoking '" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
"' with arguments " + Arrays.toString(args));
}
Object returnValue = doInvoke(args);
if (logger.isTraceEnabled()) {
logger.trace("Method [" + getMethod().getName() + "] returned [" + returnValue + "]");
logger.trace("Method [" + ClassUtils.getQualifiedMethodName(getMethod(), getBeanType()) +
"] returned [" + returnValue + "]");
}
return returnValue;
}