Class EnvironmentController
java.lang.Object
org.springframework.cloud.config.server.environment.EnvironmentController
@RestController
@RequestMapping(method=GET,
path="${spring.cloud.config.server.prefix:}")
public class EnvironmentController
extends Object
- Author:
- Dave Syer, Spencer Gibb, Roy Clarkson, Bartosz Wojtkiewicz, Rafal Zukowski, Ivan Corrales Solera, Daniel Frey, Ian Bondoc
-
Constructor Summary
ConstructorsConstructorDescriptionEnvironmentController
(EnvironmentRepository repository) EnvironmentController
(EnvironmentRepository repository, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptiondefaultLabel
(String name, String profiles) defaultLabelIncludeOrigin
(String name, String profiles) void
environmentException
(javax.servlet.http.HttpServletResponse response, EnvironmentException e) getEnvironment
(String name, String profiles, String label, boolean includeOrigin) void
illegalArgument
(javax.servlet.http.HttpServletResponse response) org.springframework.http.ResponseEntity<String>
jsonProperties
(String name, String profiles, boolean resolvePlaceholders) labelledIncludeOrigin
(String name, String profiles, String label) org.springframework.http.ResponseEntity<String>
labelledJsonProperties
(String name, String profiles, String label, boolean resolvePlaceholders) org.springframework.http.ResponseEntity<String>
labelledProperties
(String name, String profiles, String label, boolean resolvePlaceholders) org.springframework.http.ResponseEntity<String>
labelledYaml
(String name, String profiles, String label, boolean resolvePlaceholders) void
noSuchLabel
(javax.servlet.http.HttpServletResponse response) org.springframework.http.ResponseEntity<String>
properties
(String name, String profiles, boolean resolvePlaceholders) void
setAcceptEmpty
(boolean acceptEmpty) Flag to indicate that If HTTP 404 needs to be sent if Application is not Found.void
setStripDocumentFromYaml
(boolean stripDocument) Flag to indicate that YAML documents which are not a map should be stripped of the "document" prefix that is added by Spring (to facilitate conversion to Properties).org.springframework.http.ResponseEntity<String>
-
Constructor Details
-
EnvironmentController
-
EnvironmentController
public EnvironmentController(EnvironmentRepository repository, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
setStripDocumentFromYaml
public void setStripDocumentFromYaml(boolean stripDocument) Flag to indicate that YAML documents which are not a map should be stripped of the "document" prefix that is added by Spring (to facilitate conversion to Properties).- Parameters:
stripDocument
- the flag to set
-
setAcceptEmpty
public void setAcceptEmpty(boolean acceptEmpty) Flag to indicate that If HTTP 404 needs to be sent if Application is not Found.- Parameters:
acceptEmpty
- the flag to set
-
defaultLabel
@GetMapping(path="/{name}/{profiles:(?!.*\\b\\.(?:ya?ml|properties|json)\\b).*}", produces="application/json") public Environment defaultLabel(@PathVariable String name, @PathVariable String profiles) -
defaultLabelIncludeOrigin
@GetMapping(path="/{name}/{profiles:(?!.*\\b\\.(?:ya?ml|properties|json)\\b).*}", produces="application/vnd.spring-cloud.config-server.v2+json") public Environment defaultLabelIncludeOrigin(@PathVariable String name, @PathVariable String profiles) -
labelled
@GetMapping(path="/{name}/{profiles}/{label:.*}", produces="application/json") public Environment labelled(@PathVariable String name, @PathVariable String profiles, @PathVariable String label) -
labelledIncludeOrigin
@GetMapping(path="/{name}/{profiles}/{label:.*}", produces="application/vnd.spring-cloud.config-server.v2+json") public Environment labelledIncludeOrigin(@PathVariable String name, @PathVariable String profiles, @PathVariable String label) -
getEnvironment
public Environment getEnvironment(String name, String profiles, String label, boolean includeOrigin) -
properties
@GetMapping("/{name}-{profiles}.properties") public org.springframework.http.ResponseEntity<String> properties(@PathVariable String name, @PathVariable String profiles, @RequestParam(defaultValue="true") boolean resolvePlaceholders) throws IOException - Throws:
IOException
-
labelledProperties
@GetMapping("/{label}/{name}-{profiles}.properties") public org.springframework.http.ResponseEntity<String> labelledProperties(@PathVariable String name, @PathVariable String profiles, @PathVariable String label, @RequestParam(defaultValue="true") boolean resolvePlaceholders) throws IOException - Throws:
IOException
-
jsonProperties
@GetMapping("{name}-{profiles}.json") public org.springframework.http.ResponseEntity<String> jsonProperties(@PathVariable String name, @PathVariable String profiles, @RequestParam(defaultValue="true") boolean resolvePlaceholders) throws Exception - Throws:
Exception
-
labelledJsonProperties
@GetMapping("/{label}/{name}-{profiles}.json") public org.springframework.http.ResponseEntity<String> labelledJsonProperties(@PathVariable String name, @PathVariable String profiles, @PathVariable String label, @RequestParam(defaultValue="true") boolean resolvePlaceholders) throws Exception - Throws:
Exception
-
yaml
@GetMapping({"/{name}-{profiles}.yml","/{name}-{profiles}.yaml"}) public org.springframework.http.ResponseEntity<String> yaml(@PathVariable String name, @PathVariable String profiles, @RequestParam(defaultValue="true") boolean resolvePlaceholders) throws Exception - Throws:
Exception
-
labelledYaml
@GetMapping({"/{label}/{name}-{profiles}.yml","/{label}/{name}-{profiles}.yaml"}) public org.springframework.http.ResponseEntity<String> labelledYaml(@PathVariable String name, @PathVariable String profiles, @PathVariable String label, @RequestParam(defaultValue="true") boolean resolvePlaceholders) throws Exception - Throws:
Exception
-
noSuchLabel
@ExceptionHandler(RepositoryException.class) public void noSuchLabel(javax.servlet.http.HttpServletResponse response) throws IOException - Throws:
IOException
-
illegalArgument
@ExceptionHandler(java.lang.IllegalArgumentException.class) public void illegalArgument(javax.servlet.http.HttpServletResponse response) throws IOException - Throws:
IOException
-
environmentException
@ExceptionHandler(EnvironmentException.class) public void environmentException(javax.servlet.http.HttpServletResponse response, EnvironmentException e) throws IOException - Throws:
IOException
-