mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-18 09:44:47 +08:00
Remove legacy STS support
Closes gh-766
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2018 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 io.spring.initializr.web.project;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import io.spring.initializr.metadata.InitializrMetadataProvider;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.servlet.resource.ResourceUrlProvider;
|
||||
|
||||
/**
|
||||
* A controller used to serve the legacy home page used by STS.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@Controller
|
||||
public class LegacyStsController extends AbstractInitializrController {
|
||||
|
||||
public LegacyStsController(InitializrMetadataProvider metadataProvider,
|
||||
ResourceUrlProvider resourceUrlProvider) {
|
||||
super(metadataProvider, resourceUrlProvider);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/sts", produces = "text/html")
|
||||
public String stsHome(Map<String, Object> model) {
|
||||
renderHome(model);
|
||||
return "sts-home";
|
||||
}
|
||||
|
||||
}
|
@@ -1,92 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Spring Initializr</title>
|
||||
<link rel="stylesheet"
|
||||
href="/css/bootstrap-sts.min.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="navbar">
|
||||
<div class="navbar-inner">
|
||||
<a class="brand"
|
||||
href="https://spring.io">
|
||||
Spring
|
||||
</a>
|
||||
<ul class="nav">
|
||||
<li>
|
||||
<a href="/" title="Download a template project or build file with some very basic content.">
|
||||
Projects
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/spring.zip" title="Download the spring CLI as a zip distribution (unpack and run bin/spring on a command line).">
|
||||
Download
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/install.sh" title="Installer for the spring CLI command on Un*x-like system (should work on Linux, Mac or Cygwin). Curl this link and pipe to bash, or download the script and run it.">
|
||||
Installer
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<h1>Spring Initializr</h1>
|
||||
<div>
|
||||
<form id="form" action="/starter.zip" method="get">
|
||||
<label for="groupId">Group:</label> <input id="groupId" type="text" value="{{groupId.content}}" name="groupId"/>
|
||||
<label for="artifactId">Artifact:</label> <input id="artifactId" type="text" value="{{artifactId.content}}" name="artifactId"/>
|
||||
<label for="name">Name:</label> <input id="name" type="text" value="{{name.content}}" name="name"/>
|
||||
<label for="name">Description:</label> <input id="description" type="text" value="{{description.content}}" name="description"/>
|
||||
<label for="packageName">Package Name:</label> <input id="packageName" type="text" value="{{packageName.content}}" name="packageName"/>
|
||||
<label>Styles:</label>
|
||||
{{#dependencies.content}}
|
||||
{{#content}}
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="style" value="{{id}}"/>
|
||||
{{name}}
|
||||
</label>
|
||||
{{/content}}
|
||||
{{/dependencies.content}}
|
||||
<label>Type:</label>
|
||||
{{#types.content}}
|
||||
<label class="radio">
|
||||
<input type="radio" name="type" value="{{stsId}}"{{#default}} checked="true"{{/default}} onclick="javascript:this.form.action='{{action}}'"/>
|
||||
{{name}}
|
||||
</label>
|
||||
{{/types.content}}
|
||||
<label>Packaging:</label>
|
||||
{{#packagings.content}}
|
||||
<label class="radio">
|
||||
<input type="radio" name="packaging" value="{{id}}"{{#default}} checked="true"{{/default}}/>
|
||||
{{name}}
|
||||
</label>
|
||||
{{/packagings.content}}
|
||||
<label>Java Version:</label>
|
||||
{{#javaVersions.content}}
|
||||
<label class="radio">
|
||||
<input type="radio" name="javaVersion" value="{{id}}"{{#default}} checked="true"{{/default}}/>
|
||||
{{name}}
|
||||
</label>
|
||||
{{/javaVersions.content}}
|
||||
<label>Language:</label>
|
||||
{{#languages.content}}
|
||||
<label class="radio">
|
||||
<input type="radio" name="language" value="{{id}}"{{#default}} checked="true"{{/default}}/>
|
||||
{{name}}
|
||||
</label>
|
||||
{{/languages.content}}
|
||||
<label>Spring Boot Version:</label>
|
||||
{{#bootVersions.content}}
|
||||
<label class="radio">
|
||||
<input type="radio" name="bootVersion" value="{{id}}"{{#default}} checked="true"{{/default}}/>
|
||||
{{name}}
|
||||
</label>
|
||||
{{/bootVersions.content}}
|
||||
<button name="generate-project" type="submit" class="btn">Generate</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2018 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 io.spring.initializr.web.project;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import io.spring.initializr.metadata.InitializrMetadataProvider;
|
||||
import io.spring.initializr.web.AbstractInitializrControllerIntegrationTests;
|
||||
import io.spring.initializr.web.project.LegacyStsControllerIntegrationTests.LegacyConfig;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.web.servlet.resource.ResourceUrlProvider;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
@ActiveProfiles("test-default")
|
||||
@ContextConfiguration(classes = LegacyConfig.class)
|
||||
public class LegacyStsControllerIntegrationTests
|
||||
extends AbstractInitializrControllerIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void legacyStsHome() {
|
||||
String body = htmlHome();
|
||||
assertThat(body).contains("com.example", "demo", "Demo project for Spring Boot",
|
||||
"<input type=\"radio\" name=\"language\" value=\"groovy\"/>",
|
||||
"<input type=\"radio\" name=\"language\" value=\"java\" checked=\"true\"/>");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String htmlHome() {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Collections.singletonList(MediaType.TEXT_HTML));
|
||||
return getRestTemplate().exchange(createUrl("/sts"), HttpMethod.GET,
|
||||
new HttpEntity<Void>(headers), String.class).getBody();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
protected static class LegacyConfig {
|
||||
|
||||
@Bean
|
||||
public LegacyStsController legacyStsController(
|
||||
InitializrMetadataProvider metadataProvider,
|
||||
ResourceUrlProvider resourceUrlProvider) {
|
||||
return new LegacyStsController(metadataProvider, resourceUrlProvider);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user