From 9c77708fcb75486d66cc57e003132616c5fb3a0b Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 25 Jan 2017 13:54:25 +0000 Subject: [PATCH] Remove Jetty 9.3 sample that was missed in dbd10a8d See gh-7985 --- .../spring-boot-sample-jetty93/pom.xml | 52 ------------ .../ExampleServletContextListener.java | 40 --------- .../jetty93/SampleJetty93Application.java | 29 ------- .../jetty93/service/HelloWorldService.java | 32 ------- .../sample/jetty93/web/SampleController.java | 43 ---------- .../src/main/resources/application.properties | 4 - .../jetty93/SampleJettyApplicationTests.java | 84 ------------------- 7 files changed, 284 deletions(-) delete mode 100644 spring-boot-samples/spring-boot-sample-jetty93/pom.xml delete mode 100644 spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/ExampleServletContextListener.java delete mode 100644 spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/SampleJetty93Application.java delete mode 100644 spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/service/HelloWorldService.java delete mode 100644 spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/web/SampleController.java delete mode 100644 spring-boot-samples/spring-boot-sample-jetty93/src/main/resources/application.properties delete mode 100644 spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJettyApplicationTests.java diff --git a/spring-boot-samples/spring-boot-sample-jetty93/pom.xml b/spring-boot-samples/spring-boot-sample-jetty93/pom.xml deleted file mode 100644 index 0d66daf3d6..0000000000 --- a/spring-boot-samples/spring-boot-sample-jetty93/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - 4.0.0 - - - org.springframework.boot - spring-boot-samples - 2.0.0.BUILD-SNAPSHOT - - spring-boot-sample-jetty93 - Spring Boot Jetty 9.3 Sample - Spring Boot Jetty 9.3 Sample - http://projects.spring.io/spring-boot/ - - Pivotal Software, Inc. - http://www.spring.io - - - ${basedir}/../.. - 9.3.14.v20161028 - - - - - org.springframework.boot - spring-boot-starter - - - org.springframework.boot - spring-boot-starter-jetty - - - org.springframework - spring-webmvc - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - diff --git a/spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/ExampleServletContextListener.java b/spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/ExampleServletContextListener.java deleted file mode 100644 index 0e6eb553b7..0000000000 --- a/spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/ExampleServletContextListener.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.jetty93; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.springframework.stereotype.Component; - -/** - * Simple {@link ServletContextListener} to test gh-2058. - */ -@Component -public class ExampleServletContextListener implements ServletContextListener { - - @Override - public void contextInitialized(ServletContextEvent sce) { - System.out.println("*** contextInitialized"); - } - - @Override - public void contextDestroyed(ServletContextEvent sce) { - System.out.println("*** contextDestroyed"); - } - -} diff --git a/spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/SampleJetty93Application.java b/spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/SampleJetty93Application.java deleted file mode 100644 index 9230b27330..0000000000 --- a/spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/SampleJetty93Application.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.jetty93; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class SampleJetty93Application { - - public static void main(String[] args) throws Exception { - SpringApplication.run(SampleJetty93Application.class, args); - } - -} diff --git a/spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/service/HelloWorldService.java b/spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/service/HelloWorldService.java deleted file mode 100644 index 837ac9f2a2..0000000000 --- a/spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/service/HelloWorldService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.jetty93.service; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -@Component -public class HelloWorldService { - - @Value("${name:World}") - private String name; - - public String getHelloMessage() { - return "Hello " + this.name; - } - -} diff --git a/spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/web/SampleController.java b/spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/web/SampleController.java deleted file mode 100644 index e7c23183f1..0000000000 --- a/spring-boot-samples/spring-boot-sample-jetty93/src/main/java/sample/jetty93/web/SampleController.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.jetty93.web; - -import java.util.Date; - -import javax.servlet.http.HttpServletRequest; - -import sample.jetty93.service.HelloWorldService; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ResponseBody; - -@Controller -public class SampleController { - - @Autowired - private HelloWorldService helloWorldService; - - @GetMapping("/") - @ResponseBody - public String helloWorld(HttpServletRequest request) { - request.getSession(true).setAttribute("date", new Date()); - return this.helloWorldService.getHelloMessage(); - } - -} diff --git a/spring-boot-samples/spring-boot-sample-jetty93/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-jetty93/src/main/resources/application.properties deleted file mode 100644 index 005a635ad3..0000000000 --- a/spring-boot-samples/spring-boot-sample-jetty93/src/main/resources/application.properties +++ /dev/null @@ -1,4 +0,0 @@ -server.compression.enabled: true -server.compression.min-response-size: 1 -server.jetty.acceptors=2 -server.session.persistent=true diff --git a/spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJettyApplicationTests.java b/spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJettyApplicationTests.java deleted file mode 100644 index e311e2f92c..0000000000 --- a/spring-boot-samples/spring-boot-sample-jetty93/src/test/java/sample/jetty93/SampleJettyApplicationTests.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2012-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.jetty93; - -import java.io.ByteArrayInputStream; -import java.nio.charset.Charset; -import java.util.zip.GZIPInputStream; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.util.StreamUtils; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Basic integration tests for demo application. - * - * @author Dave Syer - * @author Andy Wilkinson - */ -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -@DirtiesContext -public class SampleJettyApplicationTests { - - @Autowired - private TestRestTemplate restTemplate; - - @Test - public void testHome() throws Exception { - ResponseEntity entity = this.restTemplate.getForEntity("/", String.class); - assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); - assertThat(entity.getBody()).isEqualTo("Hello World"); - } - - @Test - public void testCompression() throws Exception { - HttpHeaders requestHeaders = new HttpHeaders(); - requestHeaders.set("Accept-Encoding", "gzip"); - HttpEntity requestEntity = new HttpEntity(requestHeaders); - - ResponseEntity entity = this.restTemplate.exchange("/", HttpMethod.GET, - requestEntity, byte[].class); - - assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK); - - GZIPInputStream inflater = new GZIPInputStream( - new ByteArrayInputStream(entity.getBody())); - try { - assertThat(StreamUtils.copyToString(inflater, Charset.forName("UTF-8"))) - .isEqualTo("Hello World"); - } - finally { - inflater.close(); - } - } - -}