@ -33,6 +33,9 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse ;
import javax.servlet.http.HttpServletResponse ;
import javax.servlet.http.HttpSession ;
import javax.servlet.http.HttpSession ;
import org.apache.commons.logging.Log ;
import org.apache.commons.logging.LogFactory ;
import org.springframework.http.HttpRequest ;
import org.springframework.http.HttpRequest ;
import org.springframework.util.Assert ;
import org.springframework.util.Assert ;
import org.springframework.util.LinkedMultiValueMap ;
import org.springframework.util.LinkedMultiValueMap ;
@ -131,6 +134,8 @@ public abstract class WebUtils {
/** Key for the mutex session attribute */
/** Key for the mutex session attribute */
public static final String SESSION_MUTEX_ATTRIBUTE = WebUtils . class . getName ( ) + ".MUTEX" ;
public static final String SESSION_MUTEX_ATTRIBUTE = WebUtils . class . getName ( ) + ".MUTEX" ;
private static final Log logger = LogFactory . getLog ( WebUtils . class ) ;
/ * *
/ * *
* Set a system property to the web application root directory .
* Set a system property to the web application root directory .
@ -786,7 +791,14 @@ public abstract class WebUtils {
return true ;
return true ;
}
}
else if ( allowedOrigins . isEmpty ( ) ) {
else if ( allowedOrigins . isEmpty ( ) ) {
UriComponents originComponents = UriComponentsBuilder . fromHttpUrl ( origin ) . build ( ) ;
UriComponents originComponents ;
try {
originComponents = UriComponentsBuilder . fromHttpUrl ( origin ) . build ( ) ;
}
catch ( IllegalArgumentException ex ) {
logger . error ( "Failed to parse Origin header value [" + origin + "]" ) ;
return false ;
}
UriComponents requestComponents = UriComponentsBuilder . fromHttpRequest ( request ) . build ( ) ;
UriComponents requestComponents = UriComponentsBuilder . fromHttpRequest ( request ) . build ( ) ;
int originPort = getPort ( originComponents ) ;
int originPort = getPort ( originComponents ) ;
int requestPort = getPort ( requestComponents ) ;
int requestPort = getPort ( requestComponents ) ;