Less restrictive CORS origin comparison

UriComponentsBuilder allows more efficient (and less restrictive) CORS
origin comparison.

Also introduces a specifically narrowed cloneBuilder() method for
UriComponentsBuilders.

Cherry-picked from 9a52c8.

Issue: SPR-14080
This commit is contained in:
Juergen Hoeller
2016-03-24 15:33:44 +01:00
committed by Rossen Stoyanchev
parent a27200e753
commit 899131997e
4 changed files with 122 additions and 88 deletions

View File

@@ -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.
@@ -406,7 +406,7 @@ public class MvcUriComponentsBuilder {
private static UriComponentsBuilder getBaseUrlToUse(UriComponentsBuilder baseUrl) {
if (baseUrl != null) {
return (UriComponentsBuilder) baseUrl.clone();
return baseUrl.cloneBuilder();
}
else {
return ServletUriComponentsBuilder.fromCurrentServletMapping();

View File

@@ -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.
@@ -223,7 +223,7 @@ public class ServletUriComponentsBuilder extends UriComponentsBuilder {
}
@Override
public Object clone() {
public ServletUriComponentsBuilder cloneBuilder() {
return new ServletUriComponentsBuilder(this);
}