/**
   * Get list of capabilities from external source.
   *
   * @param name - resource name.
   * @return ResponseEntity with result. Method is cacheable.
   */
  @RequestMapping(
      value = {"/{name}", "/{name}.json"},
      method = RequestMethod.GET,
      produces = "application/json; charset=utf-8")
  public ResponseEntity getWmsCapabilities(@PathVariable String name) {

    try {

      LOGGER.info("getWmsCapabilities");
      WmsEntity wmsEntity = wmsRepository.findByName(name);
      Assert.notNull(wmsEntity, "No WMS entity for given name.");
      WmsCapabilities capabilities = wmsService.getCapabilities(wmsEntity.getUrl());

      WmsApiResponse response = new WmsApiResponse();
      response.setResult(capabilities);

      return new ResponseEntity<>(response, HttpStatus.OK);
    } catch (IllegalArgumentException e) {
      LOGGER.error(e);
      if (LOGGER.isDebugEnabled()) LOGGER.debug("WMS: IllegalArgumentException", e);
      return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
    } catch (WmsException e) {
      LOGGER.error(e);
      if (LOGGER.isDebugEnabled()) LOGGER.debug("WMS: WmsException", e);
      return new ResponseEntity<>(e.getMessage(), HttpStatus.SERVICE_UNAVAILABLE);
    } catch (Exception e) {
      LOGGER.fatal(e);
      if (LOGGER.isDebugEnabled()) LOGGER.debug("WMS: Exception", e);
      return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
    }
  }
  /**
   * Gets list of WMS resources.
   *
   * @return ResponseEntity with result.
   */
  @RequestMapping(
      value = "",
      method = RequestMethod.GET,
      produces = "application/json; charset=utf-8")
  public ResponseEntity getWmsEntries() {

    LOGGER.info("getWmsEntries");
    List<WmsEntity> list = wmsRepository.findAll();

    WmsApiResponse response = new WmsApiResponse();
    response.setResult(list);

    return new ResponseEntity<>(response, HttpStatus.OK);
  }