Esempio n. 1
0
 @Override
 protected void getCurrentFolderParam(final HttpServletRequest request) {
   String currFolder = getParameter(request, "currentFolder");
   if (!(currFolder == null || currFolder.equals(""))) {
     this.currentFolder = PathUtils.addSlashToBeginning(PathUtils.addSlashToEnd(currFolder));
   }
 }
  /**
   * Gets configuration value of baseUrl. When config value is not set, then return default value.
   *
   * @param request request
   * @return default baseDir value
   */
  @Override
  public String getBaseUrl(final HttpServletRequest request) {
    String baseURL = null;
    try {
      IConfiguration conf = ConfigurationFactory.getInstace().getConfiguration();
      baseURL = conf.getBaseURL();
    } catch (Exception e) {
      baseURL = null;
    }
    if (baseURL == null || baseURL.equals("")) {
      baseURL = super.getBaseUrl(request);
    }

    return PathUtils.addSlashToBeginning(PathUtils.addSlashToEnd(baseURL));
  }
Esempio n. 3
0
  /**
   * initialize params for command handler.
   *
   * @param request request
   * @param configuration connector configuration
   * @param params execute additional params.
   * @throws ConnectorException to handle in error handler.
   */
  public void initParams(
      final HttpServletRequest request, final IConfiguration configuration, final Object... params)
      throws ConnectorException {
    if (configuration != null) {
      this.configuration = configuration;
      this.userRole = (String) request.getSession().getAttribute(configuration.getUserRoleName());

      getCurrentFolderParam(request);

      if (checkConnector(request) && checkParam(this.currentFolder)) {
        this.currentFolder = PathUtils.escape(this.currentFolder);
        if (!checkHidden()) {
          if ((this.currentFolder == null || this.currentFolder.equals(""))
              || checkIfCurrFolderExists(request)) {
            this.type = getParameter(request, "type");
          }
        }
      }
    }
  }
 /** sets new folder name. */
 private void setNewFolder() {
   String tmp1 = this.currentFolder.substring(0, this.currentFolder.lastIndexOf('/'));
   this.newFolderPath = tmp1.substring(0, tmp1.lastIndexOf('/') + 1).concat(this.newFolderName);
   this.newFolderPath = PathUtils.addSlashToEnd(this.newFolderPath);
 }