private ModelMap browse(String dir) {
   ModelMap model = new ModelMap();
   String decodedDir = pathEncodingUtils.decodeDir(dir);
   JsTreeFile resource = this.serverAccess.get(decodedDir, userParameters, false, false);
   pathEncodingUtils.encodeDir(resource);
   model = new ModelMap("resource", resource);
   List<JsTreeFile> files = this.serverAccess.getChildren(decodedDir, userParameters);
   Collections.sort(files);
   pathEncodingUtils.encodeDir(files);
   model.put("files", files);
   model.put("currentDir", dir);
   ListOrderedMap parentsEncPathes = pathEncodingUtils.getParentsEncPathes(resource);
   model.put("parentsEncPathes", parentsEncPathes);
   return model;
 }
  @RequestMapping("VIEW")
  protected ModelAndView renderView(RenderRequest request, RenderResponse response)
      throws Exception {
    this.init(request);
    final PortletPreferences prefs = request.getPreferences();
    String defaultPortletView = prefs.getValue(PREF_PORTLET_VIEW, STANDARD_VIEW);
    String[] prefsDefaultPathes = prefs.getValues(PREF_DEFAULT_PATH, null);
    if (log.isDebugEnabled()) {
      log.debug(PREF_DEFAULT_PATH + " preference : ");
      for (String prefDefaultPath : prefsDefaultPathes) log.debug("- " + prefDefaultPath);
    }

    boolean showHiddenFiles = "true".equals(prefs.getValue(PREF_SHOW_HIDDEN_FILES, "false"));
    userParameters.setShowHiddenFiles(showHiddenFiles);

    UploadActionType uploadOption =
        UploadActionType.valueOf(
            prefs.getValue(PREF_UPLOAD_ACTION_EXIST_FILE, UploadActionType.OVERRIDE.toString()));
    userParameters.setUploadOption(uploadOption);

    serverAccess.initializeServices(userParameters);

    String defaultPath = serverAccess.getFirstAvailablePath(userParameters, prefsDefaultPathes);
    log.info("defaultPath will be : " + defaultPath);
    defaultPath = pathEncodingUtils.encodeDir(defaultPath);

    if (userAgentInspector.isMobile(request)) {
      return this.browseMobile(request, response, defaultPath);
    } else {
      if (MOBILE_VIEW.equals(defaultPortletView))
        return this.browseMobile(request, response, defaultPath);
      else if (WAI_VIEW.equals(defaultPortletView))
        return this.browseWai(request, response, defaultPath, null);
      else return this.browseStandard(request, response, defaultPath);
    }
  }