protected void init(PortletRequest request) {

    if (!userParameters.isInitialized()) {
      String clientIpAdress = request.getProperty("REMOTE_ADDR");
      userParameters.init(clientIpAdress);

      Map userInfos = (Map) request.getAttribute(PortletRequest.USER_INFO);
      userParameters.setUserInfos(userInfos);

      List<String> driveNames = serverAccess.getRestrictedDrivesGroupsContext(request);
      userParameters.setDriveNames(driveNames);

      log.info("set SharedUserPortletParameters in application session");
    }
  }
  @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);
    }
  }