Class ResourceController
java.lang.Object
org.springframework.cloud.config.server.resource.ResourceController
@RestController
@RequestMapping(method=GET,
path="${spring.cloud.config.server.prefix:}")
public class ResourceController
extends Object
An HTTP endpoint for serving up templated plain text resources from an underlying
repository. Can be used to supply config files for consumption by a wide variety of
applications and services. A
ResourceRepository is used to locate a
Resource, specific to an application, and the contents are transformed to text.
Then an EnvironmentRepository is used to supply key-value pairs which are used
to replace placeholders in the resource text.- Author:
- Dave Syer, Daniel Lavoie
-
Constructor Summary
ConstructorsConstructorDescriptionResourceController(ResourceRepository resourceRepository, EnvironmentRepository environmentRepository) ResourceController(ResourceRepository resourceRepository, EnvironmentRepository environmentRepository, Map<String, ResourceEncryptor> resourceEncryptorMap) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]binary(String name, String profile, String label, org.springframework.web.context.request.ServletWebRequest request) byte[]binaryDefault(String name, String profile, String path, org.springframework.web.context.request.ServletWebRequest request) retrieve(String name, String profile, String label, org.springframework.web.context.request.ServletWebRequest request, boolean resolvePlaceholders, String acceptedCharset) retrieveDefault(String name, String profile, String path, org.springframework.web.context.request.ServletWebRequest request, boolean resolvePlaceholders, String acceptedCharset) voidsetEncryptEnabled(boolean encryptEnabled) voidsetPlainTextEncryptEnabled(boolean plainTextEncryptEnabled)
-
Constructor Details
-
ResourceController
public ResourceController(ResourceRepository resourceRepository, EnvironmentRepository environmentRepository, Map<String, ResourceEncryptor> resourceEncryptorMap) -
ResourceController
public ResourceController(ResourceRepository resourceRepository, EnvironmentRepository environmentRepository)
-
-
Method Details
-
setEncryptEnabled
public void setEncryptEnabled(boolean encryptEnabled) -
setPlainTextEncryptEnabled
public void setPlainTextEncryptEnabled(boolean plainTextEncryptEnabled) -
retrieve
@GetMapping("/{name}/{profile}/{label}/**") public String retrieve(@PathVariable String name, @PathVariable String profile, @PathVariable String label, org.springframework.web.context.request.ServletWebRequest request, @RequestParam(defaultValue="true") boolean resolvePlaceholders, @RequestHeader(value="Accept-Charset",required=false,defaultValue="UTF-8") String acceptedCharset) throws IOException - Throws:
IOException
-
retrieveDefault
@GetMapping(value="/{name}/{profile}/{path:.*}", params="useDefaultLabel") public String retrieveDefault(@PathVariable String name, @PathVariable String profile, @PathVariable String path, org.springframework.web.context.request.ServletWebRequest request, @RequestParam(defaultValue="true") boolean resolvePlaceholders, @RequestHeader(value="Accept-Charset",required=false,defaultValue="UTF-8") String acceptedCharset) throws IOException - Throws:
IOException
-
binary
@GetMapping(value="/{name}/{profile}/{label}/**", produces="application/octet-stream") public byte[] binary(@PathVariable String name, @PathVariable String profile, @PathVariable String label, org.springframework.web.context.request.ServletWebRequest request) throws IOException - Throws:
IOException
-
binaryDefault
@GetMapping(value="/{name}/{profile}/{path:.*}", params="useDefaultLabel", produces="application/octet-stream") public byte[] binaryDefault(@PathVariable String name, @PathVariable String profile, @PathVariable String path, org.springframework.web.context.request.ServletWebRequest request) throws IOException - Throws:
IOException
-