Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -56,11 +56,6 @@ public class HttpCookie {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.name.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
@@ -73,6 +68,11 @@ public class HttpCookie {
|
||||
return (this.name.equalsIgnoreCase(otherCookie.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.name.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name + '=' + this.value;
|
||||
|
||||
@@ -251,7 +251,7 @@ public class ServletContextResource extends AbstractFileResolvingResource implem
|
||||
return false;
|
||||
}
|
||||
ServletContextResource otherRes = (ServletContextResource) other;
|
||||
return (this.servletContext.equals(otherRes.servletContext) && this.path.equals(otherRes.path));
|
||||
return (this.path.equals(otherRes.path) && this.servletContext.equals(otherRes.servletContext));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2023 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,7 +42,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
* be delegated to that bean in the Spring context, which is required to implement
|
||||
* the standard Servlet Filter interface.
|
||||
*
|
||||
* <p>This approach is particularly useful for Filter implementation with complex
|
||||
* <p>This approach is particularly useful for Filter implementations with complex
|
||||
* setup needs, allowing to apply the full Spring bean definition machinery to
|
||||
* Filter instances. Alternatively, consider standard Filter setup in combination
|
||||
* with looking up service beans from the Spring root application context.
|
||||
@@ -52,11 +52,11 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
* Spring application context to manage the lifecycle of that bean. Specifying
|
||||
* the "targetFilterLifecycle" filter init-param as "true" will enforce invocation
|
||||
* of the {@code Filter.init} and {@code Filter.destroy} lifecycle methods
|
||||
* on the target bean, letting the servlet container manage the filter lifecycle.
|
||||
* on the target bean, letting the Servlet container manage the filter lifecycle.
|
||||
*
|
||||
* <p>As of Spring 3.1, {@code DelegatingFilterProxy} has been updated to optionally
|
||||
* accept constructor parameters when using a Servlet container's instance-based filter
|
||||
* registration methods, usually in conjunction with Spring's
|
||||
* <p>{@code DelegatingFilterProxy} can optionally accept constructor parameters
|
||||
* when using a Servlet container's instance-based filter registration methods,
|
||||
* usually in conjunction with Spring's
|
||||
* {@link org.springframework.web.WebApplicationInitializer} SPI. These constructors allow
|
||||
* for providing the delegate Filter bean directly, or providing the application context
|
||||
* and bean name to fetch, avoiding the need to look up the application context from the
|
||||
@@ -160,10 +160,10 @@ public class DelegatingFilterProxy extends GenericFilterBean {
|
||||
*/
|
||||
public DelegatingFilterProxy(String targetBeanName, @Nullable WebApplicationContext wac) {
|
||||
Assert.hasText(targetBeanName, "Target Filter bean name must not be null or empty");
|
||||
this.setTargetBeanName(targetBeanName);
|
||||
setTargetBeanName(targetBeanName);
|
||||
this.webApplicationContext = wac;
|
||||
if (wac != null) {
|
||||
this.setEnvironment(wac.getEnvironment());
|
||||
setEnvironment(wac.getEnvironment());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.StringJoiner;
|
||||
|
||||
import org.springframework.http.server.PathContainer;
|
||||
import org.springframework.http.server.PathContainer.Element;
|
||||
import org.springframework.http.server.PathContainer.PathSegment;
|
||||
import org.springframework.http.server.PathContainer.Separator;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -430,6 +431,9 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object other) {
|
||||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
if (!(other instanceof PathPattern)) {
|
||||
return false;
|
||||
}
|
||||
@@ -600,13 +604,11 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||
|
||||
private final PathMatchInfo pathMatchInfo;
|
||||
|
||||
|
||||
PathRemainingMatchInfo(PathContainer pathMatched, PathContainer pathRemaining) {
|
||||
this(pathMatched, pathRemaining, PathMatchInfo.EMPTY);
|
||||
}
|
||||
|
||||
PathRemainingMatchInfo(PathContainer pathMatched, PathContainer pathRemaining,
|
||||
PathMatchInfo pathMatchInfo) {
|
||||
PathRemainingMatchInfo(PathContainer pathMatched, PathContainer pathRemaining, PathMatchInfo pathMatchInfo) {
|
||||
this.pathRemaining = pathRemaining;
|
||||
this.pathMatched = pathMatched;
|
||||
this.pathMatchInfo = pathMatchInfo;
|
||||
@@ -726,8 +728,8 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||
*/
|
||||
String pathElementValue(int pathIndex) {
|
||||
Element element = (pathIndex < this.pathLength) ? this.pathElements.get(pathIndex) : null;
|
||||
if (element instanceof PathContainer.PathSegment) {
|
||||
return ((PathContainer.PathSegment)element).valueToMatch();
|
||||
if (element instanceof PathSegment) {
|
||||
return ((PathSegment) element).valueToMatch();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user