Polish static finals
Closes gh-12083
This commit is contained in:
committed by
Phillip Webb
parent
752a42710c
commit
fe023817c7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* 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.
|
||||
@@ -34,12 +34,12 @@ import org.springframework.web.util.UriTemplateHandler;
|
||||
*/
|
||||
public class LocalHostUriTemplateHandler extends RootUriTemplateHandler {
|
||||
|
||||
private static final String PREFIX = "server.servlet.";
|
||||
|
||||
private final Environment environment;
|
||||
|
||||
private final String scheme;
|
||||
|
||||
private final String prefix = "server.servlet.";
|
||||
|
||||
/**
|
||||
* Create a new {@code LocalHostUriTemplateHandler} that will generate {@code http}
|
||||
* URIs using the given {@code environment} to determine the context path and port.
|
||||
@@ -68,8 +68,7 @@ public class LocalHostUriTemplateHandler extends RootUriTemplateHandler {
|
||||
@Override
|
||||
public String getRootUri() {
|
||||
String port = this.environment.getProperty("local.server.port", "8080");
|
||||
String contextPath = this.environment.getProperty(this.prefix + "context-path",
|
||||
"");
|
||||
String contextPath = this.environment.getProperty(PREFIX + "context-path", "");
|
||||
return this.scheme + "://localhost:" + port + contextPath;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user