class SpaceController {

  @RequestMapping(value = "/{token:.+}", method = RequestMethod.GET)
  public ResponseEntity<Space> getSpace(
      @PathVariable String token,
      @ApiIgnore @RequestHeader(value = Constants.HTTP_TENANT_HEADER, required = false)
          String tenant) {
    // Check whether tenant exists or retrieve default
    Tenant t = null;
    try {
      t = this.tenantRepository.getTenant(tenant);
    } catch (Exception e) {
      log.error("Error retrieving tenant: " + e);
      return new ResponseEntity<Space>(HttpStatus.NOT_FOUND);
    }
    try {
      final Space s =
          SpaceRepository.FILTER.findOne(
              this.spaceRepository.findBySecondaryKey(t.getTenantToken(), token));
      return new ResponseEntity<Space>(s, HttpStatus.OK);
    } catch (EntityNotFoundException enfe) {
      return new ResponseEntity<Space>(HttpStatus.NOT_FOUND);
    }
  }

  @Autowired  SpaceController(
      TenantRepository tenantRepository,
      SpaceRepository spaceRepository,
      ApplicationRepository appRepository,
      ApplicationExporter appExporter,
      Filter cacheFilter);

}