@Controller
@Docs(value={,})
public class RegistriesController
extends java.lang.Object
/registry resource.| Constructor and Description |
|---|
RegistriesController() |
| Modifier and Type | Method and Description |
|---|---|
void |
deleteRegistry(java.lang.String registryName,
javax.servlet.http.HttpServletResponse response)
Deletes the specified registry.
|
java.util.Map<java.lang.String,?> |
getRegistries(javax.servlet.http.HttpServletResponse response)
Returns the registries as a list of URLs.
|
java.util.Map<java.lang.String,?> |
getRegistry(java.lang.String registryName,
javax.servlet.http.HttpServletResponse response)
Returns the contents of the registry in application/json format.
|
void |
handleBadRequest() |
void |
putRegistry(java.lang.String registryName,
java.util.Map<java.lang.String,java.lang.Object> registry,
javax.servlet.http.HttpServletResponse response)
Creates or updates a registry.
|
void |
setApplicationBaseUri(java.lang.String baseUri) |
void |
setRegistryRepository(RegistryRepository registryRepository)
Injects the registry implementation used to store registry entries.
|
@Value(value="${jsonhome.applicationBaseUri}")
public void setApplicationBaseUri(java.lang.String baseUri)
@Autowired public void setRegistryRepository(RegistryRepository registryRepository)
registryRepository - the Registry used by the controller.@Rel(value="/rel/jsonhome/registries")
@RequestMapping(value="/registries",
method=GET,
produces="application/json")
@ResponseBody
public java.util.Map<java.lang.String,?> getRegistries(javax.servlet.http.HttpServletResponse response)
GET /registries
{
"self" : "http://example.org/registries",
"registries" : [
{ "href" : "http://example.org/registries/live", "title" : "Live environment" },
{ "href" : "http://example.org/registries/test", "title" : "Testing environment" }
]
}
HTTP status codes returned by this method:
response - the HttpServletResponse@Rel(value="/rel/jsonhome/registry")
@RequestMapping(value="/registries/{registryName}",
method=GET,
produces="application/json")
@ResponseBody
public java.util.Map<java.lang.String,?> getRegistry(@PathVariable
java.lang.String registryName,
javax.servlet.http.HttpServletResponse response)
GET /registries/live
{
"name" : "live",
"title" : "Live environment",
"self" : "http://example.org/registries/live",
"container" : "http://example.org/registries",
"service" : [
{
"title" : "Home document of application foo",
"href" : "http://example.org/foo/json-home"
},
{
"title" : "Home document of application bar",
"href" : "http://example.org/bar/json-home
}
]
}
The attributes 'name', 'self' and 'container' are added by the server and will be ignored during PUT operations.
HTTP status codes returned by this method:
response - HttpServletResponse with cache-control header and application/json in body.@Rel(value="/rel/jsonhome/registry")
@RequestMapping(value="/registries/{registryName}",
method=PUT)
public void putRegistry(@PathVariable
java.lang.String registryName,
@RequestBody
java.util.Map<java.lang.String,java.lang.Object> registry,
javax.servlet.http.HttpServletResponse response)
PUT /registries/live
{
"title" : "Live environment",
"service" : [
{
"title" : "Home document of application foo",
"href" : "http://example.org/foo/json-home"
},
{
"title" : "Home document of application bar",
"href" : "http://example.org/bar/json-home
}
]
}
The server will add the following attributes to the document: 'name', 'self', 'container'. These attributes
are overwritten, if provided by the caller.
HTTP status codes returned by this method:
@Rel(value="/rel/jsonhome/registry")
@RequestMapping(value="/registries/{registryName}",
method=DELETE)
public void deleteRegistry(@PathVariable
java.lang.String registryName,
javax.servlet.http.HttpServletResponse response)
registryName - the name of the deleted registryresponse - the response object@ResponseStatus(value=BAD_REQUEST,
reason="Illegal resource format")
@ExceptionHandler(value={java.lang.IllegalArgumentException.class,java.lang.NullPointerException.class})
public void handleBadRequest()