code: @RequestMapping(value = "/image/{imageFormat}/**", method = RequestMethod.GET)
      public ResponseEntity<InputStreamResource> getImage(WebRequest request, HttpServletRequest servletRequest,
                                                          @PathVariable(value = "imageFormat") String imageFormatCode) throws IOException {
          String path = extractPathFromPattern(servletRequest);
          LOG.debug("getImage(imageFormatCode={}, path={})", imageFormatCode, path);
          try {
              ImageFormat imageFormat = getImageFormatForCode(imageFormatCode);
              if (imageFormat == null) {
                  throw new ResourceNotFoundException();
              }
              GalleryFile galleryFile = galleryService.getImage(path, imageFormat.getWidth(), imageFormat.getHeight());
              return returnResource(request, galleryFile);
          } catch (FileNotFoundException fnfe) {
              LOG.warn("Could not find resource {}", path);
              throw new ResourceNotFoundException();
          } catch (NotAllowedException nae) {
              LOG.warn("User was not allowed to access resource {}", path);
              throw new ResourceNotFoundException();
          } catch (IOException ioe) {
              LOG.error("Error when calling getImage", ioe);
              throw ioe;
          }
      }
docs: Requests an image with the given {@link ImageFormat}.
  
  @param request
  Spring request
  @param servletRequest
  Servlet request
  @param imageFormatCode
  Image format.
  
  @return The image as a stream with the appropriate response headers set
  or a not-modified response, (see
  {@link #returnResource(WebRequest, GalleryFile)}).
  @throws IOException
  Sub-types of this exception are thrown for different
  scenarios, and the {@link IOException} itself for generic
  errors.