@RequestMapping(value = "show", method = RequestMethod.GET)
public String showShow(
Model model,
@RequestParam(value = "id", required = true) int id,
@RequestParam(value = "color", required = false, defaultValue = "true") String color) {
PhotoStrategy strategy = new PhotoStrategy(new J2eeConfig());
try {
Photo photo = strategy.get(id);
if (photo == null) {
return "/photos/index.gve";
}
String filename = (color.endsWith("true") ? photo.getFullSizeColor() : photo.getFullSizeBW());
if (filename == null) {
return "/photos/index.gve";
}
model.addAttribute("photoFile", filename);
return "/WEB-INF/website/photos/show.jsp";
} finally {
strategy.close();
}
}