mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Polishing
This commit is contained in:
+5
-4
@@ -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.
|
||||
@@ -55,7 +55,7 @@ public class MarshallingHttpMessageConverter extends AbstractXmlHttpMessageConve
|
||||
/**
|
||||
* Construct a new {@code MarshallingHttpMessageConverter} with no {@link Marshaller} or
|
||||
* {@link Unmarshaller} set. The Marshaller and Unmarshaller must be set after construction
|
||||
* by invoking {@link #setMarshaller(Marshaller)} and {@link #setUnmarshaller(Unmarshaller)} .
|
||||
* by invoking {@link #setMarshaller(Marshaller)} and {@link #setUnmarshaller(Unmarshaller)}.
|
||||
*/
|
||||
public MarshallingHttpMessageConverter() {
|
||||
}
|
||||
@@ -104,14 +104,15 @@ public class MarshallingHttpMessageConverter extends AbstractXmlHttpMessageConve
|
||||
this.unmarshaller = unmarshaller;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canRead(Class<?> clazz, MediaType mediaType) {
|
||||
return canRead(mediaType) && (this.unmarshaller != null) && this.unmarshaller.supports(clazz);
|
||||
return (canRead(mediaType) && this.unmarshaller != null && this.unmarshaller.supports(clazz));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrite(Class<?> clazz, MediaType mediaType) {
|
||||
return canWrite(mediaType) && (this.marshaller != null) && this.marshaller.supports(clazz);
|
||||
return (canWrite(mediaType) && this.marshaller != null && this.marshaller.supports(clazz));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -55,7 +55,6 @@ import org.springframework.web.multipart.MultipartResolver;
|
||||
* @author Arjen Poutsma
|
||||
* @author Sam Brannen
|
||||
* @since 3.1
|
||||
*
|
||||
* @see RequestParam
|
||||
* @see org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
|
||||
*/
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -262,7 +262,8 @@ public class RequestParamMethodArgumentResolver extends AbstractNamedValueMethod
|
||||
}
|
||||
|
||||
RequestParam requestParam = parameter.getParameterAnnotation(RequestParam.class);
|
||||
String name = (requestParam == null || StringUtils.isEmpty(requestParam.name()) ? parameter.getParameterName() : requestParam.name());
|
||||
String name = (requestParam == null || StringUtils.isEmpty(requestParam.name()) ?
|
||||
parameter.getParameterName() : requestParam.name());
|
||||
|
||||
if (value == null) {
|
||||
builder.queryParam(name);
|
||||
|
||||
+10
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 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.
|
||||
@@ -24,27 +24,28 @@ import org.springframework.web.multipart.MultipartResolver;
|
||||
* Raised when the part of a "multipart/form-data" request identified by its
|
||||
* name cannot be found.
|
||||
*
|
||||
* <p>This may be because the request is not a multipart/form-data
|
||||
*
|
||||
* either because the part is not present in the request, or
|
||||
* because the web application is not configured correctly for processing
|
||||
* multipart requests -- e.g. no {@link MultipartResolver}.
|
||||
* <p>This may be because the request is not a multipart/form-data request,
|
||||
* because the part is not present in the request, or because the web
|
||||
* application is not configured correctly for processing multipart requests,
|
||||
* e.g. no {@link MultipartResolver}.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
* @since 3.1
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MissingServletRequestPartException extends ServletException {
|
||||
|
||||
private static final long serialVersionUID = -1255077391966870705L;
|
||||
|
||||
private final String partName;
|
||||
|
||||
|
||||
public MissingServletRequestPartException(String partName) {
|
||||
super("Required request part '" + partName + "' is not present.");
|
||||
super("Required request part '" + partName + "' is not present");
|
||||
this.partName = partName;
|
||||
}
|
||||
|
||||
|
||||
public String getRequestPartName() {
|
||||
return this.partName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -33,7 +33,6 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.multipart.MultipartResolver;
|
||||
import org.springframework.web.util.WebUtils;
|
||||
|
||||
|
||||
/**
|
||||
* {@link ServerHttpRequest} implementation that accesses one part of a multipart
|
||||
* request. If using {@link MultipartResolver} configuration the part is accessed
|
||||
@@ -54,8 +53,8 @@ public class RequestPartServletServerHttpRequest extends ServletServerHttpReques
|
||||
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
* @param request the current request
|
||||
* Create a new {@code RequestPartServletServerHttpRequest} instance.
|
||||
* @param request the current servlet request
|
||||
* @param partName the name of the part to adapt to the {@link ServerHttpRequest} contract
|
||||
* @throws MissingServletRequestPartException if the request part cannot be found
|
||||
* @throws IllegalArgumentException if MultipartHttpServletRequest cannot be initialized
|
||||
|
||||
Reference in New Issue
Block a user