diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultDocumentLoader.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultDocumentLoader.java index b9a8beb03bd..88ae6b64bdd 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultDocumentLoader.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultDocumentLoader.java @@ -50,7 +50,7 @@ public class DefaultDocumentLoader implements DocumentLoader { /** * JAXP attribute used to configure the schema language for validation. */ - private static final String SCHEMA_LANGUAGE_ATTRIBUTE = "https://java.sun.com/xml/jaxp/properties/schemaLanguage"; + private static final String SCHEMA_LANGUAGE_ATTRIBUTE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; /** * JAXP attribute value indicating the XSD schema language. diff --git a/spring-core/src/main/java/org/springframework/util/xml/AbstractStaxXMLReader.java b/spring-core/src/main/java/org/springframework/util/xml/AbstractStaxXMLReader.java index 7981887d514..cbe22ca3e84 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/AbstractStaxXMLReader.java +++ b/spring-core/src/main/java/org/springframework/util/xml/AbstractStaxXMLReader.java @@ -45,11 +45,11 @@ import org.springframework.util.StringUtils; */ abstract class AbstractStaxXMLReader extends AbstractXMLReader { - private static final String NAMESPACES_FEATURE_NAME = "http://www.xml.org/sax/features/namespaces"; + private static final String NAMESPACES_FEATURE_NAME = "http://xml.org/sax/features/namespaces"; - private static final String NAMESPACE_PREFIXES_FEATURE_NAME = "http://www.xml.org/sax/features/namespace-prefixes"; + private static final String NAMESPACE_PREFIXES_FEATURE_NAME = "http://xml.org/sax/features/namespace-prefixes"; - private static final String IS_STANDALONE_FEATURE_NAME = "http://www.xml.org/sax/features/is-standalone"; + private static final String IS_STANDALONE_FEATURE_NAME = "http://xml.org/sax/features/is-standalone"; private boolean namespacesFeature = true; @@ -101,14 +101,14 @@ abstract class AbstractStaxXMLReader extends AbstractXMLReader { } /** - * Indicates whether the SAX feature {@code http://www.xml.org/sax/features/namespaces} is turned on. + * Indicates whether the SAX feature {@code http://xml.org/sax/features/namespaces} is turned on. */ protected boolean hasNamespacesFeature() { return this.namespacesFeature; } /** - * Indicates whether the SAX feature {@code http://www.xml.org/sax/features/namespaces-prefixes} is turned on. + * Indicates whether the SAX feature {@code http://xml.org/sax/features/namespaces-prefixes} is turned on. */ protected boolean hasNamespacePrefixesFeature() { return this.namespacePrefixesFeature; diff --git a/spring-core/src/main/java/org/springframework/util/xml/AbstractXMLReader.java b/spring-core/src/main/java/org/springframework/util/xml/AbstractXMLReader.java index 3651dbb69a9..44fdd953d8a 100644 --- a/spring-core/src/main/java/org/springframework/util/xml/AbstractXMLReader.java +++ b/spring-core/src/main/java/org/springframework/util/xml/AbstractXMLReader.java @@ -109,12 +109,12 @@ abstract class AbstractXMLReader implements XMLReader { /** * This implementation throws a {@code SAXNotRecognizedException} exception - * for any feature outside of the "http://www.xml.org/sax/features/" namespace + * for any feature outside of the "http://xml.org/sax/features/" namespace * and returns {@code false} for any feature within. */ @Override public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { - if (name.startsWith("http://www.xml.org/sax/features/")) { + if (name.startsWith("http://xml.org/sax/features/")) { return false; } else { @@ -124,12 +124,12 @@ abstract class AbstractXMLReader implements XMLReader { /** * This implementation throws a {@code SAXNotRecognizedException} exception - * for any feature outside of the "http://www.xml.org/sax/features/" namespace + * for any feature outside of the "http://xml.org/sax/features/" namespace * and accepts a {@code false} value for any feature within. */ @Override public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { - if (name.startsWith("http://www.xml.org/sax/features/")) { + if (name.startsWith("http://xml.org/sax/features/")) { if (value) { throw new SAXNotSupportedException(name); } @@ -141,12 +141,12 @@ abstract class AbstractXMLReader implements XMLReader { /** * Throws a {@code SAXNotRecognizedException} exception when the given property does not signify a lexical - * handler. The property name for a lexical handler is {@code http://www.xml.org/sax/properties/lexical-handler}. + * handler. The property name for a lexical handler is {@code http://xml.org/sax/properties/lexical-handler}. */ @Override @Nullable public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { - if ("http://www.xml.org/sax/properties/lexical-handler".equals(name)) { + if ("http://xml.org/sax/properties/lexical-handler".equals(name)) { return this.lexicalHandler; } else { @@ -156,11 +156,11 @@ abstract class AbstractXMLReader implements XMLReader { /** * Throws a {@code SAXNotRecognizedException} exception when the given property does not signify a lexical - * handler. The property name for a lexical handler is {@code http://www.xml.org/sax/properties/lexical-handler}. + * handler. The property name for a lexical handler is {@code http://xml.org/sax/properties/lexical-handler}. */ @Override public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { - if ("http://www.xml.org/sax/properties/lexical-handler".equals(name)) { + if ("http://xml.org/sax/properties/lexical-handler".equals(name)) { this.lexicalHandler = (LexicalHandler) value; } else { diff --git a/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxHandlerTestCase.java b/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxHandlerTestCase.java index 3ab04416a8b..d75e616f8fc 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxHandlerTestCase.java +++ b/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxHandlerTestCase.java @@ -76,10 +76,10 @@ public abstract class AbstractStaxHandlerTestCase { StringWriter stringWriter = new StringWriter(); AbstractStaxHandler handler = createStaxHandler(new StreamResult(stringWriter)); xmlReader.setContentHandler(handler); - xmlReader.setProperty("http://www.xml.org/sax/properties/lexical-handler", handler); + xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); - xmlReader.setFeature("http://www.xml.org/sax/features/namespaces", true); - xmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", false); + xmlReader.setFeature("http://xml.org/sax/features/namespaces", true); + xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false); xmlReader.parse(new InputSource(new StringReader(COMPLEX_XML))); @@ -103,10 +103,10 @@ public abstract class AbstractStaxHandlerTestCase { StringWriter stringWriter = new StringWriter(); AbstractStaxHandler handler = createStaxHandler(new StreamResult(stringWriter)); xmlReader.setContentHandler(handler); - xmlReader.setProperty("http://www.xml.org/sax/properties/lexical-handler", handler); + xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); - xmlReader.setFeature("http://www.xml.org/sax/features/namespaces", true); - xmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true); + xmlReader.setFeature("http://xml.org/sax/features/namespaces", true); + xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); xmlReader.parse(new InputSource(new StringReader(COMPLEX_XML))); @@ -124,10 +124,10 @@ public abstract class AbstractStaxHandlerTestCase { Document result = documentBuilder.newDocument(); AbstractStaxHandler handler = createStaxHandler(new DOMResult(result)); xmlReader.setContentHandler(handler); - xmlReader.setProperty("http://www.xml.org/sax/properties/lexical-handler", handler); + xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); - xmlReader.setFeature("http://www.xml.org/sax/features/namespaces", true); - xmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", false); + xmlReader.setFeature("http://xml.org/sax/features/namespaces", true); + xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false); xmlReader.parse(new InputSource(new StringReader(SIMPLE_XML))); @@ -145,10 +145,10 @@ public abstract class AbstractStaxHandlerTestCase { Document result = documentBuilder.newDocument(); AbstractStaxHandler handler = createStaxHandler(new DOMResult(result)); xmlReader.setContentHandler(handler); - xmlReader.setProperty("http://www.xml.org/sax/properties/lexical-handler", handler); + xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); - xmlReader.setFeature("http://www.xml.org/sax/features/namespaces", true); - xmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true); + xmlReader.setFeature("http://xml.org/sax/features/namespaces", true); + xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); xmlReader.parse(new InputSource(new StringReader(SIMPLE_XML))); diff --git a/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java b/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java index bb9cd89baec..56f5aa68a9a 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java +++ b/spring-core/src/test/java/org/springframework/util/xml/AbstractStaxXMLReaderTestCase.java @@ -70,14 +70,14 @@ public abstract class AbstractStaxXMLReaderTestCase { @Test public void contentHandlerNamespacesNoPrefixes() throws Exception { - standardReader.setFeature("http://www.xml.org/sax/features/namespaces", true); - standardReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", false); + standardReader.setFeature("http://xml.org/sax/features/namespaces", true); + standardReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false); standardReader.parse(new InputSource(createTestInputStream())); AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(createTestInputStream()); ContentHandler contentHandler = mockContentHandler(); - staxXmlReader.setFeature("http://www.xml.org/sax/features/namespaces", true); - staxXmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", false); + staxXmlReader.setFeature("http://xml.org/sax/features/namespaces", true); + staxXmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false); staxXmlReader.setContentHandler(contentHandler); staxXmlReader.parse(new InputSource()); @@ -86,14 +86,14 @@ public abstract class AbstractStaxXMLReaderTestCase { @Test public void contentHandlerNamespacesPrefixes() throws Exception { - standardReader.setFeature("http://www.xml.org/sax/features/namespaces", true); - standardReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true); + standardReader.setFeature("http://xml.org/sax/features/namespaces", true); + standardReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); standardReader.parse(new InputSource(createTestInputStream())); AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(createTestInputStream()); ContentHandler contentHandler = mockContentHandler(); - staxXmlReader.setFeature("http://www.xml.org/sax/features/namespaces", true); - staxXmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true); + staxXmlReader.setFeature("http://xml.org/sax/features/namespaces", true); + staxXmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); staxXmlReader.setContentHandler(contentHandler); staxXmlReader.parse(new InputSource()); @@ -102,14 +102,14 @@ public abstract class AbstractStaxXMLReaderTestCase { @Test public void contentHandlerNoNamespacesPrefixes() throws Exception { - standardReader.setFeature("http://www.xml.org/sax/features/namespaces", false); - standardReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true); + standardReader.setFeature("http://xml.org/sax/features/namespaces", false); + standardReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); standardReader.parse(new InputSource(createTestInputStream())); AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(createTestInputStream()); ContentHandler contentHandler = mockContentHandler(); - staxXmlReader.setFeature("http://www.xml.org/sax/features/namespaces", false); - staxXmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true); + staxXmlReader.setFeature("http://xml.org/sax/features/namespaces", false); + staxXmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); staxXmlReader.setContentHandler(contentHandler); staxXmlReader.parse(new InputSource()); @@ -141,10 +141,10 @@ public abstract class AbstractStaxXMLReaderTestCase { LexicalHandler expectedLexicalHandler = mockLexicalHandler(); standardReader.setContentHandler(null); - standardReader.setProperty("http://www.xml.org/sax/properties/lexical-handler", expectedLexicalHandler); + standardReader.setProperty("http://xml.org/sax/properties/lexical-handler", expectedLexicalHandler); standardReader.parse(new InputSource(testLexicalHandlerXml.getInputStream())); inputFactory.setProperty("javax.xml.stream.isCoalescing", Boolean.FALSE); - inputFactory.setProperty("https://java.sun.com/xml/stream/properties/report-cdata-event", Boolean.TRUE); + inputFactory.setProperty("http://java.sun.com/xml/stream/properties/report-cdata-event", Boolean.TRUE); inputFactory.setProperty("javax.xml.stream.isReplacingEntityReferences", Boolean.FALSE); inputFactory.setProperty("javax.xml.stream.isSupportingExternalEntities", Boolean.FALSE); @@ -152,7 +152,7 @@ public abstract class AbstractStaxXMLReaderTestCase { willAnswer(invocation -> invocation.getArguments()[0] = "element"). given(actualLexicalHandler).startDTD(anyString(), anyString(), anyString()); AbstractStaxXMLReader staxXmlReader = createStaxXmlReader(testLexicalHandlerXml.getInputStream()); - staxXmlReader.setProperty("http://www.xml.org/sax/properties/lexical-handler", actualLexicalHandler); + staxXmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", actualLexicalHandler); staxXmlReader.parse(new InputSource()); // TODO: broken comparison since Mockito 2.2 upgrade diff --git a/spring-core/src/test/java/org/springframework/util/xml/DomContentHandlerTests.java b/spring-core/src/test/java/org/springframework/util/xml/DomContentHandlerTests.java index 0221a3ac36a..bd73472fc81 100644 --- a/spring-core/src/test/java/org/springframework/util/xml/DomContentHandlerTests.java +++ b/spring-core/src/test/java/org/springframework/util/xml/DomContentHandlerTests.java @@ -72,7 +72,7 @@ public class DomContentHandlerTests { @Test public void contentHandlerDocumentNamespacePrefixes() throws Exception { - xmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true); + xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); handler = new DomContentHandler(result); expected = documentBuilder.parse(new InputSource(new StringReader(XML_1))); xmlReader.setContentHandler(handler); diff --git a/spring-messaging/src/test/java/org/springframework/messaging/simp/SimpMessagingTemplateTests.java b/spring-messaging/src/test/java/org/springframework/messaging/simp/SimpMessagingTemplateTests.java index b1c99209c4b..efe5248cf6e 100644 --- a/spring-messaging/src/test/java/org/springframework/messaging/simp/SimpMessagingTemplateTests.java +++ b/spring-messaging/src/test/java/org/springframework/messaging/simp/SimpMessagingTemplateTests.java @@ -83,7 +83,7 @@ public class SimpMessagingTemplateTests { MessageHeaderAccessor.getAccessor(messages.get(0), SimpMessageHeaderAccessor.class); assertNotNull(headerAccessor); - assertEquals("/user/http:%2F%2Fjoe.openid.example.org%2F/queue/foo", headerAccessor.getDestination()); + assertEquals("/user/https:%2F%2Fjoe.openid.example.org%2F/queue/foo", headerAccessor.getDestination()); } @Test diff --git a/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java index ebcf31f3966..ec420b91d3c 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java @@ -580,7 +580,7 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi Assert.hasLength(schemaLanguage, "No schema language provided"); Source[] schemaSources = new Source[resources.length]; XMLReader xmlReader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader(); - xmlReader.setFeature("http://www.xml.org/sax/features/namespace-prefixes", true); + xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true); for (int i = 0; i < resources.length; i++) { Resource resource = resources[i]; Assert.isTrue(resource != null && resource.exists(), () -> "Resource does not exist: " + resource); @@ -860,8 +860,8 @@ public class Jaxb2Marshaller implements MimeMarshaller, MimeUnmarshaller, Generi if (xmlReader == null) { xmlReader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader(); } - xmlReader.setFeature("https://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd()); - String name = "http://www.xml.org/sax/features/external-general-entities"; + xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd()); + String name = "http://xml.org/sax/features/external-general-entities"; xmlReader.setFeature(name, isProcessExternalEntities()); if (!isProcessExternalEntities()) { xmlReader.setEntityResolver(NO_OP_ENTITY_RESOLVER); diff --git a/spring-oxm/src/main/java/org/springframework/oxm/support/AbstractMarshaller.java b/spring-oxm/src/main/java/org/springframework/oxm/support/AbstractMarshaller.java index 722e3f73f6e..c40cd225f80 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/support/AbstractMarshaller.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/support/AbstractMarshaller.java @@ -160,8 +160,8 @@ public abstract class AbstractMarshaller implements Marshaller, Unmarshaller { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setNamespaceAware(true); - factory.setFeature("https://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd()); - factory.setFeature("http://www.xml.org/sax/features/external-general-entities", isProcessExternalEntities()); + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd()); + factory.setFeature("http://xml.org/sax/features/external-general-entities", isProcessExternalEntities()); return factory; } @@ -191,8 +191,8 @@ public abstract class AbstractMarshaller implements Marshaller, Unmarshaller { @SuppressWarnings("deprecation") // on JDK 9 protected XMLReader createXmlReader() throws SAXException { XMLReader xmlReader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader(); - xmlReader.setFeature("https://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd()); - xmlReader.setFeature("http://www.xml.org/sax/features/external-general-entities", isProcessExternalEntities()); + xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd()); + xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", isProcessExternalEntities()); if (!isProcessExternalEntities()) { xmlReader.setEntityResolver(NO_OP_ENTITY_RESOLVER); } diff --git a/spring-oxm/src/main/java/org/springframework/oxm/support/MarshallingSource.java b/spring-oxm/src/main/java/org/springframework/oxm/support/MarshallingSource.java index c8dcda73457..e68d09f8f05 100644 --- a/spring-oxm/src/main/java/org/springframework/oxm/support/MarshallingSource.java +++ b/spring-oxm/src/main/java/org/springframework/oxm/support/MarshallingSource.java @@ -192,7 +192,7 @@ public class MarshallingSource extends SAXSource { @Override @Nullable public Object getProperty(String name) throws SAXNotRecognizedException { - if ("http://www.xml.org/sax/properties/lexical-handler".equals(name)) { + if ("http://xml.org/sax/properties/lexical-handler".equals(name)) { return this.lexicalHandler; } else { @@ -202,7 +202,7 @@ public class MarshallingSource extends SAXSource { @Override public void setProperty(String name, Object value) throws SAXNotRecognizedException { - if ("http://www.xml.org/sax/properties/lexical-handler".equals(name)) { + if ("http://xml.org/sax/properties/lexical-handler".equals(name)) { this.lexicalHandler = (LexicalHandler) value; } else { diff --git a/spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java index 8703642f833..9bc91492d5b 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java @@ -74,7 +74,7 @@ public abstract class AbstractMarshallerTests { marshaller.marshal(flights, domResult); Document expected = builder.newDocument(); Element flightsElement = expected.createElementNS("http://samples.springframework.org/flight", "tns:flights"); - Attr namespace = expected.createAttributeNS("https://www.w3.org/2000/xmlns/", "xmlns:tns"); + Attr namespace = expected.createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:tns"); namespace.setNodeValue("http://samples.springframework.org/flight"); flightsElement.setAttributeNode(namespace); expected.appendChild(flightsElement); @@ -98,7 +98,7 @@ public abstract class AbstractMarshallerTests { Document result = (Document) domResult.getNode(); Document expected = builder.newDocument(); Element flightsElement = expected.createElementNS("http://samples.springframework.org/flight", "tns:flights"); - Attr namespace = expected.createAttributeNS("https://www.w3.org/2000/xmlns/", "xmlns:tns"); + Attr namespace = expected.createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:tns"); namespace.setNodeValue("http://samples.springframework.org/flight"); flightsElement.setAttributeNode(namespace); expected.appendChild(flightsElement); diff --git a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java index 4537b345d21..e8cb48ed050 100644 --- a/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java +++ b/spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2MarshallerTests.java @@ -339,8 +339,8 @@ public class Jaxb2MarshallerTests extends AbstractMarshallerTests")).willReturn(dataHandler); given(mimeContainer.getAttachment("696cfb9a-4d2d-402f-bb5c-59fa69e7f0b3@spring-ws.png")).willReturn(dataHandler); String content = "" + "" + - "" + + "" + "" + "" + - "" + + "" + "" + "696cfb9a-4d2d-402f-bb5c-59fa69e7f0b3@spring-ws.png" + ""; diff --git a/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilderTests.java b/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilderTests.java index b35d80d0c1a..cf7a1fa3ca8 100644 --- a/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilderTests.java +++ b/spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilderTests.java @@ -178,7 +178,7 @@ public class HtmlUnitRequestBuilderTests { @Test public void buildRequestContextPathUsesNoFirstSegmentWithDefault() throws MalformedURLException { - webRequest.setUrl(new URL("https://example.com/")); + webRequest.setUrl(new URL("http://example.com/")); String contextPath = requestBuilder.buildRequest(servletContext).getContextPath(); assertThat(contextPath, equalTo("")); @@ -618,7 +618,7 @@ public class HtmlUnitRequestBuilderTests { @Test public void buildRequestRemotePort80WithDefault() throws Exception { - webRequest.setUrl(new URL("https://example.com/")); + webRequest.setUrl(new URL("http://example.com/")); MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext); @@ -650,7 +650,7 @@ public class HtmlUnitRequestBuilderTests { @Test public void buildRequestUrl() { String uri = requestBuilder.buildRequest(servletContext).getRequestURL().toString(); - assertThat(uri, equalTo("https://example.com/test/this/here")); + assertThat(uri, equalTo("http://example.com/test/this/here")); } @Test diff --git a/spring-tx/src/main/java/org/springframework/jca/context/SpringContextResourceAdapter.java b/spring-tx/src/main/java/org/springframework/jca/context/SpringContextResourceAdapter.java index ed222af706c..ad4400463d8 100644 --- a/spring-tx/src/main/java/org/springframework/jca/context/SpringContextResourceAdapter.java +++ b/spring-tx/src/main/java/org/springframework/jca/context/SpringContextResourceAdapter.java @@ -71,7 +71,7 @@ import org.springframework.util.StringUtils; * <?xml version="1.0" encoding="UTF-8"?> * <connector xmlns="http://java.sun.com/xml/ns/j2ee" * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - * xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee https://java.sun.com/xml/ns/j2ee/connector_1_5.xsd" + * xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd" * version="1.5"> * <vendor-name>Spring Framework</vendor-name> * <eis-type>Spring Connector</eis-type> diff --git a/spring-web/src/main/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverter.java index 497357e326e..9ff39a76d3b 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverter.java @@ -155,8 +155,8 @@ public class Jaxb2RootElementHttpMessageConverter extends AbstractJaxb2HttpMessa InputSource inputSource = new InputSource(streamSource.getInputStream()); try { XMLReader xmlReader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader(); - xmlReader.setFeature("https://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd()); - String featureName = "http://www.xml.org/sax/features/external-general-entities"; + xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd()); + String featureName = "http://xml.org/sax/features/external-general-entities"; xmlReader.setFeature(featureName, isProcessExternalEntities()); if (!isProcessExternalEntities()) { xmlReader.setEntityResolver(NO_OP_ENTITY_RESOLVER); diff --git a/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java index bcade98afde..9dfdca4c266 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/xml/SourceHttpMessageConverter.java @@ -169,9 +169,9 @@ public class SourceHttpMessageConverter extends AbstractHttpMe DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); documentBuilderFactory.setFeature( - "https://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd()); + "http://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd()); documentBuilderFactory.setFeature( - "http://www.xml.org/sax/features/external-general-entities", isProcessExternalEntities()); + "http://xml.org/sax/features/external-general-entities", isProcessExternalEntities()); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); if (!isProcessExternalEntities()) { documentBuilder.setEntityResolver(NO_OP_ENTITY_RESOLVER); @@ -200,8 +200,8 @@ public class SourceHttpMessageConverter extends AbstractHttpMe private SAXSource readSAXSource(InputStream body, HttpInputMessage inputMessage) throws IOException { try { XMLReader xmlReader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader(); - xmlReader.setFeature("https://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd()); - xmlReader.setFeature("http://www.xml.org/sax/features/external-general-entities", isProcessExternalEntities()); + xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", !isSupportDtd()); + xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", isProcessExternalEntities()); if (!isProcessExternalEntities()) { xmlReader.setEntityResolver(NO_OP_ENTITY_RESOLVER); } diff --git a/spring-web/src/test/java/org/springframework/http/server/ServletServerHttpRequestTests.java b/spring-web/src/test/java/org/springframework/http/server/ServletServerHttpRequestTests.java index 758067b2e51..188a4b17adb 100644 --- a/spring-web/src/test/java/org/springframework/http/server/ServletServerHttpRequestTests.java +++ b/spring-web/src/test/java/org/springframework/http/server/ServletServerHttpRequestTests.java @@ -60,6 +60,7 @@ public class ServletServerHttpRequestTests { @Test public void getUriForSimplePath() throws URISyntaxException { URI uri = new URI("https://example.com/path"); + mockRequest.setScheme(uri.getScheme()); mockRequest.setServerName(uri.getHost()); mockRequest.setServerPort(uri.getPort()); mockRequest.setRequestURI(uri.getPath()); @@ -70,6 +71,7 @@ public class ServletServerHttpRequestTests { @Test public void getUriWithQueryString() throws URISyntaxException { URI uri = new URI("https://example.com/path?query"); + mockRequest.setScheme(uri.getScheme()); mockRequest.setServerName(uri.getHost()); mockRequest.setServerPort(uri.getPort()); mockRequest.setRequestURI(uri.getPath()); @@ -82,7 +84,7 @@ public class ServletServerHttpRequestTests { mockRequest.setServerName("example.com"); mockRequest.setRequestURI("/path"); mockRequest.setQueryString("query=foo"); - assertEquals(new URI("https://example.com/path?query=foo"), request.getURI()); + assertEquals(new URI("http://example.com/path?query=foo"), request.getURI()); } @Test // SPR-16414 @@ -90,7 +92,7 @@ public class ServletServerHttpRequestTests { mockRequest.setServerName("example.com"); mockRequest.setRequestURI("/path"); mockRequest.setQueryString("query=foo%%x"); - assertEquals(new URI("https://example.com/path"), request.getURI()); + assertEquals(new URI("http://example.com/path"), request.getURI()); } @Test // SPR-13876 diff --git a/spring-web/src/test/java/org/springframework/http/server/reactive/ServerHttpRequestTests.java b/spring-web/src/test/java/org/springframework/http/server/reactive/ServerHttpRequestTests.java index 1e16ad35f68..c2fd0257f74 100644 --- a/spring-web/src/test/java/org/springframework/http/server/reactive/ServerHttpRequestTests.java +++ b/spring-web/src/test/java/org/springframework/http/server/reactive/ServerHttpRequestTests.java @@ -96,7 +96,7 @@ public class ServerHttpRequestTests { request = createHttpRequest("/").mutate().method(HttpMethod.DELETE).build(); assertEquals(HttpMethod.DELETE, request.getMethod()); - String baseUri = "https://www.aaa.org/articles/"; + String baseUri = "https://aaa.org:8080/a"; request = createHttpRequest(baseUri).mutate().uri(URI.create("https://bbb.org:9090/b")).build(); assertEquals("https://bbb.org:9090/b", request.getURI().toString()); diff --git a/spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java b/spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java index d04641203fe..63234ec97aa 100644 --- a/spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java +++ b/spring-web/src/test/java/org/springframework/remoting/jaxws/JaxWsSupportTests.java @@ -69,7 +69,7 @@ public class JaxWsSupportTests { GenericBeanDefinition clientDef = new GenericBeanDefinition(); clientDef.setBeanClass(JaxWsPortProxyFactoryBean.class); clientDef.getPropertyValues().add("wsdlDocumentUrl", "http://localhost:9999/OrderService?wsdl"); - clientDef.getPropertyValues().add("namespaceUri", "https://jaxws.remoting.springframework.org/"); + clientDef.getPropertyValues().add("namespaceUri", "http://jaxws.remoting.springframework.org/"); clientDef.getPropertyValues().add("username", "juergen"); clientDef.getPropertyValues().add("password", "hoeller"); clientDef.getPropertyValues().add("serviceName", "OrderService"); @@ -83,7 +83,7 @@ public class JaxWsSupportTests { GenericBeanDefinition serviceFactoryDef = new GenericBeanDefinition(); serviceFactoryDef.setBeanClass(LocalJaxWsServiceFactoryBean.class); serviceFactoryDef.getPropertyValues().add("wsdlDocumentUrl", "http://localhost:9999/OrderService?wsdl"); - serviceFactoryDef.getPropertyValues().add("namespaceUri", "https://jaxws.remoting.springframework.org/"); + serviceFactoryDef.getPropertyValues().add("namespaceUri", "http://jaxws.remoting.springframework.org/"); serviceFactoryDef.getPropertyValues().add("serviceName", "OrderService"); ac.registerBeanDefinition("orderService", serviceFactoryDef); @@ -152,12 +152,12 @@ public class JaxWsSupportTests { } - @WebServiceClient(targetNamespace = "https://jaxws.remoting.springframework.org/", name="OrderService") + @WebServiceClient(targetNamespace = "http://jaxws.remoting.springframework.org/", name="OrderService") public static class OrderServiceService extends Service { public OrderServiceService() throws MalformedURLException { super(new URL("http://localhost:9999/OrderService?wsdl"), - new QName("https://jaxws.remoting.springframework.org/", "OrderService")); + new QName("http://jaxws.remoting.springframework.org/", "OrderService")); } public OrderServiceService(URL wsdlDocumentLocation, QName serviceName) { diff --git a/spring-web/src/test/java/org/springframework/web/client/RestTemplateTests.java b/spring-web/src/test/java/org/springframework/web/client/RestTemplateTests.java index cf3f87b5dc6..f232af2e31c 100644 --- a/spring-web/src/test/java/org/springframework/web/client/RestTemplateTests.java +++ b/spring-web/src/test/java/org/springframework/web/client/RestTemplateTests.java @@ -562,7 +562,7 @@ public class RestTemplateTests { public void ioExceptionWithEmptyQueryString() throws Exception { // https://example.com/resource? - URI uri = new URI("http", "example.com", "/resource", "", null); + URI uri = new URI("https", "example.com", "/resource", "", null); given(converter.canRead(String.class, null)).willReturn(true); given(converter.getSupportedMediaTypes()).willReturn(Collections.singletonList(parseMediaType("foo/bar"))); diff --git a/spring-web/src/test/java/org/springframework/web/cors/reactive/CorsUtilsTests.java b/spring-web/src/test/java/org/springframework/web/cors/reactive/CorsUtilsTests.java index 18458b2ca62..87257f71adc 100644 --- a/spring-web/src/test/java/org/springframework/web/cors/reactive/CorsUtilsTests.java +++ b/spring-web/src/test/java/org/springframework/web/cors/reactive/CorsUtilsTests.java @@ -95,7 +95,7 @@ public class CorsUtilsTests { @Test // SPR-16362 public void isSameOriginWithDifferentSchemes() { MockServerHttpRequest request = MockServerHttpRequest - .get("https://mydomain1.com") + .get("http://mydomain1.com") .header(HttpHeaders.ORIGIN, "https://mydomain1.com") .build(); assertFalse(CorsUtils.isSameOrigin(request)); diff --git a/spring-web/src/test/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequestTests.java b/spring-web/src/test/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequestTests.java index 62d38cd37da..7dc5fee89a0 100644 --- a/spring-web/src/test/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequestTests.java +++ b/spring-web/src/test/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequestTests.java @@ -57,6 +57,7 @@ public class RequestPartServletServerHttpRequestTests { ServerHttpRequest request = new RequestPartServletServerHttpRequest(this.mockRequest, "part"); URI uri = new URI("https://example.com/path?query"); + this.mockRequest.setScheme(uri.getScheme()); this.mockRequest.setServerName(uri.getHost()); this.mockRequest.setServerPort(uri.getPort()); this.mockRequest.setRequestURI(uri.getPath()); diff --git a/spring-web/src/test/java/org/springframework/web/util/DefaultUriBuilderFactoryTests.java b/spring-web/src/test/java/org/springframework/web/util/DefaultUriBuilderFactoryTests.java index 93f4f2d8c49..26e0e1b48ff 100644 --- a/spring-web/src/test/java/org/springframework/web/util/DefaultUriBuilderFactoryTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/DefaultUriBuilderFactoryTests.java @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -48,14 +48,14 @@ public class DefaultUriBuilderFactoryTests { @Test public void baseUri() { - DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory("http://www.foo.com/v1?id=123"); + DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory("https://foo.com/v1?id=123"); URI uri = factory.uriString("/bar").port(8080).build(); assertEquals("https://foo.com:8080/v1/bar?id=123", uri.toString()); } @Test public void baseUriWithFullOverride() { - DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory("http://www.foo.com/v1?id=123"); + DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory("https://foo.com/v1?id=123"); URI uri = factory.uriString("https://example.com/1/2").build(); assertEquals("Use of host should case baseUri to be completely ignored", "https://example.com/1/2", uri.toString()); @@ -63,22 +63,22 @@ public class DefaultUriBuilderFactoryTests { @Test public void baseUriWithPathOverride() { - DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory("http://www.foo.com/v1"); + DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory("https://foo.com/v1"); URI uri = factory.builder().replacePath("/baz").build(); - assertEquals("http://www.foo.com/baz", uri.toString()); + assertEquals("https://foo.com/baz", uri.toString()); } @Test public void defaultUriVars() { - DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory("http://{host}/v1"); + DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory("https://{host}/v1"); factory.setDefaultUriVariables(singletonMap("host", "foo.com")); URI uri = factory.uriString("/{id}").build(singletonMap("id", "123")); - assertEquals("http://www.foo.com/v1/123", uri.toString()); + assertEquals("https://foo.com/v1/123", uri.toString()); } @Test public void defaultUriVarsWithOverride() { - DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory("http://{host}/v1"); + DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory("https://{host}/v1"); factory.setDefaultUriVariables(singletonMap("host", "spring.io")); URI uri = factory.uriString("/bar").build(singletonMap("host", "docs.spring.io")); assertEquals("https://docs.spring.io/v1/bar", uri.toString()); @@ -86,10 +86,10 @@ public class DefaultUriBuilderFactoryTests { @Test public void defaultUriVarsWithEmptyVarArg() { - DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory("http://{host}/v1"); + DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory("https://{host}/v1"); factory.setDefaultUriVariables(singletonMap("host", "foo.com")); URI uri = factory.uriString("/bar").build(); - assertEquals("Expected delegation to build(Map) method", "http://www.foo.com/v1/bar", uri.toString()); + assertEquals("Expected delegation to build(Map) method", "https://foo.com/v1/bar", uri.toString()); } @Test @@ -138,7 +138,7 @@ public class DefaultUriBuilderFactoryTests { DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory(); factory.setEncodingMode(EncodingMode.VALUES_ONLY); factory.setDefaultUriVariables(singletonMap("host", "www.example.com")); - UriBuilder uriBuilder = factory.uriString("http://{host}/user/{userId}/dashboard"); + UriBuilder uriBuilder = factory.uriString("https://{host}/user/{userId}/dashboard"); assertEquals("https://www.example.com/user/john%3Bdoe/dashboard", uriBuilder.build(singletonMap("userId", "john;doe")).toString()); @@ -176,8 +176,8 @@ public class DefaultUriBuilderFactoryTests { @Test // SPR-15201 public void pathWithTrailingSlash() { DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory(); - URI uri = factory.expand("http://localhost:8080/spring/"); - assertEquals("http://localhost:8080/spring/", uri.toString()); + URI uri = factory.expand("https://localhost:8080/spring/"); + assertEquals("https://localhost:8080/spring/", uri.toString()); } @Test diff --git a/spring-web/src/test/java/org/springframework/web/util/DefaultUriTemplateHandlerTests.java b/spring-web/src/test/java/org/springframework/web/util/DefaultUriTemplateHandlerTests.java index 87c0207c95b..c9d8ded2664 100644 --- a/spring-web/src/test/java/org/springframework/web/util/DefaultUriTemplateHandlerTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/DefaultUriTemplateHandlerTests.java @@ -142,7 +142,7 @@ public class DefaultUriTemplateHandlerTests { Map vars = new HashMap<>(1); vars.put("userId", "john;doe"); - String template = "http://{host}/user/{userId}/dashboard"; + String template = "https://{host}/user/{userId}/dashboard"; URI actual = this.handler.expand(template, vars); assertEquals("https://www.example.com/user/john%3Bdoe/dashboard", actual.toString()); diff --git a/spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java b/spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java index bc0f73eb806..a84af5a462f 100644 --- a/spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java @@ -52,10 +52,10 @@ public class UriComponentsBuilderTests { @Test public void plain() throws URISyntaxException { UriComponentsBuilder builder = UriComponentsBuilder.newInstance(); - UriComponents result = builder.scheme("http").host("example.com") + UriComponents result = builder.scheme("https").host("example.com") .path("foo").queryParam("bar").fragment("baz") .build(); - assertEquals("http", result.getScheme()); + assertEquals("https", result.getScheme()); assertEquals("example.com", result.getHost()); assertEquals("foo", result.getPath()); assertEquals("bar", result.getQuery()); @@ -68,18 +68,18 @@ public class UriComponentsBuilderTests { @Test public void multipleFromSameBuilder() throws URISyntaxException { UriComponentsBuilder builder = UriComponentsBuilder.newInstance() - .scheme("http").host("example.com").pathSegment("foo"); + .scheme("https").host("example.com").pathSegment("foo"); UriComponents result1 = builder.build(); builder = builder.pathSegment("foo2").queryParam("bar").fragment("baz"); UriComponents result2 = builder.build(); - assertEquals("http", result1.getScheme()); + assertEquals("https", result1.getScheme()); assertEquals("example.com", result1.getHost()); assertEquals("/foo", result1.getPath()); URI expected = new URI("https://example.com/foo"); assertEquals("Invalid result URI", expected, result1.toUri()); - assertEquals("http", result2.getScheme()); + assertEquals("https", result2.getScheme()); assertEquals("example.com", result2.getHost()); assertEquals("/foo/foo2", result2.getPath()); assertEquals("bar", result2.getQuery()); @@ -111,7 +111,7 @@ public class UriComponentsBuilderTests { public void fromHierarchicalUri() throws URISyntaxException { URI uri = new URI("https://example.com/foo?bar#baz"); UriComponents result = UriComponentsBuilder.fromUri(uri).build(); - assertEquals("http", result.getScheme()); + assertEquals("https", result.getScheme()); assertEquals("example.com", result.getHost()); assertEquals("/foo", result.getPath()); assertEquals("bar", result.getQuery()); @@ -144,7 +144,7 @@ public class UriComponentsBuilderTests { @Test public void fromUriString() { UriComponents result = UriComponentsBuilder.fromUriString("https://www.ietf.org/rfc/rfc3986.txt").build(); - assertEquals("http", result.getScheme()); + assertEquals("https", result.getScheme()); assertNull(result.getUserInfo()); assertEquals("www.ietf.org", result.getHost()); assertEquals(-1, result.getPort()); @@ -156,7 +156,7 @@ public class UriComponentsBuilderTests { String url = "https://arjen:foobar@java.sun.com:80" + "/javase/6/docs/api/java/util/BitSet.html?foo=bar#and(java.util.BitSet)"; result = UriComponentsBuilder.fromUriString(url).build(); - assertEquals("http", result.getScheme()); + assertEquals("https", result.getScheme()); assertEquals("arjen:foobar", result.getUserInfo()); assertEquals("java.sun.com", result.getHost()); assertEquals(80, result.getPort()); @@ -279,7 +279,7 @@ public class UriComponentsBuilderTests { @Test // SPR-14761 public void fromHttpRequestWithForwardedIPv4Host() { MockHttpServletRequest request = new MockHttpServletRequest(); - request.setScheme("http"); + request.setScheme("https"); request.setServerName("localhost"); request.setServerPort(-1); request.setRequestURI("/mvc-showcase"); @@ -288,7 +288,7 @@ public class UriComponentsBuilderTests { HttpRequest httpRequest = new ServletServerHttpRequest(request); UriComponents result = UriComponentsBuilder.fromHttpRequest(httpRequest).build(); - assertEquals("/admin/", result.toString()); + assertEquals("https://192.168.0.1/mvc-showcase", result.toString()); } @Test // SPR-14761 @@ -339,7 +339,7 @@ public class UriComponentsBuilderTests { @Test public void fromHttpRequestWithForwardedHost() { MockHttpServletRequest request = new MockHttpServletRequest(); - request.setScheme("http"); + request.setScheme("https"); request.setServerName("localhost"); request.setServerPort(-1); request.setRequestURI("/mvc-showcase"); @@ -492,7 +492,7 @@ public class UriComponentsBuilderTests { HttpRequest httpRequest = new ServletServerHttpRequest(request); UriComponents result = UriComponentsBuilder.fromHttpRequest(httpRequest).build(); - assertEquals("https://a.example.org/mvc-showcase", result.toString()); + assertEquals("http://a.example.org/mvc-showcase", result.toString()); } @Test // SPR-12816 diff --git a/spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java b/spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java index 054192a2830..51dd637dadb 100644 --- a/spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/UriComponentsTests.java @@ -133,7 +133,7 @@ public class UriComponentsTests { @Test // gh-22447 public void expandWithFragmentOrder() { UriComponents uriComponents = UriComponentsBuilder - .fromUriString("http://{host}/{path}#{fragment}").build() + .fromUriString("https://{host}/{path}#{fragment}").build() .expand("example.com", "foo", "bar"); assertEquals("https://example.com/foo#bar", uriComponents.toUriString()); diff --git a/spring-web/src/test/java/org/springframework/web/util/UriUtilsTests.java b/spring-web/src/test/java/org/springframework/web/util/UriUtilsTests.java index c9220f379a3..70092fd62a1 100644 --- a/spring-web/src/test/java/org/springframework/web/util/UriUtilsTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/UriUtilsTests.java @@ -94,7 +94,7 @@ public class UriUtilsTests { @Test public void encode() { assertEquals("Invalid encoded result", "foo", UriUtils.encode("foo", CHARSET)); - assertEquals("Invalid encoded result", "http%3A%2F%2Fexample.com%2Ffoo%20bar", + assertEquals("Invalid encoded result", "https%3A%2F%2Fexample.com%2Ffoo%20bar", UriUtils.encode("https://example.com/foo bar", CHARSET)); } diff --git a/spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java b/spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java index 0d1aeecb9f2..99a6736f1ae 100644 --- a/spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java @@ -92,41 +92,41 @@ public class WebUtilsTests { @Test public void isValidOrigin() { List allowed = Collections.emptyList(); - assertTrue(checkValidOrigin("mydomain1.com", -1, "https://mydomain1.com", allowed)); - assertFalse(checkValidOrigin("mydomain1.com", -1, "/QTifZ/", allowed)); + assertTrue(checkValidOrigin("mydomain1.com", -1, "http://mydomain1.com", allowed)); + assertFalse(checkValidOrigin("mydomain1.com", -1, "http://mydomain2.com", allowed)); allowed = Collections.singletonList("*"); - assertTrue(checkValidOrigin("mydomain1.com", -1, "/QTifZ/", allowed)); + assertTrue(checkValidOrigin("mydomain1.com", -1, "http://mydomain2.com", allowed)); - allowed = Collections.singletonList("https://mydomain1.com"); - assertTrue(checkValidOrigin("mydomain2.com", -1, "https://mydomain1.com", allowed)); + allowed = Collections.singletonList("http://mydomain1.com"); + assertTrue(checkValidOrigin("mydomain2.com", -1, "http://mydomain1.com", allowed)); assertFalse(checkValidOrigin("mydomain2.com", -1, "http://mydomain3.com", allowed)); } @Test public void isSameOrigin() { - assertTrue(checkSameOrigin("http", "mydomain1.com", -1, "https://mydomain1.com")); - assertTrue(checkSameOrigin("http", "mydomain1.com", -1, "https://www.mydomain1.com/")); + assertTrue(checkSameOrigin("http", "mydomain1.com", -1, "http://mydomain1.com")); + assertTrue(checkSameOrigin("http", "mydomain1.com", -1, "http://mydomain1.com:80")); assertTrue(checkSameOrigin("https", "mydomain1.com", 443, "https://mydomain1.com")); assertTrue(checkSameOrigin("https", "mydomain1.com", 443, "https://mydomain1.com:443")); - assertTrue(checkSameOrigin("http", "mydomain1.com", 123, "https://mydomain1.com:123")); + assertTrue(checkSameOrigin("http", "mydomain1.com", 123, "http://mydomain1.com:123")); assertTrue(checkSameOrigin("ws", "mydomain1.com", -1, "ws://mydomain1.com")); assertTrue(checkSameOrigin("wss", "mydomain1.com", 443, "wss://mydomain1.com")); - assertFalse(checkSameOrigin("http", "mydomain1.com", -1, "/QTifZ/")); + assertFalse(checkSameOrigin("http", "mydomain1.com", -1, "http://mydomain2.com")); assertFalse(checkSameOrigin("http", "mydomain1.com", -1, "https://mydomain1.com")); assertFalse(checkSameOrigin("http", "mydomain1.com", -1, "invalid-origin")); - assertFalse(checkSameOrigin("https", "mydomain1.com", -1, "https://mydomain1.com")); + assertFalse(checkSameOrigin("https", "mydomain1.com", -1, "http://mydomain1.com")); // Handling of invalid origins as described in SPR-13478 - assertTrue(checkSameOrigin("http", "mydomain1.com", -1, "https://mydomain1.com/")); - assertTrue(checkSameOrigin("http", "mydomain1.com", -1, "https://www.mydomain1.com/")); - assertTrue(checkSameOrigin("http", "mydomain1.com", -1, "https://mydomain1.com/path")); - assertTrue(checkSameOrigin("http", "mydomain1.com", -1, "https://www.mydomain1.com/path")); - assertFalse(checkSameOrigin("http", "mydomain2.com", -1, "https://mydomain1.com/")); - assertFalse(checkSameOrigin("http", "mydomain2.com", -1, "https://www.mydomain1.com/")); - assertFalse(checkSameOrigin("http", "mydomain2.com", -1, "https://mydomain1.com/path")); - assertFalse(checkSameOrigin("http", "mydomain2.com", -1, "https://www.mydomain1.com/path")); + assertTrue(checkSameOrigin("http", "mydomain1.com", -1, "http://mydomain1.com/")); + assertTrue(checkSameOrigin("http", "mydomain1.com", -1, "http://mydomain1.com:80/")); + assertTrue(checkSameOrigin("http", "mydomain1.com", -1, "http://mydomain1.com/path")); + assertTrue(checkSameOrigin("http", "mydomain1.com", -1, "http://mydomain1.com:80/path")); + assertFalse(checkSameOrigin("http", "mydomain2.com", -1, "http://mydomain1.com/")); + assertFalse(checkSameOrigin("http", "mydomain2.com", -1, "http://mydomain1.com:80/")); + assertFalse(checkSameOrigin("http", "mydomain2.com", -1, "http://mydomain1.com/path")); + assertFalse(checkSameOrigin("http", "mydomain2.com", -1, "http://mydomain1.com:80/path")); // Handling of IPv6 hosts as described in SPR-13525 assertTrue(checkSameOrigin("http", "[::1]", -1, "http://[::1]")); diff --git a/spring-webflux/src/test/java/org/springframework/web/reactive/resource/AppCacheManifestTransformerTests.java b/spring-webflux/src/test/java/org/springframework/web/reactive/resource/AppCacheManifestTransformerTests.java index 16eec426d57..d475072a88e 100644 --- a/spring-webflux/src/test/java/org/springframework/web/reactive/resource/AppCacheManifestTransformerTests.java +++ b/spring-webflux/src/test/java/org/springframework/web/reactive/resource/AppCacheManifestTransformerTests.java @@ -109,7 +109,7 @@ public class AppCacheManifestTransformerTests { containsString("/static/js/bar-bd508c62235b832d960298ca6c0b7645.js")); assertThat("should not rewrite external resources", content, containsString("//example.org/style.css")); - assertThat("should not rewrite external resources", content, containsString("https://example.org/image.png")); + assertThat("should not rewrite external resources", content, containsString("http://example.org/image.png")); // Not the same hash as Spring MVC // Hash is computed from links, and not from the linked content diff --git a/spring-webflux/src/test/resources/org/springframework/web/reactive/resource/test/test.appcache b/spring-webflux/src/test/resources/org/springframework/web/reactive/resource/test/test.appcache index 986d1055a64..76e2f32a98d 100644 --- a/spring-webflux/src/test/resources/org/springframework/web/reactive/resource/test/test.appcache +++ b/spring-webflux/src/test/resources/org/springframework/web/reactive/resource/test/test.appcache @@ -11,7 +11,7 @@ NETWORK: CACHE: js/bar.js -https://example.org/image.png +http://example.org/image.png FALLBACK: /main /static.html \ No newline at end of file diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilderTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilderTests.java index 1b4a5a5ce97..829a50f191d 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilderTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilderTests.java @@ -141,6 +141,7 @@ public class MvcUriComponentsBuilderTests { @Test public void usesForwardedHostAsHostIfHeaderIsSet() throws Exception { + this.request.setScheme("https"); this.request.addHeader("X-Forwarded-Host", "somethingDifferent"); adaptRequestFromForwardedHeaders(); UriComponents uriComponents = fromController(PersonControllerImpl.class).build(); @@ -150,6 +151,7 @@ public class MvcUriComponentsBuilderTests { @Test public void usesForwardedHostAndPortFromHeader() throws Exception { + this.request.setScheme("https"); request.addHeader("X-Forwarded-Host", "foobar:8088"); adaptRequestFromForwardedHeaders(); UriComponents uriComponents = fromController(PersonControllerImpl.class).build(); @@ -159,6 +161,7 @@ public class MvcUriComponentsBuilderTests { @Test public void usesFirstHostOfXForwardedHost() throws Exception { + this.request.setScheme("https"); this.request.addHeader("X-Forwarded-Host", "barfoo:8888, localhost:8088"); adaptRequestFromForwardedHeaders(); UriComponents uriComponents = fromController(PersonControllerImpl.class).build(); @@ -420,6 +423,7 @@ public class MvcUriComponentsBuilderTests { initWebApplicationContext(PathPrefixWebConfig.class); + this.request.setScheme("https"); this.request.setServerName("example.org"); this.request.setServerPort(9999); this.request.setContextPath("/base"); @@ -433,6 +437,7 @@ public class MvcUriComponentsBuilderTests { initWebApplicationContext(PathPrefixWebConfig.class); + this.request.setScheme("https"); this.request.setServerName("example.org"); this.request.setServerPort(9999); this.request.setContextPath("/base"); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/resource/AppCacheManifestTransformerTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/resource/AppCacheManifestTransformerTests.java index 52a98e6f8b0..98a2f7a4774 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/resource/AppCacheManifestTransformerTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/resource/AppCacheManifestTransformerTests.java @@ -111,7 +111,7 @@ public class AppCacheManifestTransformerTests { containsString("/static/js/bar-bd508c62235b832d960298ca6c0b7645.js")); assertThat("should not rewrite external resources", content, containsString("//example.org/style.css")); - assertThat("should not rewrite external resources", content, containsString("https://example.org/image.png")); + assertThat("should not rewrite external resources", content, containsString("http://example.org/image.png")); assertThat("should generate fingerprint", content, containsString("# Hash: 4bf0338bcbeb0a5b3a4ec9ed8864107d")); diff --git a/spring-webmvc/src/test/resources/org/springframework/web/servlet/resource/test/test.appcache b/spring-webmvc/src/test/resources/org/springframework/web/servlet/resource/test/test.appcache index 986d1055a64..76e2f32a98d 100644 --- a/spring-webmvc/src/test/resources/org/springframework/web/servlet/resource/test/test.appcache +++ b/spring-webmvc/src/test/resources/org/springframework/web/servlet/resource/test/test.appcache @@ -11,7 +11,7 @@ NETWORK: CACHE: js/bar.js -https://example.org/image.png +http://example.org/image.png FALLBACK: /main /static.html \ No newline at end of file diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/config/HandlersBeanDefinitionParserTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/config/HandlersBeanDefinitionParserTests.java index 982ff005583..bcf317b516f 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/config/HandlersBeanDefinitionParserTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/config/HandlersBeanDefinitionParserTests.java @@ -225,7 +225,7 @@ public class HandlersBeanDefinitionParserTests { assertThat(interceptors, contains(instanceOf(OriginHandshakeInterceptor.class))); assertTrue(transportService.shouldSuppressCors()); assertTrue(transportService.getAllowedOrigins().contains("https://mydomain1.com")); - assertTrue(transportService.getAllowedOrigins().contains("/QTifZ/")); + assertTrue(transportService.getAllowedOrigins().contains("https://mydomain2.com")); } diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java index 8679f30bed9..5e7e487cad0 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/config/MessageBrokerBeanDefinitionParserTests.java @@ -184,8 +184,8 @@ public class MessageBrokerBeanDefinitionParserTests { interceptors = defaultSockJsService.getHandshakeInterceptors(); assertThat(interceptors, contains(instanceOf(FooTestInterceptor.class), instanceOf(BarTestInterceptor.class), instanceOf(OriginHandshakeInterceptor.class))); - assertTrue(defaultSockJsService.getAllowedOrigins().contains("http://mydomain3.com")); - assertTrue(defaultSockJsService.getAllowedOrigins().contains("http://www.mydomain4.com/")); + assertTrue(defaultSockJsService.getAllowedOrigins().contains("https://mydomain3.com")); + assertTrue(defaultSockJsService.getAllowedOrigins().contains("https://mydomain4.com")); SimpUserRegistry userRegistry = this.appContext.getBean(SimpUserRegistry.class); assertNotNull(userRegistry); diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/server/support/OriginHandshakeInterceptorTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/server/support/OriginHandshakeInterceptorTests.java index 178777b2214..23ec8f08d9e 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/server/support/OriginHandshakeInterceptorTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/server/support/OriginHandshakeInterceptorTests.java @@ -117,7 +117,7 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests { public void sameOriginMatchWithEmptyAllowedOrigins() throws Exception { Map attributes = new HashMap<>(); WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class); - this.servletRequest.addHeader(HttpHeaders.ORIGIN, "/QTifZ/"); + this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain2.com"); this.servletRequest.setServerName("mydomain2.com"); OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(Collections.emptyList()); assertTrue(interceptor.beforeHandshake(request, response, wsHandler, attributes)); @@ -128,9 +128,9 @@ public class OriginHandshakeInterceptorTests extends AbstractHttpRequestTests { public void sameOriginMatchWithAllowedOrigins() throws Exception { Map attributes = new HashMap<>(); WebSocketHandler wsHandler = Mockito.mock(WebSocketHandler.class); - this.servletRequest.addHeader(HttpHeaders.ORIGIN, "/QTifZ/"); + this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain2.com"); this.servletRequest.setServerName("mydomain2.com"); - OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(Arrays.asList("https://mydomain1.com")); + OriginHandshakeInterceptor interceptor = new OriginHandshakeInterceptor(Arrays.asList("http://mydomain1.com")); assertTrue(interceptor.beforeHandshake(request, response, wsHandler, attributes)); assertNotEquals(servletResponse.getStatus(), HttpStatus.FORBIDDEN.value()); } diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java index f538f95d766..f43e44e250c 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/support/SockJsServiceTests.java @@ -114,7 +114,7 @@ public class SockJsServiceTests extends AbstractHttpRequestTests { @Test // SPR-12226 and SPR-12660 public void handleInfoGetWithOrigin() throws IOException { this.servletRequest.setServerName("mydomain2.com"); - this.servletRequest.addHeader(HttpHeaders.ORIGIN, "/QTifZ/"); + this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain2.com"); resetResponseAndHandleRequest("GET", "/echo/info", HttpStatus.OK); assertEquals("application/json;charset=UTF-8", this.servletResponse.getContentType()); @@ -125,17 +125,17 @@ public class SockJsServiceTests extends AbstractHttpRequestTests { assertEquals(",\"origins\":[\"*:*\"],\"cookie_needed\":true,\"websocket\":true}", body.substring(body.indexOf(','))); - this.service.setAllowedOrigins(Collections.singletonList("https://mydomain1.com")); + this.service.setAllowedOrigins(Collections.singletonList("http://mydomain1.com")); resetResponseAndHandleRequest("GET", "/echo/info", HttpStatus.OK); - this.service.setAllowedOrigins(Arrays.asList("https://mydomain1.com", "/QTifZ/", "http://mydomain3.com")); + this.service.setAllowedOrigins(Arrays.asList("http://mydomain1.com", "http://mydomain2.com", "http://mydomain3.com")); resetResponseAndHandleRequest("GET", "/echo/info", HttpStatus.OK); this.service.setAllowedOrigins(Collections.singletonList("*")); resetResponseAndHandleRequest("GET", "/echo/info", HttpStatus.OK); this.servletRequest.setServerName("mydomain3.com"); - this.service.setAllowedOrigins(Collections.singletonList("https://mydomain1.com")); + this.service.setAllowedOrigins(Collections.singletonList("http://mydomain1.com")); resetResponseAndHandleRequest("GET", "/echo/info", HttpStatus.FORBIDDEN); } @@ -176,17 +176,17 @@ public class SockJsServiceTests extends AbstractHttpRequestTests { @Test // SPR-12226 and SPR-12660 public void handleInfoOptionsWithAllowedOrigin() { this.servletRequest.setServerName("mydomain2.com"); - this.servletRequest.addHeader(HttpHeaders.ORIGIN, "/QTifZ/"); + this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain2.com"); this.servletRequest.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); this.servletRequest.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Last-Modified"); resetResponseAndHandleRequest("OPTIONS", "/echo/info", HttpStatus.NO_CONTENT); assertNotNull(this.service.getCorsConfiguration(this.servletRequest)); - this.service.setAllowedOrigins(Collections.singletonList("https://mydomain1.com")); + this.service.setAllowedOrigins(Collections.singletonList("http://mydomain1.com")); resetResponseAndHandleRequest("OPTIONS", "/echo/info", HttpStatus.NO_CONTENT); assertNotNull(this.service.getCorsConfiguration(this.servletRequest)); - this.service.setAllowedOrigins(Arrays.asList("https://mydomain1.com", "/QTifZ/", "http://mydomain3.com")); + this.service.setAllowedOrigins(Arrays.asList("http://mydomain1.com", "http://mydomain2.com", "http://mydomain3.com")); resetResponseAndHandleRequest("OPTIONS", "/echo/info", HttpStatus.NO_CONTENT); assertNotNull(this.service.getCorsConfiguration(this.servletRequest)); @@ -198,7 +198,7 @@ public class SockJsServiceTests extends AbstractHttpRequestTests { @Test // SPR-16304 public void handleInfoOptionsWithForbiddenOrigin() { this.servletRequest.setServerName("mydomain3.com"); - this.servletRequest.addHeader(HttpHeaders.ORIGIN, "/QTifZ/"); + this.servletRequest.addHeader(HttpHeaders.ORIGIN, "https://mydomain2.com"); this.servletRequest.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "GET"); this.servletRequest.addHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, "Last-Modified"); resetResponseAndHandleRequest("OPTIONS", "/echo/info", HttpStatus.FORBIDDEN); @@ -213,7 +213,7 @@ public class SockJsServiceTests extends AbstractHttpRequestTests { @Test // SPR-12283 public void handleInfoOptionsWithOriginAndCorsHeadersDisabled() { - this.servletRequest.addHeader(HttpHeaders.ORIGIN, "/QTifZ/"); + this.servletRequest.addHeader(HttpHeaders.ORIGIN, "https://mydomain2.com"); this.service.setAllowedOrigins(Collections.singletonList("*")); this.service.setSuppressCors(true); @@ -225,7 +225,7 @@ public class SockJsServiceTests extends AbstractHttpRequestTests { resetResponseAndHandleRequest("OPTIONS", "/echo/info", HttpStatus.FORBIDDEN); assertNull(this.service.getCorsConfiguration(this.servletRequest)); - this.service.setAllowedOrigins(Arrays.asList("https://mydomain1.com", "/QTifZ/", "http://mydomain3.com")); + this.service.setAllowedOrigins(Arrays.asList("https://mydomain1.com", "https://mydomain2.com", "http://mydomain3.com")); resetResponseAndHandleRequest("OPTIONS", "/echo/info", HttpStatus.NO_CONTENT); assertNull(this.service.getCorsConfiguration(this.servletRequest)); } diff --git a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/handler/DefaultSockJsServiceTests.java b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/handler/DefaultSockJsServiceTests.java index 424aa627c1c..f76116b0641 100644 --- a/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/handler/DefaultSockJsServiceTests.java +++ b/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/handler/DefaultSockJsServiceTests.java @@ -149,7 +149,7 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests { public void handleTransportRequestXhrAllowedOriginsMatch() throws Exception { String sockJsPath = sessionUrlPrefix + "xhr"; setRequest("POST", sockJsPrefix + sockJsPath); - this.service.setAllowedOrigins(Arrays.asList("https://mydomain1.com", "/QTifZ/")); + this.service.setAllowedOrigins(Arrays.asList("https://mydomain1.com", "https://mydomain2.com")); this.servletRequest.addHeader(HttpHeaders.ORIGIN, "https://mydomain1.com"); this.service.handleRequest(this.request, this.response, sockJsPath, this.wsHandler); @@ -160,7 +160,7 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests { public void handleTransportRequestXhrAllowedOriginsNoMatch() throws Exception { String sockJsPath = sessionUrlPrefix + "xhr"; setRequest("POST", sockJsPrefix + sockJsPath); - this.service.setAllowedOrigins(Arrays.asList("https://mydomain1.com", "/QTifZ/")); + this.service.setAllowedOrigins(Arrays.asList("https://mydomain1.com", "https://mydomain2.com")); this.servletRequest.addHeader(HttpHeaders.ORIGIN, "http://mydomain3.com"); this.service.handleRequest(this.request, this.response, sockJsPath, this.wsHandler); @@ -172,7 +172,7 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests { String sockJsPath = sessionUrlPrefix + "xhr"; setRequest("POST", sockJsPrefix + sockJsPath); this.service.setAllowedOrigins(Arrays.asList("https://mydomain1.com")); - this.servletRequest.addHeader(HttpHeaders.ORIGIN, "/QTifZ/"); + this.servletRequest.addHeader(HttpHeaders.ORIGIN, "https://mydomain1.com"); this.servletRequest.setServerName("mydomain2.com"); this.service.handleRequest(this.request, this.response, sockJsPath, this.wsHandler); @@ -184,7 +184,7 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests { String sockJsPath = sessionUrlPrefix + "invalid"; setRequest("POST", sockJsPrefix + sockJsPath); this.service.setAllowedOrigins(Arrays.asList("https://mydomain1.com")); - this.servletRequest.addHeader(HttpHeaders.ORIGIN, "/QTifZ/"); + this.servletRequest.addHeader(HttpHeaders.ORIGIN, "https://mydomain2.com"); this.servletRequest.setServerName("mydomain2.com"); this.service.handleRequest(this.request, this.response, sockJsPath, this.wsHandler); @@ -280,7 +280,7 @@ public class DefaultSockJsServiceTests extends AbstractHttpRequestTests { resetRequestAndResponse(); setRequest("GET", sockJsPrefix + sockJsPath); - this.servletRequest.addHeader(HttpHeaders.ORIGIN, "/QTifZ/"); + this.servletRequest.addHeader(HttpHeaders.ORIGIN, "https://mydomain2.com"); wsService.handleRequest(this.request, this.response, sockJsPath, this.wsHandler); assertEquals(403, this.servletResponse.getStatus()); }