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. AResourceRepository
is used to locate aResource
, specific to an application, and the contents are transformed to text. Then anEnvironmentRepository
is used to supply key-value pairs which are used to replace placeholders in the resource text.- Author:
- Dave Syer, Daniel Lavoie
-
-
Constructor Summary
Constructors Constructor Description ResourceController(ResourceRepository resourceRepository, EnvironmentRepository environmentRepository)
ResourceController(ResourceRepository resourceRepository, EnvironmentRepository environmentRepository, Map<String,ResourceEncryptor> resourceEncryptorMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
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)
String
retrieve(String name, String profile, String label, org.springframework.web.context.request.ServletWebRequest request, boolean resolvePlaceholders)
String
retrieveDefault(String name, String profile, String path, org.springframework.web.context.request.ServletWebRequest request, boolean resolvePlaceholders)
void
setEncryptEnabled(boolean encryptEnabled)
void
setPlainTextEncryptEnabled(boolean plainTextEncryptEnabled)
-
-
-
Constructor Detail
-
ResourceController
public ResourceController(ResourceRepository resourceRepository, EnvironmentRepository environmentRepository, Map<String,ResourceEncryptor> resourceEncryptorMap)
-
ResourceController
public ResourceController(ResourceRepository resourceRepository, EnvironmentRepository environmentRepository)
-
-
Method Detail
-
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) 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) 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
-
-