1818
1919import java .io .File ;
2020import java .io .FileNotFoundException ;
21+ import java .util .Collection ;
2122import java .util .Enumeration ;
22- import java .util .List ;
2323import java .util .Map ;
2424import java .util .StringTokenizer ;
2525import java .util .TreeMap ;
3333import javax .servlet .http .HttpServletResponse ;
3434import javax .servlet .http .HttpSession ;
3535
36- import org .springframework .http .server . ServerHttpRequest ;
36+ import org .springframework .http .HttpRequest ;
3737import org .springframework .util .Assert ;
3838import org .springframework .util .LinkedMultiValueMap ;
3939import org .springframework .util .MultiValueMap ;
@@ -742,9 +742,9 @@ public static String extractFullFilenameFromUrlPath(String urlPath) {
742742 * like this {@code "q1=a;q1=b;q2=a,b,c"}. The resulting map would contain
743743 * keys {@code "q1"} and {@code "q2"} with values {@code ["a","b"]} and
744744 * {@code ["a","b","c"]} respectively.
745- *
746745 * @param matrixVariables the unparsed matrix variables string
747746 * @return a map with matrix variable names and values, never {@code null}
747+ * @since 3.2
748748 */
749749 public static MultiValueMap <String , String > parseMatrixVariables (String matrixVariables ) {
750750 MultiValueMap <String , String > result = new LinkedMultiValueMap <String , String >();
@@ -773,12 +773,11 @@ public static MultiValueMap<String, String> parseMatrixVariables(String matrixVa
773773 * Check the given request origin against a list of allowed origins.
774774 * A list containing "*" means that all origins are allowed.
775775 * An empty list means only same origin is allowed.
776- *
777776 * @return true if the request origin is valid, false otherwise
778777 * @since 4.1.5
779778 * @see <a href="https://tools.ietf.org/html/rfc6454">RFC 6454: The Web Origin Concept</a>
780779 */
781- public static boolean isValidOrigin (ServerHttpRequest request , List <String > allowedOrigins ) {
780+ public static boolean isValidOrigin (HttpRequest request , Collection <String > allowedOrigins ) {
782781 Assert .notNull (request , "Request must not be null" );
783782 Assert .notNull (allowedOrigins , "Allowed origins must not be null" );
784783
@@ -791,7 +790,7 @@ else if (allowedOrigins.isEmpty()) {
791790 UriComponents requestComponents = UriComponentsBuilder .fromHttpRequest (request ).build ();
792791 int originPort = getPort (originComponents );
793792 int requestPort = getPort (requestComponents );
794- return originComponents .getHost ().equals (requestComponents .getHost ()) && ( originPort == requestPort );
793+ return ( originComponents .getHost ().equals (requestComponents .getHost ()) && originPort == requestPort );
795794 }
796795 else {
797796 return allowedOrigins .contains (origin );
0 commit comments