@RequestMapping( value = "/logger/{name}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public LoggerResource getLogger(@PathVariable String name) { Logger logger = delegate.getLogger(name); LoggerResource loggerResource = new LoggerResource(logger); loggerResource.add( linkTo(LoggingHateoasMvcEndpoint.class) .slash(this.getPath() + "/logger/" + logger.getName()) .withSelfRel()); return loggerResource; }
@RequestMapping( value = "/logger", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public Resources<LoggerResource> getLoggers() { List<Logger> loggers = delegate.getLoggers(); List<LoggerResource> loggerResources = new ArrayList<>(); for (Logger logger : loggers) { LoggerResource loggerResource = new LoggerResource(logger); loggerResource.add( linkTo(LoggingHateoasMvcEndpoint.class) .slash(this.getPath() + "/logger/" + logger.getName()) .withSelfRel()); loggerResources.add(loggerResource); } return new Resources<LoggerResource>( loggerResources, linkTo(LoggingHateoasMvcEndpoint.class).slash(this.getPath() + "/logger").withSelfRel()); }