Skip to content

Commit 15c0213

Browse files
committed
SWS-967 Add other build profiles
* Make it possible to run the build with different dependencies and different version of JDK * Fix JUnit to make it forward compatible * Fix other things that are deprecated in Spring 4.3 and removed in Spring 5
1 parent 00e61b7 commit 15c0213

File tree

8 files changed

+105
-8
lines changed

8 files changed

+105
-8
lines changed

build.gradle

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ configure(allprojects) {
5050
}
5151

5252
repositories {
53-
maven { url 'http://repo.spring.io/libs-release' }
53+
maven { url 'https://repo.spring.io/libs-release' }
5454
}
5555

5656
dependencies {
5757
compile("commons-logging:commons-logging:1.1.3")
5858
compile("org.springframework:spring-core:$springVersion")
5959

60-
testCompile("junit:junit:4.10")
60+
testCompile("junit:junit:4.12")
6161
testCompile("org.easymock:easymock:3.1")
6262
testCompile("xmlunit:xmlunit:1.5")
6363
testCompile("com.sun.mail:javax.mail:1.5.4")
@@ -84,7 +84,15 @@ configure(subprojects) { subproject ->
8484
apply plugin: "propdeps-maven"
8585
apply from: "${rootProject.projectDir}/publish-maven.gradle"
8686

87-
if (project.hasProperty('platformVersion')) {
87+
/**
88+
* To run an alternate profile...
89+
* ./gradlew -Pprofile=spring4-next clean build
90+
* ./gradlew -Pprofile=spring5 clean build
91+
*/
92+
if (project.hasProperty('profile')) {
93+
apply from: "${project.rootDir}/${profile}-profile.gradle"
94+
println "+++ Configuring ${subproject.name} for Spring Framework ${springVersion}"
95+
} else if (project.hasProperty('platformVersion')) {
8896
apply plugin: 'spring-io'
8997

9098
repositories {
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright 2016 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.ws.support;
17+
18+
/**
19+
* Miscellaneous utilities for web applications. Used by various framework classes.
20+
*
21+
* NOTE: These are the parts of org.springframework.web.util.WebUtils deprecated in Spring Framework 5.
22+
*
23+
* @author Greg Turnquist
24+
* @author Rod Johnson
25+
* @author Juergen Hoeller
26+
* @author Sebastien Deleuze
27+
* @since 2.4.0
28+
*/
29+
public abstract class WebUtils {
30+
31+
/**
32+
* Extract the URL filename from the given request URL path.
33+
* Correctly resolves nested paths such as "/products/view.html" as well.
34+
* @param urlPath the request URL path (e.g. "/index.html")
35+
* @return the extracted URI filename (e.g. "index")
36+
*/
37+
public static String extractFilenameFromUrlPath(String urlPath) {
38+
String filename = extractFullFilenameFromUrlPath(urlPath);
39+
int dotIndex = filename.lastIndexOf('.');
40+
if (dotIndex != -1) {
41+
filename = filename.substring(0, dotIndex);
42+
}
43+
return filename;
44+
}
45+
46+
/**
47+
* Extract the full URL filename (including file extension) from the given
48+
* request URL path. Correctly resolve nested paths such as
49+
* "/products/view.html" and remove any path and or query parameters.
50+
* @param urlPath the request URL path (e.g. "/products/index.html")
51+
* @return the extracted URI filename (e.g. "index.html")
52+
*/
53+
public static String extractFullFilenameFromUrlPath(String urlPath) {
54+
int end = urlPath.indexOf('?');
55+
if (end == -1) {
56+
end = urlPath.indexOf('#');
57+
if (end == -1) {
58+
end = urlPath.length();
59+
}
60+
}
61+
int begin = urlPath.lastIndexOf('/', end) + 1;
62+
int paramIndex = urlPath.indexOf(';', begin);
63+
end = (paramIndex != -1 && paramIndex < end ? paramIndex : end);
64+
return urlPath.substring(begin, end);
65+
}
66+
67+
68+
}

spring-ws-core/src/main/java/org/springframework/ws/transport/http/MessageDispatcherServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
import org.springframework.web.context.WebApplicationContext;
2929
import org.springframework.web.servlet.DispatcherServlet;
3030
import org.springframework.web.servlet.FrameworkServlet;
31-
import org.springframework.web.util.WebUtils;
3231
import org.springframework.ws.WebServiceMessageFactory;
3332
import org.springframework.ws.server.EndpointAdapter;
3433
import org.springframework.ws.server.EndpointExceptionResolver;
3534
import org.springframework.ws.server.EndpointMapping;
3635
import org.springframework.ws.server.MessageDispatcher;
3736
import org.springframework.ws.support.DefaultStrategiesHelper;
3837
import org.springframework.ws.transport.WebServiceMessageReceiver;
38+
import org.springframework.ws.support.WebUtils;
3939
import org.springframework.ws.wsdl.WsdlDefinition;
4040
import org.springframework.xml.xsd.XsdSchema;
4141

spring-ws-core/src/test/java/org/springframework/ws/transport/http/HttpComponentsMessageSenderIntegrationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
package org.springframework.ws.transport.http;
1818

1919
import static org.hamcrest.core.IsEqual.*;
20-
import static org.springframework.test.util.MatcherAssertionErrors.*;
21-
import static org.junit.Assert.assertTrue;
20+
import static org.junit.Assert.*;
2221

2322
import java.io.IOException;
2423
import java.net.URI;
2524
import java.net.URISyntaxException;
2625
import java.util.HashMap;
2726
import java.util.Map;
27+
2828
import javax.servlet.ServletException;
2929
import javax.servlet.http.HttpServlet;
3030
import javax.servlet.http.HttpServletRequest;

spring-ws-core/src/test/resources/org/springframework/ws/config/interceptorsBeanDefinitionParserOrderTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</bean>
1919
</sws:payloadRoot>
2020
<sws:soapAction value="mySoapAction">
21-
<ref local="externalSoapActionInterceptor"/>
21+
<ref bean="externalSoapActionInterceptor"/>
2222
<bean class="org.springframework.ws.config.MyInterceptor">
2323
<property name="order" value="5"/>
2424
</bean>

spring-ws-core/src/test/resources/org/springframework/ws/config/interceptorsBeanDefinitionParserTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</sws:payloadRoot>
1616
<sws:soapAction value="mySoapAction">
1717
<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
18-
<ref local="externalSoapActionInterceptor"/>
18+
<ref bean="externalSoapActionInterceptor"/>
1919
<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
2020
</sws:soapAction>
2121
</sws:interceptors>

spring4-next-profile.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Enable with "-Pprofile=spring4-next"
3+
*/
4+
5+
ext.springVersion = "4.3.2.RELEASE"
6+
ext.springSecurityVersion = "4.1.3.RELEASE"

spring5-profile.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Enable with "-Pprofile=spring5"
3+
*/
4+
5+
ext.springVersion = "5.0.0.BUILD-SNAPSHOT"
6+
ext.springSecurityVersion = "4.2.0.BUILD-SNAPSHOT"
7+
8+
compileJava {
9+
sourceCompatibility=1.8
10+
targetCompatibility=1.8
11+
}
12+
13+
repositories {
14+
maven { url 'https://repo.spring.io/libs-snapshot' }
15+
}

0 commit comments

Comments
 (0)