diff --git a/spring-boot-samples/pom.xml b/spring-boot-samples/pom.xml index f0f48f457d..4c0aaecd61 100644 --- a/spring-boot-samples/pom.xml +++ b/spring-boot-samples/pom.xml @@ -41,7 +41,7 @@ spring-boot-sample-jersey spring-boot-sample-jersey1 spring-boot-sample-jetty - spring-boot-sample-jetty9 + spring-boot-sample-jetty8 spring-boot-sample-jta-atomikos spring-boot-sample-jta-bitronix spring-boot-sample-jta-jndi @@ -51,10 +51,11 @@ spring-boot-sample-secure spring-boot-sample-servlet spring-boot-sample-simple + spring-boot-sample-tomcat-jsp spring-boot-sample-tomcat-ssl spring-boot-sample-tomcat spring-boot-sample-tomcat-multi-connectors - spring-boot-sample-tomcat8-jsp + spring-boot-sample-tomcat7-jsp spring-boot-sample-traditional spring-boot-sample-velocity spring-boot-sample-web-freemarker diff --git a/spring-boot-samples/spring-boot-sample-jetty9/pom.xml b/spring-boot-samples/spring-boot-sample-jetty8/pom.xml similarity index 82% rename from spring-boot-samples/spring-boot-sample-jetty9/pom.xml rename to spring-boot-samples/spring-boot-sample-jetty8/pom.xml index a6fba953e8..81de7f9362 100644 --- a/spring-boot-samples/spring-boot-sample-jetty9/pom.xml +++ b/spring-boot-samples/spring-boot-sample-jetty8/pom.xml @@ -7,9 +7,9 @@ spring-boot-samples 1.2.0.BUILD-SNAPSHOT - spring-boot-sample-jetty9 - Spring Boot Jetty Sample - Spring Boot Jetty 9 Sample + spring-boot-sample-jetty8 + Spring Boot Jetty 8 Sample + Spring Boot Jetty 8 Sample http://projects.spring.io/spring-boot/ Pivotal Software, Inc. @@ -17,8 +17,9 @@ ${basedir}/../.. - 9.2.3.v20140905 - 3.1.0 + 8.1.15.v20140411 + 2.2.0.v201112011158 + 3.0.1 diff --git a/spring-boot-samples/spring-boot-sample-jetty9/src/main/java/sample/jetty/SampleJetty9Application.java b/spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty/SampleJetty8Application.java similarity index 90% rename from spring-boot-samples/spring-boot-sample-jetty9/src/main/java/sample/jetty/SampleJetty9Application.java rename to spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty/SampleJetty8Application.java index fd41955b10..5ab619eb31 100644 --- a/spring-boot-samples/spring-boot-sample-jetty9/src/main/java/sample/jetty/SampleJetty9Application.java +++ b/spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty/SampleJetty8Application.java @@ -24,10 +24,10 @@ import org.springframework.context.annotation.Configuration; @Configuration @EnableAutoConfiguration @ComponentScan -public class SampleJetty9Application { +public class SampleJetty8Application { public static void main(String[] args) throws Exception { - SpringApplication.run(SampleJetty9Application.class, args); + SpringApplication.run(SampleJetty8Application.class, args); } } diff --git a/spring-boot-samples/spring-boot-sample-jetty9/src/main/java/sample/jetty/service/HelloWorldService.java b/spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty/service/HelloWorldService.java similarity index 100% rename from spring-boot-samples/spring-boot-sample-jetty9/src/main/java/sample/jetty/service/HelloWorldService.java rename to spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty/service/HelloWorldService.java diff --git a/spring-boot-samples/spring-boot-sample-jetty9/src/main/java/sample/jetty/web/SampleController.java b/spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty/web/SampleController.java similarity index 100% rename from spring-boot-samples/spring-boot-sample-jetty9/src/main/java/sample/jetty/web/SampleController.java rename to spring-boot-samples/spring-boot-sample-jetty8/src/main/java/sample/jetty/web/SampleController.java diff --git a/spring-boot-samples/spring-boot-sample-jetty9/src/test/java/sample/jetty/SampleJettyApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty/SampleJettyApplicationTests.java similarity index 96% rename from spring-boot-samples/spring-boot-sample-jetty9/src/test/java/sample/jetty/SampleJettyApplicationTests.java rename to spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty/SampleJettyApplicationTests.java index 84a4a57cba..abe3f2f996 100644 --- a/spring-boot-samples/spring-boot-sample-jetty9/src/test/java/sample/jetty/SampleJettyApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-jetty8/src/test/java/sample/jetty/SampleJettyApplicationTests.java @@ -36,7 +36,7 @@ import static org.junit.Assert.assertEquals; * @author Dave Syer */ @RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes = SampleJetty9Application.class) +@SpringApplicationConfiguration(classes = SampleJetty8Application.class) @WebAppConfiguration @IntegrationTest("server.port:0") @DirtiesContext diff --git a/spring-boot-samples/spring-boot-sample-tomcat8-jsp/pom.xml b/spring-boot-samples/spring-boot-sample-tomcat-jsp/pom.xml similarity index 88% rename from spring-boot-samples/spring-boot-sample-tomcat8-jsp/pom.xml rename to spring-boot-samples/spring-boot-sample-tomcat-jsp/pom.xml index 908c792cda..86778cb23d 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat8-jsp/pom.xml +++ b/spring-boot-samples/spring-boot-sample-tomcat-jsp/pom.xml @@ -7,10 +7,10 @@ spring-boot-samples 1.2.0.BUILD-SNAPSHOT - spring-boot-sample-tomcat8-jsp + spring-boot-sample-tomcat-jsp war - Spring Boot Tomcat 8 JSP Sample - Spring Boot Tomcat 8 JSP Sample + Spring Boot Tomcat JSP Sample + Spring Boot Tomcat JSP Sample http://projects.spring.io/spring-boot/ Pivotal Software, Inc. @@ -19,7 +19,8 @@ ${basedir}/../.. / - 8.0.8 + 7.0.56 + 3.0.1 1.7 diff --git a/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/java/sample/jsp/SampleTomcatJspApplication.java b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/java/sample/jsp/SampleTomcatJspApplication.java new file mode 100644 index 0000000000..749edab820 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/java/sample/jsp/SampleTomcatJspApplication.java @@ -0,0 +1,40 @@ +/* + * Copyright 2012-2013 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. + * You may obtain a copy of the License at + * + * http://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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample.jsp; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.context.web.SpringBootServletInitializer; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@EnableAutoConfiguration +@ComponentScan +public class SampleTomcatJspApplication extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(SampleTomcatJspApplication.class); + } + + public static void main(String[] args) throws Exception { + SpringApplication.run(SampleTomcatJspApplication.class, args); + } + +} diff --git a/spring-boot-samples/spring-boot-sample-tomcat8-jsp/src/main/java/sample/jsp/WelcomeController.java b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/java/sample/jsp/WelcomeController.java similarity index 100% rename from spring-boot-samples/spring-boot-sample-tomcat8-jsp/src/main/java/sample/jsp/WelcomeController.java rename to spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/java/sample/jsp/WelcomeController.java diff --git a/spring-boot-samples/spring-boot-sample-tomcat8-jsp/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/resources/application.properties similarity index 100% rename from spring-boot-samples/spring-boot-sample-tomcat8-jsp/src/main/resources/application.properties rename to spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/resources/application.properties diff --git a/spring-boot-samples/spring-boot-sample-tomcat8-jsp/src/main/webapp/WEB-INF/jsp/welcome.jsp b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/webapp/WEB-INF/jsp/welcome.jsp similarity index 100% rename from spring-boot-samples/spring-boot-sample-tomcat8-jsp/src/main/webapp/WEB-INF/jsp/welcome.jsp rename to spring-boot-samples/spring-boot-sample-tomcat-jsp/src/main/webapp/WEB-INF/jsp/welcome.jsp diff --git a/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java new file mode 100644 index 0000000000..eab03b070f --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-tomcat-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java @@ -0,0 +1,58 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample.jsp; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.IntegrationTest; +import org.springframework.boot.test.SpringApplicationConfiguration; +import org.springframework.boot.test.TestRestTemplate; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * Basic integration tests for JSP application. + * + * @author Phillip Webb + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringApplicationConfiguration(classes = SampleTomcatJspApplication.class) +@WebAppConfiguration +@IntegrationTest("server.port:0") +@DirtiesContext +public class SampleWebJspApplicationTests { + + @Value("${local.server.port}") + private int port; + + @Test + public void testJspWithEl() throws Exception { + ResponseEntity entity = new TestRestTemplate().getForEntity( + "http://localhost:" + this.port, String.class); + assertEquals(HttpStatus.OK, entity.getStatusCode()); + assertTrue("Wrong body:\n" + entity.getBody(), + entity.getBody().contains("/resources/text.txt")); + } + +} diff --git a/spring-boot-samples/spring-boot-sample-tomcat7-jsp/pom.xml b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/pom.xml new file mode 100644 index 0000000000..af1cc4c8bb --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/pom.xml @@ -0,0 +1,66 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-samples + 1.2.0.BUILD-SNAPSHOT + + spring-boot-sample-tomcat7-jsp + war + Spring Boot Tomcat 7 JSP Sample + Spring Boot Tomcat 7 JSP Sample + http://projects.spring.io/spring-boot/ + + Pivotal Software, Inc. + http://www.spring.io + + + ${basedir}/../.. + / + 7.0.56 + 3.0.1 + 1.7 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + org.apache.tomcat.embed + tomcat-embed-jasper + provided + + + javax.servlet + jstl + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + false + + + + + diff --git a/spring-boot-samples/spring-boot-sample-tomcat8-jsp/src/main/java/sample/jsp/SampleTomcat8JspApplication.java b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/java/sample/jsp/SampleTomcat7JspApplication.java similarity index 86% rename from spring-boot-samples/spring-boot-sample-tomcat8-jsp/src/main/java/sample/jsp/SampleTomcat8JspApplication.java rename to spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/java/sample/jsp/SampleTomcat7JspApplication.java index 6ab7e320f3..a49af37a57 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat8-jsp/src/main/java/sample/jsp/SampleTomcat8JspApplication.java +++ b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/java/sample/jsp/SampleTomcat7JspApplication.java @@ -26,15 +26,15 @@ import org.springframework.context.annotation.Configuration; @Configuration @EnableAutoConfiguration @ComponentScan -public class SampleTomcat8JspApplication extends SpringBootServletInitializer { +public class SampleTomcat7JspApplication extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { - return application.sources(SampleTomcat8JspApplication.class); + return application.sources(SampleTomcat7JspApplication.class); } public static void main(String[] args) throws Exception { - SpringApplication.run(SampleTomcat8JspApplication.class, args); + SpringApplication.run(SampleTomcat7JspApplication.class, args); } } diff --git a/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/java/sample/jsp/WelcomeController.java b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/java/sample/jsp/WelcomeController.java new file mode 100644 index 0000000000..03d439caa3 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/java/sample/jsp/WelcomeController.java @@ -0,0 +1,39 @@ +/* + * Copyright 2012-2014 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. + * You may obtain a copy of the License at + * + * http://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, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package sample.jsp; + +import java.util.Date; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class WelcomeController { + + @Value("${application.message:Hello World}") + private String message = "Hello World"; + + @RequestMapping("/") + public String welcome(Map model) { + model.put("time", new Date()); + model.put("message", this.message); + return "welcome"; + } + +} diff --git a/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/resources/application.properties new file mode 100644 index 0000000000..f95f1d3c01 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/resources/application.properties @@ -0,0 +1,3 @@ +spring.view.prefix: /WEB-INF/jsp/ +spring.view.suffix: .jsp +application.message: Hello Phil \ No newline at end of file diff --git a/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/webapp/WEB-INF/jsp/welcome.jsp b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/webapp/WEB-INF/jsp/welcome.jsp new file mode 100644 index 0000000000..3196dac625 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/main/webapp/WEB-INF/jsp/welcome.jsp @@ -0,0 +1,18 @@ + + +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> + + + + + + + Spring URL: ${springUrl} at ${time} +
+ JSTL URL: ${url} +
+ Message: ${message} + + + diff --git a/spring-boot-samples/spring-boot-sample-tomcat8-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java similarity index 96% rename from spring-boot-samples/spring-boot-sample-tomcat8-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java rename to spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java index 1df76c49b8..f51062a3ba 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat8-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat7-jsp/src/test/java/sample/jsp/SampleWebJspApplicationTests.java @@ -37,7 +37,7 @@ import static org.junit.Assert.assertTrue; * @author Phillip Webb */ @RunWith(SpringJUnit4ClassRunner.class) -@SpringApplicationConfiguration(classes = SampleTomcat8JspApplication.class) +@SpringApplicationConfiguration(classes = SampleTomcat7JspApplication.class) @WebAppConfiguration @IntegrationTest("server.port:0") @DirtiesContext