Index: Keditor.Java/branches/2.4/src/main/java/net/fckeditor/IBaseDirProvider.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/IBaseDirProvider.java	(revision 1460)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2008 Frederico Caldeira Knabben
- * 
- * == BEGIN LICENSE ==
- * 
- * Licensed under the terms of any of the following licenses at your
- * choice:
- * 
- *  - GNU General Public License Version 2 or later (the "GPL")
- *    http://www.gnu.org/licenses/gpl.html
- * 
- *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- *    http://www.gnu.org/licenses/lgpl.html
- * 
- *  - Mozilla Public License Version 1.1 or later (the "MPL")
- *    http://www.mozilla.org/MPL/MPL-1.1.html
- * 
- * == END LICENSE ==
- */
-package net.fckeditor;
-
-/**
- * This interface has to be implemented by the class, which provides the user
- * dir. <br>
- * E.g. this class could set construct the user depended on a session.
- * 
- * @version $Id:IBaseDirProvider.java 1099 2008-11-06 15:01:50Z th-schwarz $
- */
-public interface IBaseDirProvider {
-
-    /**
-     * @return Base dir for user files. It's relative to the context root (no
-     *         leading or ending /).
-     */
-    public String getDir();
-}
Index: /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/ISessionData.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/ISessionData.java	(revision 1461)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/ISessionData.java	(revision 1461)
@@ -0,0 +1,67 @@
+/*
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net
+ * Copyright (C) 2003-2008 Frederico Caldeira Knabben
+ * 
+ * == BEGIN LICENSE ==
+ * 
+ * Licensed under the terms of any of the following licenses at your
+ * choice:
+ * 
+ *  - GNU General Public License Version 2 or later (the "GPL")
+ *    http://www.gnu.org/licenses/gpl.html
+ * 
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
+ *    http://www.gnu.org/licenses/lgpl.html
+ * 
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")
+ *    http://www.mozilla.org/MPL/MPL-1.1.html
+ * 
+ * == END LICENSE ==
+ */
+package net.fckeditor;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import net.fckeditor.handlers.ConfigurationHandler;
+
+/**
+ * Interface to provide session based functionality to FCKeditor.Java. Currently, the implemeted
+ * class has to implement the following:
+ * <ul>
+ * <li>{@link #isAuthenticate(HttpServletRequest)}: User authentication based on
+ * {@link HttpServletRequest}, so you can use {@link HttpSession} to identify an user for example.</li>
+ * <li>{@link #getBaseDir(HttpServletRequest)}: Constructs an user based 'BaseDir'.</li>
+ * </ul>
+ * <br />
+ * <b>Warning for commiters: </b>You have to awake that every change of this interface could break
+ * all classes which implemented this interface. Therfore you should change this interface for
+ * milestone releases only!
+ * 
+ * @version $Id$
+ */
+public interface ISessionData {
+
+	/**
+	 * Authenticates the current user.<br>
+	 * If the implemantation doesn't bother you, just return <code>true</code>.
+	 * 
+	 * @param servletRequest
+	 * @return
+	 */
+	public boolean isAuthenticate(final HttpServletRequest servletRequest);
+
+	/**
+	 * Getter for the user dependent 'BaseDir'.<br>
+	 * <b>Important:</b>
+	 * <ul>
+	 * <li> If the implementation returns <code>null</code>, {@link ConfigurationHandler} will
+	 * used the default one! That's usefull, if the implementation doesn't bother you.</li>
+	 * <li>The returned directory string has to start with '/', but has to end without '/'.</li>
+	 * </ul>
+	 * 
+	 * @param servletRequest
+	 * @return <code>null</null> or the 'BaseDir' string for the current user.
+	 */
+	public String getBaseDir(final HttpServletRequest servletRequest);
+}
Index: /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/connector/ConnectorServlet.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/connector/ConnectorServlet.java	(revision 1460)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/connector/ConnectorServlet.java	(revision 1461)
@@ -87,12 +87,15 @@
 	/**
 	 * Initialize the servlet.<br>
-	 * The optional init parameters will be read and used to adjust the defaults of the
+	 * The init parameters will be read and used to adjust the defaults of the
 	 * {@link ConfigurationHandler} and the {@link ExtensionsHandler}.
 	 */
 	public void init() throws ServletException, IllegalArgumentException {
+		// read the required parameters
 		ConfigurationHandler.setConnectorEnabled(getInitParameter("enabled"));
+		ConfigurationHandler.constructSessionDataObject(getInitParameter("SessionData-class"));
 		if (getInitParameter("ForceSingleExtension") != null)
 			ConfigurationHandler.setForceSingleExtension(getInitParameter("ForceSingleExtension"));
 
+		// read the optional parameters
 		if (getInitParameter("baseDir") != null) // TODO should 'baseDir' contains '..' ??
 			ConfigurationHandler.setBaseDir(getInitParameter("baseDir"));
@@ -111,5 +114,6 @@
 		} else {
 			// check, if 'baseDir' exists
-			String realBaseDir = getServletContext().getRealPath(ConfigurationHandler.getBaseDir());
+			// info, we can make the default dir only at this point, because we haven't any request object yet!
+			String realBaseDir = getServletContext().getRealPath(ConfigurationHandler.getDefaultBaseDir());
 			File baseFile = new File(realBaseDir);
 			if (!baseFile.exists()) {
@@ -149,5 +153,5 @@
 
 		// TODO untersuchen wie es vom Res Browser kommt
-		String currentPath = constructTypeBasedFolderString(fileType, currentFolderStr);
+		String currentPath = constructTypeBasedFolderString(fileType, currentFolderStr, request);
 		String currentDirPath = getServletContext().getRealPath(currentPath);
 
@@ -266,5 +270,5 @@
 		else {
 
-			String currentPath = constructTypeBasedFolderString(fileType, currentFolderStr);
+			String currentPath = constructTypeBasedFolderString(fileType, currentFolderStr, request);
 			String currentDirPath = getServletContext().getRealPath(currentPath);
 
@@ -381,7 +385,7 @@
 
 	private String constructTypeBasedFolderString(final FileType fileType,
-	        final String currentFolderString) {
+	        final String currentFolderString, final HttpServletRequest request) {
 		StringWriter retval = new StringWriter();
-		retval.append(ConfigurationHandler.getBaseDir());
+		retval.append(ConfigurationHandler.getBaseDir(request));
 		retval.append(FileTypeHandler.getSubDirForType(fileType));
 		retval.append(currentFolderString);
Index: /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/ConfigurationHandler.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/ConfigurationHandler.java	(revision 1460)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/ConfigurationHandler.java	(revision 1461)
@@ -25,5 +25,7 @@
 import java.util.Properties;
 
-import net.fckeditor.IBaseDirProvider;
+import javax.servlet.http.HttpServletRequest;
+
+import net.fckeditor.ISessionData;
 import net.fckeditor.tool.Utils;
 
@@ -35,8 +37,8 @@
  * fckeditor dir, base dir (user dir) and defaults for height, width and toolbar of the editor. All
  * values are preset by the defaults defined in default.properties. This object is used everywhere
- * these values are needed. The defaults can be changed by calling the corresponding setter method.
+ * these values are needed. The defaults can be changed by calling the corresponding setter methods.
  * <br />
- * If the {@link IBaseDirProvider} is set, {@link #getBaseDir()} is calling
- * {@link IBaseDirProvider#getDir()} to get the user dir.
+ * If the {@link ISessionData} class is set, {@link #getBaseDir(HttpServletRequest)} is calling
+ * {@link ISessionData#getBaseDir(HttpServletRequest)} to get the base dir.
  * 
  * @version $Id:ConfigurationHandler.java 1099 2008-11-06 15:01:50Z th-schwarz $
@@ -47,5 +49,5 @@
 	private static Properties defaultProperties = new Properties();
 	private static String baseDir;
-	private static IBaseDirProvider baseDirProvider = null;
+	private static ISessionData sessionData = null;
 	private static String fckEditorDir;
 	private static String fckEditorHeight;
@@ -78,8 +80,19 @@
 	 * Getter for the base dir (using for user files).
 	 * 
-	 * @return If the {@link IBaseDirProvider} is set, then it's dir getter is called, or base dir.
-	 */
-	public static String getBaseDir() {
-		return (baseDirProvider != null) ? baseDirProvider.getDir() : baseDir;
+	 * @return If the {@link ISessionData} is set, then it's dir getter is called, or base dir.
+	 */
+	public static String getBaseDir(final HttpServletRequest servletRequest) {
+		if (sessionData == null || sessionData.getBaseDir(servletRequest) == null)
+			return baseDir;
+		return sessionData.getBaseDir(servletRequest);
+	}
+
+	/**
+	 * Getter for the default baseDir.
+	 * 
+	 * @return
+	 */
+	public static String getDefaultBaseDir() {
+		return baseDir;
 	}
 
@@ -95,10 +108,24 @@
 
 	/**
-	 * Getter for the {@link IBaseDirProvider}.
-	 * 
-	 * @param baseDirProvider
-	 */
-	public static void setBaseDirProvider(final IBaseDirProvider baseDirProvider) {
-		ConfigurationHandler.baseDirProvider = baseDirProvider;
+	 * Constructs an object which implemented the interface {@link ISessionData}. If the
+	 * constuction fails, the connector will be disabled.
+	 * 
+	 * @param fqcn The fully-qualified class name.
+	 */
+	public static void constructSessionDataObject(final String fqcn) {
+		if (Utils.isEmpty(fqcn)) {
+			logger.warn("Class name is empty, ConnectorServlet will be disabled!");
+			connectorEnabled = false;
+			return;
+		}
+		try {
+			@SuppressWarnings("unchecked")
+			Class cls = Class.forName(fqcn);
+			sessionData = (ISessionData) cls.newInstance();
+		} catch (Exception e) {
+			logger.error("Couldn't instanciate the class [".concat(fqcn).concat(
+			        "], ConnectorServlet will be disabled!"), e);
+			connectorEnabled = false;
+		}
 	}
 
Index: /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/impl/SessionData.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/impl/SessionData.java	(revision 1461)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/impl/SessionData.java	(revision 1461)
@@ -0,0 +1,48 @@
+/*
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net
+ * Copyright (C) 2003-2008 Frederico Caldeira Knabben
+ * 
+ * == BEGIN LICENSE ==
+ * 
+ * Licensed under the terms of any of the following licenses at your
+ * choice:
+ * 
+ *  - GNU General Public License Version 2 or later (the "GPL")
+ *    http://www.gnu.org/licenses/gpl.html
+ * 
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
+ *    http://www.gnu.org/licenses/lgpl.html
+ * 
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")
+ *    http://www.mozilla.org/MPL/MPL-1.1.html
+ * 
+ * == END LICENSE ==
+ */
+package net.fckeditor.impl;
+
+import javax.servlet.http.HttpServletRequest;
+
+import net.fckeditor.ISessionData;
+
+/**
+ * The most simple implementation of {@link ISessionData}.
+ *
+ * @version $Id$
+ */
+public class SessionData implements ISessionData {
+
+	/* (non-Javadoc)
+	 * @see net.fckeditor.ISessionData#check(javax.servlet.http.HttpServletRequest)
+	 */
+	public boolean isAuthenticate(HttpServletRequest servletRequest) {
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see net.fckeditor.ISessionData#getBaseDir(javax.servlet.http.HttpServletRequest)
+	 */
+	public String getBaseDir(HttpServletRequest servletRequest) {
+		return null;
+	}
+
+}
Index: /FCKeditor.Java/branches/2.4/src/main/webapp/WEB-INF/web.xml
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/webapp/WEB-INF/web.xml	(revision 1460)
+++ /FCKeditor.Java/branches/2.4/src/main/webapp/WEB-INF/web.xml	(revision 1461)
@@ -11,5 +11,6 @@
 			- 'ForceSingleExtension': Default is true.
 			  (Due to security issues with Apache modules, it is recommended to leave this setting untouched!)
-			- 'enabled' : Default is false.		
+			- 'SessionData-class'
+			  Fully-qualified class name of the class, which provides some session based data.
 	-->
 
@@ -22,8 +23,14 @@
 			net.fckeditor.connector.ConnectorServlet
 		</servlet-class>
+		<!-- 
 		<init-param>
 			<param-name>enabled</param-name>
 			<param-value>true</param-value>
 		</init-param>
+		<init-param>
+			<param-name>SessionData-class</param-name>
+			<param-value>net.fckeditor.impl.SessionData</param-value>
+		</init-param>
+		 -->
 		<load-on-startup>1</load-on-startup>
 	</servlet>
