mirror of
https://gitee.com/dcren/initializr.git
synced 2025-07-15 23:13:30 +08:00
Prevent retrieval of Sagan metadata on startup
This commit makes sure that sagan metadata are only requested on first use and when the cache infrastructure is active. Closes gh-278
This commit is contained in:
parent
99ae293f36
commit
e3112811b7
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package io.spring.initializr.web.project
|
package io.spring.initializr.web.project
|
||||||
|
|
||||||
import javax.annotation.PostConstruct
|
|
||||||
import javax.servlet.http.HttpServletResponse
|
import javax.servlet.http.HttpServletResponse
|
||||||
|
|
||||||
import io.spring.initializr.generator.InvalidProjectRequestException
|
import io.spring.initializr.generator.InvalidProjectRequestException
|
||||||
@ -37,7 +36,7 @@ abstract class AbstractInitializrController {
|
|||||||
|
|
||||||
protected final InitializrMetadataProvider metadataProvider
|
protected final InitializrMetadataProvider metadataProvider
|
||||||
private final GroovyTemplate groovyTemplate
|
private final GroovyTemplate groovyTemplate
|
||||||
private boolean forceSsl
|
private Boolean forceSsl
|
||||||
|
|
||||||
protected AbstractInitializrController(InitializrMetadataProvider metadataProvider,
|
protected AbstractInitializrController(InitializrMetadataProvider metadataProvider,
|
||||||
GroovyTemplate groovyTemplate) {
|
GroovyTemplate groovyTemplate) {
|
||||||
@ -45,9 +44,12 @@ abstract class AbstractInitializrController {
|
|||||||
this.groovyTemplate = groovyTemplate
|
this.groovyTemplate = groovyTemplate
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostConstruct
|
boolean isForceSsl() {
|
||||||
void initialize() {
|
if (this.forceSsl == null) {
|
||||||
forceSsl = metadataProvider.get().configuration.env.forceSsl
|
this.forceSsl = metadataProvider.get().configuration.env.forceSsl
|
||||||
|
}
|
||||||
|
return this.forceSsl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ExceptionHandler
|
@ExceptionHandler
|
||||||
@ -86,7 +88,7 @@ abstract class AbstractInitializrController {
|
|||||||
*/
|
*/
|
||||||
protected String generateAppUrl() {
|
protected String generateAppUrl() {
|
||||||
def builder = ServletUriComponentsBuilder.fromCurrentServletMapping()
|
def builder = ServletUriComponentsBuilder.fromCurrentServletMapping()
|
||||||
if (this.forceSsl) {
|
if (isForceSsl()) {
|
||||||
builder.scheme('https')
|
builder.scheme('https')
|
||||||
}
|
}
|
||||||
builder.build()
|
builder.build()
|
||||||
|
Loading…
Reference in New Issue
Block a user