Index: Keditor.Java/branches/2.4/src/main/java/net/fckeditor/ConfigurationHandler.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/ConfigurationHandler.java	(revision 1454)
+++ 	(revision )
@@ -1,237 +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;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.util.Properties;
-
-import net.fckeditor.tool.Utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Static configuration handler object, which provides getters and setters for basic values like 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. <br />
- * If the {@link IBaseDirProvider} is set, {@link #getBaseDir()} is calling {@link IBaseDirProvider#getDir()} to get the
- * user dir.
- * 
- * @version $Id:ConfigurationHandler.java 1099 2008-11-06 15:01:50Z th-schwarz $
- */
-public class ConfigurationHandler {
-	private static final Logger logger = LoggerFactory.getLogger(ConfigurationHandler.class);
-
-	private static Properties defaultProperties = new Properties();
-	private static String baseDir;
-	private static IBaseDirProvider baseDirProvider = null;
-	private static String fckEditorDir;
-	private static String fckEditorHeight;
-	private static String fckEditorWidth;
-	private static String fckEditorToolbarSet;
-	private static boolean forceSingleExtension;
-
-	static {
-		// load defaults
-		try {
-			defaultProperties.load(new BufferedInputStream(ConfigurationHandler.class
-			    .getResourceAsStream("default.properties")));
-		} catch (IOException e) {
-			logger.error("Error while loading the default properties!", e);
-			throw new RuntimeException("Can't load default properties!", e);
-		}
-		baseDir = defaultProperties.getProperty("fckeditor.basedir");
-		fckEditorDir = defaultProperties.getProperty("fckeditor.dir");
-		fckEditorWidth = defaultProperties.getProperty("fckeditor.width");
-		fckEditorHeight = defaultProperties.getProperty("fckeditor.height");
-		fckEditorToolbarSet = defaultProperties.getProperty("fckeditor.toolbarset");
-		forceSingleExtension = Boolean.valueOf(defaultProperties.getProperty("fckeditor.forcesingleextension"));
-
-		logger.info("Default properties loaded and initialized successfully.");
-	}
-
-	
-	/**
-	 * 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;
-	}
-
-	/**
-	 * Setter for the base dir (using for user files).
-	 * 
-	 * @param baseDir
-	 *          relative to the context root (no leading or ending /).
-	 */
-	public static void setBaseDir(final String baseDir) {
-		ConfigurationHandler.baseDir = baseDir;
-	}
-
-	/**
-	 * Getter for the {@link IBaseDirProvider}.
-	 * 
-	 * @param baseDirProvider
-	 */
-	public static void setBaseDirProvider(final IBaseDirProvider baseDirProvider) {
-		ConfigurationHandler.baseDirProvider = baseDirProvider;
-	}
-
-	/**
-	 * Getter for the dir of the fckeditor.
-	 * 
-	 * @return Dir of the fckeditor relative to the context root.
-	 */
-	public static String getFckEditorDir() {
-		return fckEditorDir;
-	}
-
-	/**
-	 * Setter for the dir of the fckeditor.
-	 * 
-	 * @param fckEditorDir
-	 *          relative to the context root (no leading or ending /).
-	 */
-	public static void setFckEditorDir(final String fckEditorDir) {
-		ConfigurationHandler.fckEditorDir = fckEditorDir;
-	}
-
-	/**
-	 * Getter for the default height of the fckeditor.
-	 * 
-	 * @return Default height of the fckeditor.
-	 */
-	public static String getFckEditorHeight() {
-		return fckEditorHeight;
-	}
-
-	/**
-	 * Setter for the default height of the fckeditor.
-	 * 
-	 * @param fckEditorHeight
-	 *          the default height of the fckeditor.
-	 */
-	public static void setFckEditorHeight(final String fckEditorHeight) {
-		ConfigurationHandler.fckEditorHeight = fckEditorHeight;
-	}
-
-	/**
-	 * Getter for the default width of the fckeditor.
-	 * 
-	 * @return Default width of the fckeditor.
-	 */
-	public static String getFckEditorWidth() {
-		return fckEditorWidth;
-	}
-
-	/**
-	 * Setter for the default width of the fckeditor.
-	 * 
-	 * @param fckEditorWidth
-	 *          the default width of the fckeditor.
-	 */
-	public static void setFckEditorWidth(final String fckEditorWidth) {
-		ConfigurationHandler.fckEditorWidth = fckEditorWidth;
-	}
-
-	/**
-	 * Getter of the name of the default toolbarset of the fckeditor.
-	 * 
-	 * @return Name of the default toolbar set.
-	 */
-	public static String getFckEditorToolbarSet() {
-		return fckEditorToolbarSet;
-	}
-
-	/**
-	 * Getter of the name of the default toolbarset of the fckeditor.
-	 * 
-	 * @param fckEditorToolbarSet
-	 *          the name of the toolbarset.
-	 */
-	public static void setFckEditorToolbarSet(final String fckEditorToolbarSet) {
-		ConfigurationHandler.fckEditorToolbarSet = fckEditorToolbarSet;
-	}
-	
-	/**
-	 * Getter for the default handling of single extensions.
-	 * 
-   * @return the forceSingleExtension
-   */
-  public static boolean isForceSingleExtension() {
-  	return forceSingleExtension;
-  }
-
-	/**
-	 * Setter for the default handling of single extensions.
-	 *
-   * @param forceSingleExtension the forceSingleExtension to set
-   */
-  public static void setForceSingleExtension(boolean forceSingleExtension) {
-  	ConfigurationHandler.forceSingleExtension = forceSingleExtension;
-  }
-
-  /**
-   * Just a wrapper to {@link #setForceSingleExtension(boolean)}.
-   * 
-   * @param forceSingleExtension
-   */
-  public static void setForceSingleExtension(final String forceSingleExtension) {
-  	ConfigurationHandler.forceSingleExtension = Boolean.parseBoolean(forceSingleExtension);
-  }
-  
-	/**
-	 * Getter for a default property with the name 'key'.
-	 * 
-	 * @param key
-	 * @return The required property or null, if doesn't exists.
-	 */
-	public static String getDefaultProperty(final String key) {
-		return defaultProperties.getProperty(key);
-	}
-
-	/**
-	 * Getter for the dafault properties.
-	 * 
-	 * @return Default properties.
-	 */
-	public static Properties getDefaultProperties() {
-		return defaultProperties;
-	}
-
-	/**
-	 * Getter for the sub dir name of a media type.
-	 * 
-	 * @param type
-	 * @return The sub dir name of the requested type, or the default one ('file') if 'type' is unknown or empty.
-	 */
-	public static String getSubDirForType(final String type) {
-		String defaultSubDir = getDefaultProperty("fckeditor.subdir.media.file");
-		if (Utils.isEmpty(type))
-			return defaultSubDir;
-		String subDir = getDefaultProperty("fckeditor.subdir.media.".concat(type.toLowerCase()));
-
-		return (Utils.isEmpty(subDir)) ? defaultSubDir : subDir;
-	}
-}
Index: Keditor.Java/branches/2.4/src/main/java/net/fckeditor/Constants.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/Constants.java	(revision 1454)
+++ 	(revision )
@@ -1,34 +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;
-
-/**
- * Some global constants.
- *
- * @version $Id$
- */
-public class Constants {
-	
-    public static final String FILE_TYPE_FILE = "File";  // the default
-    public static final String FILE_TYPE_IMAGE = "Image";
-    public static final String FILE_TYPE_FLASH = "Flash";
-    public static final String FILE_TYPE_MEDIA = "Media";
-}
Index: Keditor.Java/branches/2.4/src/main/java/net/fckeditor/ExtensionsHandler.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/ExtensionsHandler.java	(revision 1454)
+++ 	(revision )
@@ -1,135 +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;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import net.fckeditor.tool.Utils;
-
-/**
- * Static object which manages the allowed and denied extensions for each file type. The
- * extensions are preset by the defaults defined in default.properties.
- * 
- * Hint: It's recomment use either allowed or denied extensions for one file type.
- * Never use both at the same time! That's why denied extensions of a file type will be 
- * deleted, if you set the allowed one and vice versa.
- * 
- * @version $Id$
- */
-public class ExtensionsHandler {
-
-	private static Map<String, Set<String>> extensionsAllowed = new HashMap<String, Set<String>>();
-	private static Map<String, Set<String>> extensionsDenied = new HashMap<String, Set<String>>();
-
-	static {
-		// load defaults
-		extensionsAllowed.put(Constants.FILE_TYPE_FILE, Utils.getSet(ConfigurationHandler
-		    .getDefaultProperty("fckeditor.file.extensions.allowed")));
-		extensionsDenied.put(Constants.FILE_TYPE_FILE, Utils.getSet(ConfigurationHandler
-		    .getDefaultProperty("fckeditor.file.extensions.denied")));
-		extensionsAllowed.put(Constants.FILE_TYPE_MEDIA, Utils.getSet(ConfigurationHandler
-		    .getDefaultProperty("fckeditor.media.extensions.allowed")));
-		extensionsDenied.put(Constants.FILE_TYPE_MEDIA, Utils.getSet(ConfigurationHandler
-		    .getDefaultProperty("fckeditor.media.extensions.denied")));
-		extensionsAllowed.put(Constants.FILE_TYPE_IMAGE, Utils.getSet(ConfigurationHandler
-		    .getDefaultProperty("fckeditor.image.extensions.allowed")));
-		extensionsDenied.put(Constants.FILE_TYPE_IMAGE, Utils.getSet(ConfigurationHandler
-		    .getDefaultProperty("fckeditor.image.extensions.denied")));
-		extensionsAllowed.put(Constants.FILE_TYPE_FLASH, Utils.getSet(ConfigurationHandler
-		    .getDefaultProperty("fckeditor.flash.extensions.allowed")));
-		extensionsDenied.put(Constants.FILE_TYPE_FLASH, Utils.getSet(ConfigurationHandler
-		    .getDefaultProperty("fckeditor.flash.extensions.denied")));
-	}
-
-	/**
-	 * Getter for the allowed extensions of a file type.
-	 * 
-	 * @param type
-	 *          The file type.
-	 * @return Set of allowed extensions or an empty set.
-	 */
-	public static Set<String> getExtensionsAllowed(final String type) {
-		return extensionsAllowed.get(type);
-	}
-
-	/**
-	 * Setter for the allowed extensions of a file type. The denied extensions will be cleared.<br>
-	 * If 'extensionsList' is null, allowed extensions kept untouched.
-	 * 
-	 * @param type
-	 *          The file type.
-	 * @param extensionsList
-	 *          Required format: <code>ext1&#124;ext2&#124;ext3</code>
-	 */
-	public static void setExtensionsAllowed(final String type, final String extensionsList) {
-		if (extensionsList != null) {
-			extensionsAllowed.put(type, Utils.getSet(extensionsList));
-			extensionsDenied.get(type).clear();
-		}
-	}
-
-	/**
-	 * Getter for the denied extensions of a file type.
-	 * 
-	 * @param type
-	 *          The file type.
-	 * @return Set of denied extensions or an empty set.
-	 */
-	public static Set<String> getExtensionsDenied(final String type) {
-		return extensionsDenied.get(type);
-	}
-
-	/**
-	 * Setter for the denied extensions of a file type. The allowed extensions will be cleared.<br>
-	 * If 'extensionsList' is null, denied extensions kept untouched.
-	 * 
-	 * @param type
-	 *          The file type.
-	 * @param extensionsList
-	 *          Required format: <code>ext1&#124;ext2&#124;ext3</code>
-	 */
-	public static void setExtensionsDenied(final String type, final String extensionsList) {
-		if (extensionsList != null) {
-			extensionsDenied.put(type, Utils.getSet(extensionsList));
-			extensionsAllowed.get(type).clear();
-		}
-	}
-
-	/**
-	 * Checks, if an extension is allowed for a file type.
-	 * 
-	 * @param type
-	 * @param extension
-	 * @return True, false.
-	 */
-	public static boolean isAllowed(final String type, final String extension) {
-		String ext = extension.toLowerCase();
-		Set<String> allowed = extensionsAllowed.get(type);
-		Set<String> denied = extensionsDenied.get(type);
-		if (allowed.isEmpty())
-			return (denied.contains(ext)) ? false : true;
-		if (denied.isEmpty())
-			return (allowed.contains(ext)) ? true : false;
-		return false;
-	}
-}
Index: /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/FCKeditor.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/FCKeditor.java	(revision 1454)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/FCKeditor.java	(revision 1455)
@@ -24,4 +24,5 @@
 import javax.servlet.http.HttpServletRequest;
 
+import net.fckeditor.handlers.ConfigurationHandler;
 import net.fckeditor.tool.Compatibility;
 import net.fckeditor.tool.Utils;
Index: /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/FileType.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/FileType.java	(revision 1455)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/FileType.java	(revision 1455)
@@ -0,0 +1,34 @@
+/*
+ * 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;
+
+
+/**
+ * The different types of files to work with.
+ *
+ * @version $Id$
+ */
+public enum FileType {
+	FILE,		// the defaults
+	IMAGE,
+	FLASH,
+	MEDIA
+}
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 1454)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/connector/ConnectorServlet.java	(revision 1455)
@@ -45,7 +45,8 @@
 import javax.xml.transform.stream.StreamResult;
 
