public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) {

    Map model = new HashMap();

    List<Brand> brands = catalogManager.getBrands();

    model.put("brands", brands);

    return new ModelAndView("brand", "model", model);
  }
  protected ModelAndView onSubmit(
      HttpServletRequest request,
      HttpServletResponse response,
      Object command,
      BindException errors)
      throws ServletException, IOException, Exception {

    // cast the bean.  i only care about the File property in this controller
    UploadMasterBean bean = (UploadMasterBean) command;

    MultipartFile multipartFile = bean.getFile();
    if (multipartFile != null) {
      System.out.println("name " + multipartFile.getOriginalFilename());
      System.out.println("size " + multipartFile.getSize());

      File fileOut = new File(FileUtils.createTempDir(), multipartFile.getOriginalFilename());

      System.out.println("File written to " + fileOut.getCanonicalPath());

      multipartFile.transferTo(fileOut);

      String path = fileOut.getCanonicalPath();
      String extension = FileUtils.getFileExtension(path);

      if (("png".equals(extension))
          || ("PNG".equals(extension))
          || ("jpg".equals(extension))
          || ("JPG".equals(extension))
          || ("gif".equals(extension))
          || ("GIF".equals(extension))) {

        // TODO check and warn if this isn't transparent.  Alpha?

        catalogManager.addWatermark(fileOut);

      } else {
        System.out.println(path + " not imported.");
      }
    }

    // return new ModelAndView("uploadResults", "model", model);
    return new ModelAndView("redirect:listWatermarks.html");
  }