コード例 #1
0
  /**
   * @param command
   * @param result
   * @return
   */
  @RequestMapping(method = RequestMethod.POST)
  public ModelAndView processSubmit(
      @Valid @ModelAttribute("command") EditIIPImagePropertiesCommand command,
      BindingResult result) {
    getValidator().validate(command, result);

    if (result.hasErrors()) {
      return setupForm(command);
    } else {
      Map<String, Object> model = new HashMap<String, Object>(0);

      try {
        Map<String, String> hashMap = new HashMap<String, String>();
        hashMap.put("iipimage.reverseproxy.fcgi.path", command.getServerFcgiBinPath());
        hashMap.put("iipimage.reverseproxy.host", command.getServerHostName());
        hashMap.put("iipimage.reverseproxy.port", command.getServerPort());
        hashMap.put("iipimage.reverseproxy.protocol", command.getServerProtocol());
        hashMap.put("iipimage.reverseproxy.version", command.getServerVersion());

        getAdminService().updateApplicationProperties(hashMap);

        // We need to refresh ApplicationPropertyManager...
        ApplicationPropertyManager.refreshProperties();
      } catch (ApplicationThrowable applicationThrowable) {
        model.put("applicationThrowable", applicationThrowable);
        return new ModelAndView("error/IIPImageProperties", model);
      }

      return new ModelAndView("admin/ShowIIPImageProperties", model);
    }
  }
コード例 #2
0
  /**
   * @param command
   * @return
   */
  @RequestMapping(method = RequestMethod.GET)
  public ModelAndView setupForm(@ModelAttribute("command") EditIIPImagePropertiesCommand command) {
    Map<String, Object> model = new HashMap<String, Object>(0);

    command.setServerFcgiBinPath(
        ApplicationPropertyManager.getApplicationProperty("iipimage.reverseproxy.fcgi.path"));
    command.setServerHostName(
        ApplicationPropertyManager.getApplicationProperty("iipimage.reverseproxy.host"));
    command.setServerPort(
        ApplicationPropertyManager.getApplicationProperty("iipimage.reverseproxy.port"));
    command.setServerProtocol(
        ApplicationPropertyManager.getApplicationProperty("iipimage.reverseproxy.protocol"));
    command.setServerVersion(
        ApplicationPropertyManager.getApplicationProperty("iipimage.reverseproxy.version"));

    return new ModelAndView("admin/EditIIPImageProperties", model);
  }