Improve performance of some string operations

Issue: SPR-16293
This commit is contained in:
Christoph Dreis
2017-12-12 17:14:24 +01:00
parent f736b665bd
commit 260ebeca3a
5 changed files with 16 additions and 17 deletions

View File

@@ -21,6 +21,7 @@ import javax.servlet.http.Part;
import org.apache.commons.logging.LogFactory;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartException;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.MultipartResolver;
@@ -67,11 +68,11 @@ public class StandardServletMultipartResolver implements MultipartResolver {
@Override
public boolean isMultipart(HttpServletRequest request) {
// Same check as in Commons FileUpload...
if (!"post".equals(request.getMethod().toLowerCase())) {
if (!"post".equalsIgnoreCase(request.getMethod())) {
return false;
}
String contentType = request.getContentType();
return (contentType != null && contentType.toLowerCase().startsWith("multipart/"));
return StringUtils.startsWithIgnoreCase(contentType, "multipart/");
}
@Override