diff --git a/spring-oxm/src/main/java/org/springframework/oxm/jibx/JibxMarshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/jibx/JibxMarshaller.java index c30fce3ab4..5e19c3805d 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/jibx/JibxMarshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/jibx/JibxMarshaller.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -234,7 +234,7 @@ public class JibxMarshaller extends AbstractMarshaller implements InitializingBe public boolean supports(Class> clazz) { - Assert.notNull(clazz, "'clazz' must not be null"); + Assert.notNull(clazz, "Class must not be null"); if (this.targetClass != null) { return this.targetClass.equals(clazz); } diff --git a/spring-web/src/main/java/org/springframework/http/HttpHeaders.java b/spring-web/src/main/java/org/springframework/http/HttpHeaders.java index 1146533fd4..70d6ec3eb8 100644 --- a/spring-web/src/main/java/org/springframework/http/HttpHeaders.java +++ b/spring-web/src/main/java/org/springframework/http/HttpHeaders.java @@ -1,11 +1,11 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -43,7 +43,8 @@ import org.springframework.util.StringUtils; /** * Represents HTTP request and response headers, mapping string header names to list of string values. * - *
In addition to the normal methods defined by {@link Map}, this class offers the following convenience methods: + *
In addition to the normal methods defined by {@link Map}, this class offers the following + * convenience methods: *
Returns an empty list when the acceptable media types are unspecified.
- * @return the acceptable media types
*/
public List Returns an empty set when the allowed methods are unspecified.
- * @return the allowed methods
*/
public Set Returns -1 when the content-length is unknown.
- * @return the content length
*/
public long getContentLength() {
String value = getFirst(CONTENT_LENGTH);
@@ -285,8 +285,8 @@ public class HttpHeaders implements MultiValueMap Returns {@code null} when the content-type is unknown.
- * @return the content type
*/
public MediaType getContentType() {
String value = getFirst(CONTENT_TYPE);
@@ -305,18 +305,20 @@ public class HttpHeaders implements MultiValueMap The date should be specified as the number of milliseconds since January 1, 1970 GMT.
- * @param date the date
+ * Set the date and time at which the message was created, as specified
+ * by the {@code Date} header.
+ * The date should be specified as the number of milliseconds since
+ * January 1, 1970 GMT.
*/
public void setDate(long date) {
setDate(DATE, date);
}
/**
- * Returns the date and time at which the message was created, as specified by the {@code Date} header.
- * The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
- * @return the creation date/time
+ * Return the date and time at which the message was created, as specified
+ * by the {@code Date} header.
+ * The date is returned as the number of milliseconds since
+ * January 1, 1970 GMT. Returns -1 when the date is unknown.
* @throws IllegalArgumentException if the value can't be converted to a date
*/
public long getDate() {
@@ -324,41 +326,39 @@ public class HttpHeaders implements MultiValueMap The date should be specified as the number of milliseconds since January 1, 1970 GMT.
- * @param expires the new expires header value
+ * Set the date and time at which the message is no longer valid,
+ * as specified by the {@code Expires} header.
+ * The date should be specified as the number of milliseconds since
+ * January 1, 1970 GMT.
*/
public void setExpires(long expires) {
setDate(EXPIRES, expires);
}
/**
- * Returns the date and time at which the message is no longer valid, as specified by
- * the {@code Expires} header.
- * The date is returned as the number of milliseconds since January 1, 1970 GMT.
- * Returns -1 when the date is unknown.
- *
- * @return the expires value
+ * Return the date and time at which the message is no longer valid,
+ * as specified by the {@code Expires} header.
+ * The date is returned as the number of milliseconds since
+ * January 1, 1970 GMT. Returns -1 when the date is unknown.
*/
public long getExpires() {
try {
@@ -370,18 +370,18 @@ public class HttpHeaders implements MultiValueMap The date should be specified as the number of milliseconds since January 1, 1970 GMT.
- * @param ifModifiedSince the new value of the header
+ * Set the (new) value of the {@code If-Modified-Since} header.
+ * The date should be specified as the number of milliseconds since
+ * January 1, 1970 GMT.
*/
public void setIfModifiedSince(long ifModifiedSince) {
setDate(IF_MODIFIED_SINCE, ifModifiedSince);
}
/**
- * Returns the value of the {@code IfModifiedSince} header.
- * The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
- * @return the header value
+ * Return the value of the {@code IfModifiedSince} header.
+ * The date is returned as the number of milliseconds since
+ * January 1, 1970 GMT. Returns -1 when the date is unknown.
* @deprecated use {@link #getIfModifiedSince()}
*/
@Deprecated
@@ -390,25 +390,23 @@ public class HttpHeaders implements MultiValueMap The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
- * @return the header value
+ * Return the value of the {@code If-Modified-Since} header.
+ * The date is returned as the number of milliseconds since
+ * January 1, 1970 GMT. Returns -1 when the date is unknown.
*/
public long getIfModifiedSince() {
return getFirstDate(IF_MODIFIED_SINCE);
}
/**
- * Sets the (new) value of the {@code If-None-Match} header.
- * @param ifNoneMatch the new value of the header
+ * Set the (new) value of the {@code If-None-Match} header.
*/
public void setIfNoneMatch(String ifNoneMatch) {
set(IF_NONE_MATCH, ifNoneMatch);
}
/**
- * Sets the (new) values of the {@code If-None-Match} header.
- * @param ifNoneMatchList the new value of the header
+ * Set the (new) values of the {@code If-None-Match} header.
*/
public void setIfNoneMatch(List The date should be specified as the number of milliseconds since January 1, 1970 GMT.
- * @param lastModified the last modified date
+ * Set the time the resource was last changed, as specified by the
+ * {@code Last-Modified} header.
+ * The date should be specified as the number of milliseconds since
+ * January 1, 1970 GMT.
*/
public void setLastModified(long lastModified) {
setDate(LAST_MODIFIED, lastModified);
}
/**
- * Returns the time the resource was last changed, as specified by the {@code Last-Modified} header.
- * The date is returned as the number of milliseconds since January 1, 1970 GMT. Returns -1 when the date is unknown.
- * @return the last modified date
+ * Return the time the resource was last changed, as specified by the
+ * {@code Last-Modified} header.
+ * The date is returned as the number of milliseconds since
+ * January 1, 1970 GMT. Returns -1 when the date is unknown.
*/
public long getLastModified() {
return getFirstDate(LAST_MODIFIED);
}
/**
- * Set the (new) location of a resource, as specified by the {@code Location} header.
- * @param location the location
+ * Set the (new) location of a resource,
+ * as specified by the {@code Location} header.
*/
public void setLocation(URI location) {
set(LOCATION, location.toASCIIString());
}
/**
- * Return the (new) location of a resource, as specified by the {@code Location} header.
+ * Return the (new) location of a resource
+ * as specified by the {@code Location} header.
* Returns {@code null} when the location is unknown.
- * @return the location
*/
public URI getLocation() {
String value = getFirst(LOCATION);
@@ -475,16 +474,14 @@ public class HttpHeaders implements MultiValueMap Called from {@link #createRequest(URI, HttpMethod)}.
* @param uri the URI to create a request for
* @param httpMethod the HTTP method to execute
diff --git a/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java b/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java
index 0131cfa50f..abbd16c00a 100644
--- a/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java
+++ b/spring-web/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java
@@ -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");
* you may not use this file except in compliance with the License.
@@ -43,9 +43,9 @@ import org.springframework.http.HttpMethod;
import org.springframework.util.Assert;
/**
- * {@link org.springframework.http.client.ClientHttpRequestFactory} implementation that uses
- * Apache HttpComponents HttpClient
- * to create requests.
+ * {@link org.springframework.http.client.ClientHttpRequestFactory} implementation that
+ * uses Apache HttpComponents
+ * HttpClient to create requests.
*
* Allows to use a pre-configured {@link HttpClient} instance -
* potentially with authentication, HTTP connection pooling, etc.
@@ -144,20 +144,20 @@ public class HttpComponentsClientHttpRequestFactory implements ClientHttpRequest
switch (httpMethod) {
case GET:
return new HttpGet(uri);
- case DELETE:
- return new HttpDelete(uri);
case HEAD:
return new HttpHead(uri);
- case OPTIONS:
- return new HttpOptions(uri);
case POST:
return new HttpPost(uri);
case PUT:
return new HttpPut(uri);
- case TRACE:
- return new HttpTrace(uri);
case PATCH:
return new HttpPatch(uri);
+ case DELETE:
+ return new HttpDelete(uri);
+ case OPTIONS:
+ return new HttpOptions(uri);
+ case TRACE:
+ return new HttpTrace(uri);
default:
throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod);
}
@@ -183,6 +183,7 @@ public class HttpComponentsClientHttpRequestFactory implements ClientHttpRequest
return null;
}
+
/**
* Shutdown hook that closes the underlying
* {@link org.apache.http.conn.ClientConnectionManager ClientConnectionManager}'s
diff --git a/spring-web/src/main/java/org/springframework/http/client/InterceptingClientHttpRequest.java b/spring-web/src/main/java/org/springframework/http/client/InterceptingClientHttpRequest.java
index a422614fe9..f10f5d512c 100644
--- a/spring-web/src/main/java/org/springframework/http/client/InterceptingClientHttpRequest.java
+++ b/spring-web/src/main/java/org/springframework/http/client/InterceptingClientHttpRequest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2013 the original author or authors.
+ * Copyright 2002-2015 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,49 +42,48 @@ class InterceptingClientHttpRequest extends AbstractBufferingClientHttpRequest {
private URI uri;
+
protected InterceptingClientHttpRequest(ClientHttpRequestFactory requestFactory,
- List These methods default to calling through to the wrapped request object.
*
* @author Arjen Poutsma
* @since 3.1
@@ -36,38 +38,38 @@ public class HttpRequestWrapper implements HttpRequest {
/**
- * Creates a new {@code HttpRequest} wrapping the given request object.
- *
+ * Create a new {@code HttpRequest} wrapping the given request object.
* @param request the request object to be wrapped
*/
public HttpRequestWrapper(HttpRequest request) {
- Assert.notNull(request, "'request' must not be null");
+ Assert.notNull(request, "HttpRequest must not be null");
this.request = request;
}
+
/**
- * Returns the wrapped request.
+ * Return the wrapped request.
*/
public HttpRequest getRequest() {
- return request;
+ return this.request;
}
/**
- * Returns the method of the wrapped request.
+ * Return the method of the wrapped request.
*/
public HttpMethod getMethod() {
return this.request.getMethod();
}
/**
- * Returns the URI of the wrapped request.
+ * Return the URI of the wrapped request.
*/
public URI getURI() {
return this.request.getURI();
}
/**
- * Returns the headers of the wrapped request.
+ * Return the headers of the wrapped request.
*/
public HttpHeaders getHeaders() {
return this.request.getHeaders();
diff --git a/spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java b/spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java
index a8117f933e..d0d7d99f87 100644
--- a/spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java
+++ b/spring-web/src/main/java/org/springframework/http/server/ServletServerHttpRequest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2014 the original author or authors.
+ * Copyright 2002-2015 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.
@@ -142,18 +142,21 @@ public class ServletServerHttpRequest implements ServerHttpRequest {
}
}
- private boolean isFormPost(HttpServletRequest request) {
- return (request.getContentType() != null && request.getContentType().contains(FORM_CONTENT_TYPE) &&
+
+
+ private static boolean isFormPost(HttpServletRequest request) {
+ String contentType = request.getContentType();
+ return (contentType != null && contentType.contains(FORM_CONTENT_TYPE) &&
METHOD_POST.equalsIgnoreCase(request.getMethod()));
}
/**
* Use {@link javax.servlet.ServletRequest#getParameterMap()} to reconstruct the
* body of a form 'POST' providing a predictable outcome as opposed to reading
- * from the body, which can fail if any other code has used ServletRequest
- * to access a parameter thus causing the input stream to be "consumed".
+ * from the body, which can fail if any other code has used the ServletRequest
+ * to access a parameter, thus causing the input stream to be "consumed".
*/
- private InputStream getBodyFromServletRequestParameters(HttpServletRequest request) throws IOException {
+ private static InputStream getBodyFromServletRequestParameters(HttpServletRequest request) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
Writer writer = new OutputStreamWriter(bos, FORM_CHARSET);
diff --git a/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMethod.java b/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMethod.java
index 814687ca65..80bd4b1c01 100644
--- a/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMethod.java
+++ b/spring-web/src/main/java/org/springframework/web/bind/annotation/RequestMethod.java
@@ -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");
* you may not use this file except in compliance with the License.
@@ -17,16 +17,14 @@
package org.springframework.web.bind.annotation;
/**
- * Java 5 enumeration of HTTP request methods. Intended for use
- * with the {@link RequestMapping#method()} attribute of the
- * {@link RequestMapping} annotation.
+ * Java 5 enumeration of HTTP request methods. Intended for use with the
+ * {@link RequestMapping#method()} attribute of the {@link RequestMapping} annotation.
*
* Note that, by default, {@link org.springframework.web.servlet.DispatcherServlet}
* supports GET, HEAD, POST, PUT, PATCH and DELETE only. DispatcherServlet will
- * process TRACE and OPTIONS with the default HttpServlet behavior unless
- * explicitly told to dispatch those request types as well: Check out
- * the "dispatchOptionsRequest" and "dispatchTraceRequest" properties,
- * switching them to "true" if necessary.
+ * process TRACE and OPTIONS with the default HttpServlet behavior unless explicitly
+ * told to dispatch those request types as well: Check out the "dispatchOptionsRequest"
+ * and "dispatchTraceRequest" properties, switching them to "true" if necessary.
*
* @author Juergen Hoeller
* @since 2.5
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java
index 96a6e88a07..e3375717b5 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java
@@ -814,15 +814,13 @@ public abstract class FrameworkServlet extends HttpServletBean {
/**
- * Override the parent class implementation in order to intercept PATCH
- * requests.
+ * Override the parent class implementation in order to intercept PATCH requests.
*/
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- String method = request.getMethod();
- if (method.equalsIgnoreCase(RequestMethod.PATCH.name())) {
+ if (RequestMethod.PATCH.name().equalsIgnoreCase(request.getMethod())) {
processRequest(request, response);
}
else {
diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractMediaTypeExpression.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractMediaTypeExpression.java
index bc65b27de2..ba0be31ad3 100644
--- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractMediaTypeExpression.java
+++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/AbstractMediaTypeExpression.java
@@ -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");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.springframework.http.MediaType;
import org.springframework.web.HttpMediaTypeException;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -40,34 +41,36 @@ abstract class AbstractMediaTypeExpression implements Comparable