From 9e1d99810a3ece5f3c369d6d68d0a3f4e2b44cc5 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 18 Jun 2020 12:10:01 +0200 Subject: [PATCH] Polish --- .../web/controller/ProjectGenerationController.java | 7 +------ .../SpringCliDistributionControllerIntegrationTests.java | 4 ++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/initializr-web/src/main/java/io/spring/initializr/web/controller/ProjectGenerationController.java b/initializr-web/src/main/java/io/spring/initializr/web/controller/ProjectGenerationController.java index 9ddc0515..4cb51cfb 100644 --- a/initializr-web/src/main/java/io/spring/initializr/web/controller/ProjectGenerationController.java +++ b/initializr-web/src/main/java/io/spring/initializr/web/controller/ProjectGenerationController.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -59,7 +59,6 @@ import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; /** * Base {@link Controller} that provides endpoints for project generation. @@ -110,7 +109,6 @@ public abstract class ProjectGenerationController { } @RequestMapping(path = { "/pom", "/pom.xml" }) - @ResponseBody public ResponseEntity pom(R request) { request.setType("maven-build"); byte[] mavenPom = this.projectGenerationInvoker.invokeBuildGeneration(request); @@ -118,7 +116,6 @@ public abstract class ProjectGenerationController { } @RequestMapping(path = { "/build", "/build.gradle" }) - @ResponseBody public ResponseEntity gradle(R request) { request.setType("gradle-build"); byte[] gradleBuild = this.projectGenerationInvoker.invokeBuildGeneration(request); @@ -126,7 +123,6 @@ public abstract class ProjectGenerationController { } @RequestMapping("/starter.zip") - @ResponseBody public ResponseEntity springZip(R request) throws IOException { ProjectGenerationResult result = this.projectGenerationInvoker.invokeProjectStructureGeneration(request); Path archive = createArchive(result, "zip", ZipArchiveOutputStream::new, ZipArchiveEntry::new, @@ -135,7 +131,6 @@ public abstract class ProjectGenerationController { } @RequestMapping(path = "/starter.tgz", produces = "application/x-compress") - @ResponseBody public ResponseEntity springTgz(R request) throws IOException { ProjectGenerationResult result = this.projectGenerationInvoker.invokeProjectStructureGeneration(request); Path archive = createArchive(result, "tar.gz", this::createTarArchiveOutputStream, TarArchiveEntry::new, diff --git a/initializr-web/src/test/java/io/spring/initializr/web/controller/SpringCliDistributionControllerIntegrationTests.java b/initializr-web/src/test/java/io/spring/initializr/web/controller/SpringCliDistributionControllerIntegrationTests.java index 083115cb..70d83936 100644 --- a/initializr-web/src/test/java/io/spring/initializr/web/controller/SpringCliDistributionControllerIntegrationTests.java +++ b/initializr-web/src/test/java/io/spring/initializr/web/controller/SpringCliDistributionControllerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 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. @@ -64,7 +64,7 @@ public class SpringCliDistributionControllerIntegrationTests extends AbstractIni } private void assertSpringCliRedirect(String context, String extension) throws URISyntaxException { - ResponseEntity entity = getRestTemplate().getForEntity(createUrl(context), ResponseEntity.class); + ResponseEntity entity = getRestTemplate().getForEntity(createUrl(context), Object.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND); String expected = "https://repo.spring.io/release/org/springframework/boot/spring-boot-cli/2.1.4.RELEASE/spring-boot-cli-2.1.4.RELEASE-bin." + extension;