-import net.fckeditor.ConfigurationHandler;
-import net.fckeditor.Constants;
-import net.fckeditor.ExtensionsHandler;
+import net.fckeditor.FileType;
+import net.fckeditor.handlers.ConfigurationHandler;
+import net.fckeditor.handlers.ExtensionsHandler;
+import net.fckeditor.handlers.FileTypeHandler;
 import net.fckeditor.tool.UploadResponse;
 import net.fckeditor.tool.Utils;
@@ -98,11 +99,11 @@
 			ConfigurationHandler.setBaseDir(getInitParameter("baseDir"));
 	
-		setExtension(Constants.FILE_TYPE_FILE, getInitParameter("AllowedExtensionsFile"),
+		setExtension(FileType.FILE, getInitParameter("AllowedExtensionsFile"),
 				getInitParameter("DeniedExtensionsFile"));
-		setExtension(Constants.FILE_TYPE_IMAGE, getInitParameter("AllowedExtensionsImage"),
+		setExtension(FileType.IMAGE, getInitParameter("AllowedExtensionsImage"),
 				getInitParameter("DeniedExtensionsImage"));
-		setExtension(Constants.FILE_TYPE_FLASH, getInitParameter("AllowedExtensionsFlash"),
+		setExtension(FileType.FLASH, getInitParameter("AllowedExtensionsFlash"),
 				getInitParameter("DeniedExtensionsFlash"));
-		setExtension(Constants.FILE_TYPE_MEDIA, getInitParameter("AllowedExtensionsMedia"),
+		setExtension(FileType.MEDIA, getInitParameter("AllowedExtensionsMedia"),
 				getInitParameter("DeniedExtensionsMedia"));
 		
@@ -140,4 +141,5 @@
 		String typeStr = request.getParameter("Type");
 		String currentFolderStr = request.getParameter("CurrentFolder");
+		FileType fileType = FileTypeHandler.getTypeDefault(typeStr);
 		
 		logger.debug("Parameter Command: {}", commandStr);
@@ -146,5 +148,5 @@
 
 		// TODO untersuchen wie es vom Res Browser kommt
-		String currentPath = constructTypeBasedFolderString(typeStr,
+		String currentPath = constructTypeBasedFolderString(fileType,
 				currentFolderStr);
 		String currentDirPath = getServletContext().getRealPath(currentPath);
@@ -238,4 +240,6 @@
 		String typeStr = request.getParameter("Type");
 		String currentFolderStr = request.getParameter("CurrentFolder");
+		if (!FileTypeHandler.isValid(typeStr))
+			logger.warn("Unknown Type requested: {}", typeStr);
 
 		logger.debug("Parameter Command: {}", commandStr);
@@ -248,7 +252,6 @@
 		}
 
-		if (isEmpty(typeStr))
-			typeStr = "File";
-
+		FileType fileType = FileTypeHandler.getTypeDefault(typeStr);
+		
 		UploadResponse ur = null;
 
@@ -260,5 +263,5 @@
 		else {
 
-			String currentPath = constructTypeBasedFolderString(typeStr,
+			String currentPath = constructTypeBasedFolderString(fileType,
 					currentFolderStr);
 			String currentDirPath = getServletContext()
@@ -274,6 +277,5 @@
 				ServletFileUpload upload = new ServletFileUpload(factory);
 				try {
-					List<FileItem> items = (List<FileItem>) upload
-							.parseRequest(request);
+					List<FileItem> items = upload.parseRequest(request);
 
 					// We upload only one file at the same time
@@ -284,5 +286,5 @@
 
 					boolean validExtension = ExtensionsHandler.isAllowed(
-							typeStr, extension);
+						FileTypeHandler.getType(typeStr), extension);
 
 					if (!validExtension)
@@ -376,9 +378,8 @@
 	}
 
-	private String constructTypeBasedFolderString(final String fileType,
-			final String currentFolderString) {
+	private String constructTypeBasedFolderString(final FileType fileType, final String currentFolderString) {
 		StringWriter retval = new StringWriter();
 		retval.append(ConfigurationHandler.getBaseDir());
-		retval.append(ConfigurationHandler.getSubDirForType(fileType));
+		retval.append(FileTypeHandler.getSubDirForType(fileType));
 		retval.append(currentFolderString);
 		return replaceAll(retval.toString(), "//", "/");
@@ -394,8 +395,8 @@
 	 * @throws IllegalArgumentException if allowed and denied extensions are set.
 	 */
-	private void setExtension(final String type, final String allowedList, final String deniedList) {
+	private void setExtension(final FileType type, final String allowedList, final String deniedList) {
 		// if both lists are set, we have to throw an error, because only one list should be set
 		if (Utils.isNotEmpty(allowedList) && Utils.isNotEmpty(deniedList)) {
-			String errorMsg = "Allowed and denied extensions are set for [" + type + "]. Just one of them should be set!";
+			String errorMsg = "Allowed and denied extensions are set for [" + type.toString() + "]. Just one of them should be set!";
 			logger.error(errorMsg);
 			throw new IllegalArgumentException(errorMsg);
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 1455)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/ConfigurationHandler.java	(revision 1455)
@@ -0,0 +1,222 @@
+/*
+ * 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.handlers;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+import net.fckeditor.IBaseDirProvider;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Static configuration handler object, which provides getters and setters for basic values like 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. <br />
+ * If the {@link IBaseDirProvider} is set, {@link #getBaseDir()} is calling {@link IBaseDirProvider#getDir()} to get the
+ * user dir.
+ * 
+ * @version $Id:ConfigurationHandler.java 1099 2008-11-06 15:01:50Z th-schwarz $
+ */
+public class ConfigurationHandler {
+	private static final Logger logger = LoggerFactory.getLogger(ConfigurationHandler.class);
+
+	private static Properties defaultProperties = new Properties();
+	private static String baseDir;
+	private static IBaseDirProvider baseDirProvider = null;
+	private static String fckEditorDir;
+	private static String fckEditorHeight;
+	private static String fckEditorWidth;
+	private static String fckEditorToolbarSet;
+	private static boolean forceSingleExtension;
+
+	static {
+		// load defaults
+		try {
+			defaultProperties.load(new BufferedInputStream(ConfigurationHandler.class
+			    .getResourceAsStream("default.properties")));
+		} catch (IOException e) {
+			logger.error("Error while loading the default properties!", e);
+			throw new RuntimeException("Can't load default properties!", e);
+		}
+		baseDir = defaultProperties.getProperty("fckeditor.basedir");
+		fckEditorDir = defaultProperties.getProperty("fckeditor.dir");
+		fckEditorWidth = defaultProperties.getProperty("fckeditor.width");
+		fckEditorHeight = defaultProperties.getProperty("fckeditor.height");
+		fckEditorToolbarSet = defaultProperties.getProperty("fckeditor.toolbarset");
+		forceSingleExtension = Boolean.valueOf(defaultProperties.getProperty("fckeditor.forcesingleextension"));
+
+		logger.info("Default properties loaded and initialized successfully.");
+	}
+
+	
+	/**
+	 * 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;
+	}
+
+	/**
+	 * Setter for the base dir (using for user files).
+	 * 
+	 * @param baseDir
+	 *          relative to the context root (no leading or ending /).
+	 */
+	public static void setBaseDir(final String baseDir) {
+		ConfigurationHandler.baseDir = baseDir;
+	}
+
+	/**
+	 * Getter for the {@link IBaseDirProvider}.
+	 * 
+	 * @param baseDirProvider
+	 */
+	public static void setBaseDirProvider(final IBaseDirProvider baseDirProvider) {
+		ConfigurationHandler.baseDirProvider = baseDirProvider;
+	}
+
+	/**
+	 * Getter for the dir of the fckeditor.
+	 * 
+	 * @return Dir of the fckeditor relative to the context root.
+	 */
+	public static String getFckEditorDir() {
+		return fckEditorDir;
+	}
+
+	/**
+	 * Setter for the dir of the fckeditor.
+	 * 
+	 * @param fckEditorDir
+	 *          relative to the context root (no leading or ending /).
+	 */
+	public static void setFckEditorDir(final String fckEditorDir) {
+		ConfigurationHandler.fckEditorDir = fckEditorDir;
+	}
+
+	/**
+	 * Getter for the default height of the fckeditor.
+	 * 
+	 * @return Default height of the fckeditor.
+	 */
+	public static String getFckEditorHeight() {
+		return fckEditorHeight;
+	}
+
+	/**
+	 * Setter for the default height of the fckeditor.
+	 * 
+	 * @param fckEditorHeight
+	 *          the default height of the fckeditor.
+	 */
+	public static void setFckEditorHeight(final String fckEditorHeight) {
+		ConfigurationHandler.fckEditorHeight = fckEditorHeight;
+	}
+
+	/**
+	 * Getter for the default width of the fckeditor.
+	 * 
+	 * @return Default width of the fckeditor.
+	 */
+	public static String getFckEditorWidth() {
+		return fckEditorWidth;
+	}
+
+	/**
+	 * Setter for the default width of the fckeditor.
+	 * 
+	 * @param fckEditorWidth
+	 *          the default width of the fckeditor.
+	 */
+	public static void setFckEditorWidth(final String fckEditorWidth) {
+		ConfigurationHandler.fckEditorWidth = fckEditorWidth;
+	}
+
+	/**
+	 * Getter of the name of the default toolbarset of the fckeditor.
+	 * 
+	 * @return Name of the default toolbar set.
+	 */
+	public static String getFckEditorToolbarSet() {
+		return fckEditorToolbarSet;
+	}
+
+	/**
+	 * Getter of the name of the default toolbarset of the fckeditor.
+	 * 
+	 * @param fckEditorToolbarSet
+	 *          the name of the toolbarset.
+	 */
+	public static void setFckEditorToolbarSet(final String fckEditorToolbarSet) {
+		ConfigurationHandler.fckEditorToolbarSet = fckEditorToolbarSet;
+	}
+	
+	/**
+	 * Getter for the default handling of single extensions.
+	 * 
+   * @return the forceSingleExtension
+   */
+  public static boolean isForceSingleExtension() {
+  	return forceSingleExtension;
+  }
+
+	/**
+	 * Setter for the default handling of single extensions.
+	 *
+   * @param forceSingleExtension the forceSingleExtension to set
+   */
+  public static void setForceSingleExtension(boolean forceSingleExtension) {
+  	ConfigurationHandler.forceSingleExtension = forceSingleExtension;
+  }
+
+  /**
+   * Just a wrapper to {@link #setForceSingleExtension(boolean)}.
+   * 
+   * @param forceSingleExtension
+   */
+  public static void setForceSingleExtension(final String forceSingleExtension) {
+  	ConfigurationHandler.forceSingleExtension = Boolean.parseBoolean(forceSingleExtension);
+  }
+  
+	/**
+	 * Getter for a default property with the name 'key'.
+	 * 
+	 * @param key
+	 * @return The required property or null, if doesn't exists.
+	 */
+	public static String getDefaultProperty(final String key) {
+		return defaultProperties.getProperty(key);
+	}
+
+	/**
+	 * Getter for the dafault properties.
+	 * 
+	 * @return Default properties.
+	 */
+	public static Properties getDefaultProperties() {
+		return defaultProperties;
+	}
+}
Index: /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/ExtensionsHandler.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/ExtensionsHandler.java	(revision 1455)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/ExtensionsHandler.java	(revision 1455)
@@ -0,0 +1,138 @@
+/*
+ * 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.handlers;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import net.fckeditor.FileType;
+import net.fckeditor.tool.Utils;
+
+/**
+ * Static object which manages the allowed and denied extensions for each file type. The
+ * extensions are preset by the defaults defined in default.properties.
+ * 
+ * Hint: It's recomment use either allowed or denied extensions for one file type.
+ * Never use both at the same time! That's why denied extensions of a file type will be 
+ * deleted, if you set the allowed one and vice versa.
+ * 
+ * @version $Id: ExtensionsHandler.java 1432 2008-01-27 20:12:42Z th-schwarz $
+ */
+public class ExtensionsHandler {
+
+	private static Map<FileType, Set<String>> extensionsAllowed = new HashMap<FileType, Set<String>>();
+	private static Map<FileType, Set<String>> extensionsDenied = new HashMap<FileType, Set<String>>();
+
+	static {
+		// load defaults
+		extensionsAllowed.put(FileType.FILE, Utils.getSet(ConfigurationHandler
+		    .getDefaultProperty("fckeditor.file.extensions.allowed")));
+		extensionsDenied.put(FileType.FILE, Utils.getSet(ConfigurationHandler
+		    .getDefaultProperty("fckeditor.file.extensions.denied")));
+		extensionsAllowed.put(FileType.MEDIA, Utils.getSet(ConfigurationHandler
+		    .getDefaultProperty("fckeditor.media.extensions.allowed")));
+		extensionsDenied.put(FileType.MEDIA, Utils.getSet(ConfigurationHandler
+		    .getDefaultProperty("fckeditor.media.extensions.denied")));
+		extensionsAllowed.put(FileType.IMAGE, Utils.getSet(ConfigurationHandler
+		    .getDefaultProperty("fckeditor.image.extensions.allowed")));
+		extensionsDenied.put(FileType.IMAGE, Utils.getSet(ConfigurationHandler
+		    .getDefaultProperty("fckeditor.image.extensions.denied")));
+		extensionsAllowed.put(FileType.FLASH, Utils.getSet(ConfigurationHandler
+		    .getDefaultProperty("fckeditor.flash.extensions.allowed")));
+		extensionsDenied.put(FileType.FLASH, Utils.getSet(ConfigurationHandler
+		    .getDefaultProperty("fckeditor.flash.extensions.denied")));
+	}
+
+	/**
+	 * Getter for the allowed extensions of a file type.
+	 * 
+	 * @param type
+	 *          The file type.
+	 * @return Set of allowed extensions or an empty set.
+	 */
+	public static Set<String> getExtensionsAllowed(final FileType type) {
+		return extensionsAllowed.get(type);
+	}
+
+	/**
+	 * Setter for the allowed extensions of a file type. The denied extensions will be cleared.<br>
+	 * If 'extensionsList' is null, allowed extensions kept untouched.
+	 * 
+	 * @param type
+	 *          The file type.
+	 * @param extensionsList
+	 *          Required format: <code>ext1&#124;ext2&#124;ext3</code>
+	 */
+	public static void setExtensionsAllowed(final FileType type, final String extensionsList) {
+		if (extensionsList != null) {
+			extensionsAllowed.put(type, Utils.getSet(extensionsList));
+			extensionsDenied.get(type).clear();
+		}
+	}
+
+	/**
+	 * Getter for the denied extensions of a file type.
+	 * 
+	 * @param type
+	 *          The file type.
+	 * @return Set of denied extensions or an empty set.
+	 */
+	public static Set<String> getExtensionsDenied(final FileType type) {
+		return extensionsDenied.get(type);
+	}
+
+	/**
+	 * Setter for the denied extensions of a file type. The allowed extensions will be cleared.<br>
+	 * If 'extensionsList' is null, denied extensions kept untouched.
+	 * 
+	 * @param type
+	 *          The file type.
+	 * @param extensionsList
+	 *          Required format: <code>ext1&#124;ext2&#124;ext3</code>
+	 */
+	public static void setExtensionsDenied(final FileType type, final String extensionsList) {
+		if (extensionsList != null) {
+			extensionsDenied.put(type, Utils.getSet(extensionsList));
+			extensionsAllowed.get(type).clear();
+		}
+	}
+
+	/**
+	 * Checks, if an extension is allowed for a file type.
+	 * 
+	 * @param type
+	 * @param extension
+	 * @return True, false. False is returned too, if 'type' or 'extensions' is null.
+	 */
+	public static boolean isAllowed(final FileType type, final String extension) {
+		if (type == null || extension == null)
+			return false;
+		String ext = extension.toLowerCase();
+		Set<String> allowed = extensionsAllowed.get(type);
+		Set<String> denied = extensionsDenied.get(type);
+		if (allowed.isEmpty())
+			return (denied.contains(ext)) ? false : true;
+		if (denied.isEmpty())
+			return (allowed.contains(ext)) ? true : false;
+		return false;
+	}
+}
Index: /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/FileTypeHandler.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/FileTypeHandler.java	(revision 1455)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/FileTypeHandler.java	(revision 1455)
@@ -0,0 +1,90 @@
+/*
+ * 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.handlers;
+
+import net.fckeditor.FileType;
+import net.fckeditor.tool.Utils;
+
+/**
+ * Collection of little helper methods for {@link FileType}.
+ * 
+ * @version $Id$
+ */
+public class FileTypeHandler {
+
+	/**
+	 * Finds the right {@link FileType} for a string representation. The case sensitifity of 'type'
+	 * will be ignored.
+	 * 
+	 * @param type
+	 * @return <code>null</code> if 'type' is unknown or null, otherwise {@link FileType}.
+	 */
+	public static FileType getType(final String type) {
+		if (type == null)
+			return null;
+		for (FileType fileType : FileType.values()) {
+			if (fileType.name().equalsIgnoreCase(type))
+				return fileType;
+		}
+		return null;
+	}
+
+	/**
+	 * Checks if 'type' is a string representation of {@link FileType}.
+	 * 
+	 * @param type
+	 * @return
+	 */
+	public static boolean isValid(final String type) {
+		return (getType(type) != null);
+	}
+
+	/**
+	 * Just a wrapper to {@link #getType(String)}, but returns the default file type, if 'type' is unkown.
+	 * 
+	 * @param type
+	 * @return
+	 */
+	public static FileType getTypeDefault(final String type) {
+		FileType fileType = getType(type);
+		return (fileType == null) ? FileType.FILE : fileType;
+	}
+
+	/**
+	 * Getter for the sub dir name of a media type.<br>
+	 * 
+	 * Hint: Like  the path defaults in default.properties, the sub dir name starts with '/'.
+	 * 
+	 * @param type
+	 * @return The sub dir name of the requested type, or the default one ('file') if 'type' is null
+	 *         or the default value ist missing.
+	 */
+	public static String getSubDirForType(final FileType type) {
+		String defaultSubDir = ConfigurationHandler
+		        .getDefaultProperty("fckeditor.subdir.media.file");
+		if (type == null)
+			return defaultSubDir;
+		String subDir = ConfigurationHandler.getDefaultProperty("fckeditor.subdir.media."
+		        .concat(type.name().toLowerCase()));
+
+		return (Utils.isEmpty(subDir)) ? defaultSubDir : subDir;
+	}
+}
Index: Keditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/TypeHandler.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/TypeHandler.java	(revision 1454)
+++ 	(revision )
@@ -1,32 +1,0 @@
-package net.fckeditor.handlers;
-
-import java.util.HashSet;
-import java.util.Set;
-
-public class TypeHandler {
-	
-	public static final String FILE = "File";  // the default
-    public static final String IMAGE = "Image";
-    public static final String FLASH = "Flash";
-    public static final String MEDIA = "Media";
-    
-    private static Set<String> types = new HashSet<String>(4);
-    
-    static {
-    	types.add(FILE);
-    	types.add(IMAGE);
-    	types.add(FLASH);
-    	types.add(MEDIA);
-    }
-    
-    public static boolean isValid(final String type) {
-    	return types.contains(type);
-    }
-    
-    public static String validate(final String type) {
-    	if (isValid(type))
-    		return type;
-    	else return FILE;
-    }
-
-}
Index: Keditor.Java/branches/2.4/src/main/resources/net/fckeditor/default.properties
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/resources/net/fckeditor/default.properties	(revision 1454)
+++ 	(revision )
@@ -1,38 +1,0 @@
-## Default properties.
-##
-## @version $Id: default.properties 1184 2008-01-03 10:39:36Z th-schwarz $ 
-
-
-# default width of the editor
-fckeditor.width=100%
-
-# default height of the editor
-fckeditor.height=200px
-
-# default toolbar set of the editor
-fckeditor.toolbarset=Default
-
-# directory of the editor relative to the context root (starting / and no ending /)
-fckeditor.dir=/fckeditor
-
-# base directory for the user files relative to the context root (starting / and no ending /)
-fckeditor.basedir=/userfiles
-
-# sub-directories for each file type
-fckeditor.subdir.media.file=/file
-fckeditor.subdir.media.image=/image
-fckeditor.subdir.media.flash=/flash
-fckeditor.subdir.media.media=/media
-
-# allowed and denied extensions for each file type
-fckeditor.file.extensions.allowed=
-fckeditor.file.extensions.denied=php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi
-fckeditor.image.extensions.allowed=jpg|gif|jpeg|png|bmp
-fckeditor.image.extensions.denied=
-fckeditor.flash.extensions.allowed=
-fckeditor.flash.extensions.denied=swf|fla
-fckeditor.media.extensions.allowed=
-fckeditor.media.extensions.denied=
-
-# Due to security issues with Apache modules, it is recommended to leave this setting enabled.
-fckeditor.forcesingleextension=true
Index: /FCKeditor.Java/branches/2.4/src/main/resources/net/fckeditor/handlers/default.properties
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/resources/net/fckeditor/handlers/default.properties	(revision 1455)
+++ /FCKeditor.Java/branches/2.4/src/main/resources/net/fckeditor/handlers/default.properties	(revision 1455)
@@ -0,0 +1,38 @@
+## Default properties.
+##
+## @version $Id: default.properties 1184 2008-01-03 10:39:36Z th-schwarz $ 
+
+
+# default width of the editor
+fckeditor.width=100%
+
+# default height of the editor
+fckeditor.height=200px
+
+# default toolbar set of the editor
+fckeditor.toolbarset=Default
+
+# directory of the editor relative to the context root (starting / and no ending /)
+fckeditor.dir=/fckeditor
+
+# base directory for the user files relative to the context root (starting / and no ending /)
+fckeditor.basedir=/userfiles
+
+# sub-directories for each file type
+fckeditor.subdir.media.file=/file
+fckeditor.subdir.media.image=/image
+fckeditor.subdir.media.flash=/flash
+fckeditor.subdir.media.media=/media
+
+# allowed and denied extensions for each file type
+fckeditor.file.extensions.allowed=
+fckeditor.file.extensions.denied=php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi
+fckeditor.image.extensions.allowed=jpg|gif|jpeg|png|bmp
+fckeditor.image.extensions.denied=
+fckeditor.flash.extensions.allowed=
+fckeditor.flash.extensions.denied=swf|fla
+fckeditor.media.extensions.allowed=
+fckeditor.media.extensions.denied=
+
+# Due to security issues with Apache modules, it is recommended to leave this setting enabled.
+fckeditor.forcesingleextension=true
Index: Keditor.Java/branches/2.4/src/test/java/net/fckeditor/ExtensionsHandlerTest.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/test/java/net/fckeditor/ExtensionsHandlerTest.java	(revision 1454)
+++ 	(revision )
@@ -1,56 +1,0 @@
-/*
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2007 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 static org.junit.Assert.*;
-
-import org.junit.Test;
-
-/**
- * Tests for {@link ExtensionsHandler};
- *
- * @version $Id$
- */
-public class ExtensionsHandlerTest {
-
-	@Test
-	public void testIsAllowed01() {
-		String type = Constants.FILE_TYPE_FILE;
-		ExtensionsHandler.setExtensionsAllowed(type, "a");
-		ExtensionsHandler.setExtensionsDenied(type, "b");
-		assertTrue(ExtensionsHandler.getExtensionsAllowed(type).isEmpty());
-		assertTrue(ExtensionsHandler.getExtensionsDenied(type).contains("b"));
-		assertFalse(ExtensionsHandler.isAllowed(type, "b"));
-		assertTrue(ExtensionsHandler.isAllowed(type, "a"));
-		assertTrue(ExtensionsHandler.isAllowed(type, "c"));
-	}
-	
-	@Test
-	public void testIsAllowed02() {
-		String type = Constants.FILE_TYPE_FILE;
-		ExtensionsHandler.setExtensionsAllowed(type, "a|b|c");
-		assertTrue(ExtensionsHandler.isAllowed(type, "a"));
-		assertTrue(ExtensionsHandler.isAllowed(type, "b"));
-		assertTrue(ExtensionsHandler.isAllowed(type, "c"));
-		assertFalse(ExtensionsHandler.isAllowed(type, "d"));
-	}
-
-}
Index: /FCKeditor.Java/branches/2.4/src/test/java/net/fckeditor/handlers/ExtensionsHandlerTest.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/test/java/net/fckeditor/handlers/ExtensionsHandlerTest.java	(revision 1455)
+++ /FCKeditor.Java/branches/2.4/src/test/java/net/fckeditor/handlers/ExtensionsHandlerTest.java	(revision 1455)
@@ -0,0 +1,58 @@
+/*
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net
+ * Copyright (C) 2003-2007 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.handlers;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import net.fckeditor.FileType;
+
+import org.junit.Test;
+
+/**
+ * Tests for {@link ExtensionsHandler};
+ *
+ * @version $Id$
+ */
+public class ExtensionsHandlerTest {
+	
+	@Test
+	public void testIsAllowed01() {
+		FileType type = FileType.FILE;
+		ExtensionsHandler.setExtensionsAllowed(type, "a");
+		ExtensionsHandler.setExtensionsDenied(type, "b");
+		assertTrue(ExtensionsHandler.getExtensionsAllowed(type).isEmpty());
+		assertTrue(ExtensionsHandler.getExtensionsDenied(type).contains("b"));
+		assertFalse(ExtensionsHandler.isAllowed(type, "b"));
+		assertTrue(ExtensionsHandler.isAllowed(type, "a"));
+		assertTrue(ExtensionsHandler.isAllowed(type, "c"));
+	}
+	
+	@Test
+	public void testIsAllowed02() {
+		FileType type = FileType.FILE;
+		ExtensionsHandler.setExtensionsAllowed(type, "a|b|c");
+		assertTrue(ExtensionsHandler.isAllowed(type, "a"));
+		assertTrue(ExtensionsHandler.isAllowed(type, "b"));
+		assertTrue(ExtensionsHandler.isAllowed(type, "c"));
+		assertFalse(ExtensionsHandler.isAllowed(type, "d"));
+	}
+
+}
Index: /FCKeditor.Java/branches/2.4/src/test/java/net/fckeditor/handlers/FileTypeHandlerTest.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/test/java/net/fckeditor/handlers/FileTypeHandlerTest.java	(revision 1455)
+++ /FCKeditor.Java/branches/2.4/src/test/java/net/fckeditor/handlers/FileTypeHandlerTest.java	(revision 1455)
@@ -0,0 +1,91 @@
+/*
+ * 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.handlers;
+
+import static org.junit.Assert.*;
+
+import net.fckeditor.FileType;
+
+import org.junit.Test;
+
+/**
+ * Tests for {@link FileTypeHandler}.
+ *
+ * @version $Id$
+ */
+public class FileTypeHandlerTest {
+
+	
+	@Test
+    public void getType01() throws Exception {
+	    assertTrue(FileTypeHandler.getType("xyz") == null);
+    }
+
+	@Test
+    public void getType02() throws Exception {
+	    assertTrue(FileTypeHandler.getType("file") == FileType.FILE);
+    }
+
+	@Test
+    public void getType03() throws Exception {
+	    assertTrue(FileTypeHandler.getType("FiLe") == FileType.FILE);
+    }
+	
+	@Test
+    public void getType04() throws Exception {
+	    assertTrue(FileTypeHandler.getType("IMAGE") == FileType.IMAGE);
+    }
+	
+	@Test
+    public void isValid01() throws Exception {
+	    assertFalse(FileTypeHandler.isValid("1234"));
+    }
+	
+	@Test
+    public void isValid02() throws Exception {
+	    assertTrue(FileTypeHandler.isValid("fLash"));
+    }
+
+	@Test
+    public void isValid03() throws Exception {
+	    assertTrue(FileTypeHandler.isValid("MeDiA"));
+    }
+	
+	@Test
+    public void getTypeDefault01() throws Exception {
+	    assertTrue(FileTypeHandler.getTypeDefault("wrong-type").equals(FileType.FILE));
+    }
+
+	@Test
+    public void getTypeDefault02() throws Exception {
+	    assertTrue(FileTypeHandler.getTypeDefault("flAsh").equals(FileType.FLASH));
+    }
+	
+	@Test
+    public void getSubDirForType01() throws Exception {
+	    assertTrue(FileTypeHandler.getSubDirForType(null).equals("/file"));
+    }
+
+	@Test
+    public void getSubDirForType02() throws Exception {
+	    assertTrue(FileTypeHandler.getSubDirForType(FileType.FILE).equals("/file"));
+    }
+}
