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 1456)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/connector/ConnectorServlet.java	(revision 1457)
@@ -69,10 +69,9 @@
  * Servlet to upload and browse files.<br>
  * 
- * This servlet accepts 4 commands used to retrieve and create files and folders
- * from a server directory. The allowed commands are:
+ * This servlet accepts 4 commands used to retrieve and create files and folders from a server
+ * directory. The allowed commands are:
  * <ul>
  * <li>GetFolders: Retrive the list of directory under the current folder
- * <li>GetFoldersAndFiles: Retrive the list of files and directory under the
- * current folder
+ * <li>GetFoldersAndFiles: Retrive the list of files and directory under the current folder
  * <li>CreateFolder: Create a new directory under the current folder
  * <li>FileUpload: Send a new file to the server (must be sent with a POST)
@@ -84,39 +83,42 @@
 
 	private static final long serialVersionUID = -5742008970929377161L;
-	private static final Logger logger = LoggerFactory
-			.getLogger(ConnectorServlet.class); 
+	private static final Logger logger = LoggerFactory.getLogger(ConnectorServlet.class);
 
 	/**
 	 * Initialize the servlet.<br>
-	 * The optional init parameters will be read and used to adjust the defaults 
-	 * of the {@link ConfigurationHandler} and the {@link ExtensionsHandler}.
+	 * The optional 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 {		
+	public void init() throws ServletException, IllegalArgumentException {
+		ConfigurationHandler.setConnectorEnabled(getInitParameter("enabled"));
 		if (getInitParameter("ForceSingleExtension") != null)
 			ConfigurationHandler.setForceSingleExtension(getInitParameter("ForceSingleExtension"));
-			
-		if (getInitParameter("baseDir") != null)  // TODO should we check, if 'baseDir' contains '..' ?? 
+
+		if (getInitParameter("baseDir") != null) // TODO should 'baseDir' contains '..' ??
 			ConfigurationHandler.setBaseDir(getInitParameter("baseDir"));
-	
+
 		setExtension(FileType.FILE, getInitParameter("AllowedExtensionsFile"),
-				getInitParameter("DeniedExtensionsFile"));
+		        getInitParameter("DeniedExtensionsFile"));
 		setExtension(FileType.IMAGE, getInitParameter("AllowedExtensionsImage"),
-				getInitParameter("DeniedExtensionsImage"));
+		        getInitParameter("DeniedExtensionsImage"));
 		setExtension(FileType.FLASH, getInitParameter("AllowedExtensionsFlash"),
-				getInitParameter("DeniedExtensionsFlash"));
+		        getInitParameter("DeniedExtensionsFlash"));
 		setExtension(FileType.MEDIA, getInitParameter("AllowedExtensionsMedia"),
-				getInitParameter("DeniedExtensionsMedia"));
-		
-		// check, if 'baseDir' exists
-		String realBaseDir = getServletContext().getRealPath(ConfigurationHandler.getBaseDir());
-		File baseFile = new File(realBaseDir);
-		if (!baseFile.exists()) {
-			baseFile.mkdirs();
-		}
-
-		logger.info("*** Connector Servlet initialized successfull!");
-	}
-	
-	
+		        getInitParameter("DeniedExtensionsMedia"));
+
+		if (!ConfigurationHandler.isConnectorEnabled()) {
+			logger.warn("*** ConnectorServlet isn't enabled!");
+		} else {
+			// check, if 'baseDir' exists
+			String realBaseDir = getServletContext().getRealPath(ConfigurationHandler.getBaseDir());
+			File baseFile = new File(realBaseDir);
+			if (!baseFile.exists()) {
+				baseFile.mkdirs();
+			}
+		}
+
+		logger.info("*** Connector Servletinitialized successfull!");
+	}
+
 	/**
 	 * Manage the Get requests (GetFolders, GetFoldersAndFiles, CreateFolder).<br>
@@ -125,10 +127,9 @@
 	 * connector?Command=CommandName&Type=ResourceType&CurrentFolder=FolderPath<br>
 	 * <br>
-	 * It execute the command and then return the results to the client in XML
-	 * format.
+	 * It execute the command and then return the results to the client in XML format.
 	 * 
 	 */
 	public void doGet(HttpServletRequest request, HttpServletResponse response)
-			throws ServletException, IOException {
+	        throws ServletException, IOException {
 		logger.debug("Entered #doGet.");
 
@@ -142,5 +143,5 @@
 		String currentFolderStr = request.getParameter("CurrentFolder");
 		FileType fileType = FileTypeHandler.getTypeDefault(typeStr);
-		
+
 		logger.debug("Parameter Command: {}", commandStr);
 		logger.debug("Parameter CurrentFolder: {}", currentFolderStr);
@@ -148,18 +149,16 @@
 
 		// TODO untersuchen wie es vom Res Browser kommt
-		String currentPath = constructTypeBasedFolderString(fileType,
-				currentFolderStr);
+		String currentPath = constructTypeBasedFolderString(fileType, currentFolderStr);
 		String currentDirPath = getServletContext().getRealPath(currentPath);
 
 		File currentDir = new File(currentDirPath);
-		if (!currentDir.exists()) {
+		if (!currentDir.exists() && ConfigurationHandler.isConnectorEnabled()) {
 			currentDir.mkdirs();
-			logger.debug("Dir successfull created: {}",currentDirPath);
+			logger.debug("Dir successfull created: {}", currentDirPath);
 		}
 
 		Document document = null;
 		try {
-			DocumentBuilderFactory factory = DocumentBuilderFactory
-					.newInstance();
+			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
 			DocumentBuilder builder = factory.newDocumentBuilder();
 			document = builder.newDocument();
@@ -168,8 +167,11 @@
 		}
 
-		Node root = createCommonXml(document, commandStr, typeStr,
-				currentFolderStr, request.getContextPath() + currentPath);
-
-		if (commandStr.equals("GetFolders")) {
+		Node root = createCommonXml(document, commandStr, typeStr, currentFolderStr, request
+		        .getContextPath().concat(currentPath));
+
+		if (!ConfigurationHandler.isConnectorEnabled()) {
+			createResponse("1", "This connector is disabled. Please check the web.xml!", root,
+			        document);
+		} else if (commandStr.equals("GetFolders")) {
 			getFolders(currentDir, root, document);
 		} else if (commandStr.equals("GetFoldersAndFiles")) {
@@ -195,5 +197,5 @@
 
 			}
-			setCreateFolderResponse(retValue, root, document);
+			createFolderResponse(retValue, root, document);
 		}
 
@@ -209,6 +211,5 @@
 
 		} catch (Exception ex) {
-			logger.error(
-					"Error while transforming DOM to HttpServletResponse", ex);
+			logger.error("Error while transforming DOM to HttpServletResponse", ex);
 		}
 
@@ -224,10 +225,10 @@
 	 * connector?Command=FileUpload&Type=ResourceType&CurrentFolder=FolderPath<br>
 	 * <br>
-	 * It store the file (renaming it in case a file with the same name exists)
-	 * and then return an HTML file with a javascript command in it.
+	 * It store the file (renaming it in case a file with the same name exists) and then return an
+	 * HTML file with a javascript command in it.
 	 * 
 	 */
 	public void doPost(HttpServletRequest request, HttpServletResponse response)
-			throws ServletException, IOException {
+	        throws ServletException, IOException {
 		logger.debug("Entering #doPost");
 
@@ -253,9 +254,11 @@
 
 		FileType fileType = FileTypeHandler.getTypeDefault(typeStr);
-		
+
 		UploadResponse ur = null;
 
-		if (isEmpty(commandStr) || isEmpty(currentFolderStr)
-				|| isEmpty(typeStr))
+		if (!ConfigurationHandler.isConnectorEnabled()) {
+			ur = new UploadResponse(UploadResponse.EN_SECURITY_ERROR, null, null,
+			        "This connector is disabled. Please check the web.xml!");
+		} else if (isEmpty(commandStr) || isEmpty(currentFolderStr) || isEmpty(typeStr))
 			ur = UploadResponse.UR_BAD_REQUEST;
 		else if (!commandStr.matches("(File|Quick)Upload"))
@@ -263,11 +266,8 @@
 		else {
 
-			String currentPath = constructTypeBasedFolderString(fileType,
-					currentFolderStr);
-			String currentDirPath = getServletContext()
-					.getRealPath(currentPath);
-
-			if (!isValidPath(currentFolderStr)
-					|| !(new File(currentDirPath).exists()))
+			String currentPath = constructTypeBasedFolderString(fileType, currentFolderStr);
+			String currentDirPath = getServletContext().getRealPath(currentPath);
+
+			if (!isValidPath(currentFolderStr) || !(new File(currentDirPath).exists()))
 				ur = UploadResponse.UR_BAD_REQUEST;
 			else {
@@ -285,6 +285,6 @@
 					String extension = FilenameUtils.getExtension(filename);
 
-					boolean validExtension = ExtensionsHandler.isAllowed(
-						FileTypeHandler.getType(typeStr), extension);
+					boolean validExtension = ExtensionsHandler.isAllowed(FileTypeHandler
+					        .getType(typeStr), extension);
 
 					if (!validExtension)
@@ -300,6 +300,5 @@
 						int counter = 1;
 						while (pathToSave.exists()) {
-							newFilename = baseName + "(" + counter + ")" + "."
-									+ extension;
+							newFilename = baseName + "(" + counter + ")" + "." + extension;
 							pathToSave = new File(currentDirPath, newFilename);
 							counter++;
@@ -308,11 +307,10 @@
 						uplFile.write(pathToSave);
 						if (isEmpty(newFilename)) {
-							ur = new UploadResponse(UploadResponse.EN_OK,
-									request.getContextPath() + currentPath
-											+ filename);
+							ur = new UploadResponse(UploadResponse.EN_OK, request.getContextPath()
+							        + currentPath + filename);
 						} else {
-							ur = new UploadResponse(UploadResponse.EN_RENAMED,
-									request.getContextPath() + currentPath
-											+ newFilename, newFilename);
+							ur = new UploadResponse(UploadResponse.EN_RENAMED, request
+							        .getContextPath()
+							        + currentPath + newFilename, newFilename);
 						}
 					}
@@ -331,9 +329,14 @@
 	}
 
-	private void setCreateFolderResponse(String retValue, Node root,
-			Document doc) {
+	private void createResponse(String retValue, String msg, Node root, Document doc) {
 		Element myEl = doc.createElement("Error");
 		myEl.setAttribute("number", retValue);
+		if (Utils.isNotEmpty(msg))
+			myEl.setAttribute("text", msg);
 		root.appendChild(myEl);
+	}
+
+	private void createFolderResponse(String retValue, Node root, Document doc) {
+		createResponse(retValue, null, root, doc);
 	}
 
@@ -341,6 +344,5 @@
 		Element folders = doc.createElement("Folders");
 		root.appendChild(folders);
-		File[] fileList = dir
-				.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY);
+		File[] fileList = dir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY);
 		for (File file : fileList) {
 			Element folderElement = doc.createElement("Folder");
@@ -363,6 +365,6 @@
 	}
 
-	private Node createCommonXml(Document doc, String commandStr,
-			String typeStr, String currentPath, String currentUrl) {
+	private Node createCommonXml(Document doc, String commandStr, String typeStr,
+	        String currentPath, String currentUrl) {
 		Element root = doc.createElement("Connector");
 		doc.appendChild(root);
@@ -378,5 +380,6 @@
 	}
 
-	private String constructTypeBasedFolderString(final FileType fileType, final String currentFolderString) {
+	private String constructTypeBasedFolderString(final FileType fileType,
+	        final String currentFolderString) {
 		StringWriter retval = new StringWriter();
 		retval.append(ConfigurationHandler.getBaseDir());
@@ -386,24 +389,26 @@
 	}
 
-
 	/**
-	 * Initializes the {@link ExtensionsHandler} with the allowed or denied extensions of a file type. 
+	 * Initializes the {@link ExtensionsHandler} with the allowed or denied extensions of a file
+	 * type.
 	 * 
 	 * @param type
 	 * @param allowedList
 	 * @param deniedList
-	 * @throws IllegalArgumentException if allowed and denied extensions are set.
+	 * @throws IllegalArgumentException
+	 *             if allowed and denied extensions are set.
 	 */
 	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.toString() + "]. 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);
 		}
-		
+
 		if (Utils.isNotEmpty(allowedList))
 			ExtensionsHandler.setExtensionsAllowed(type, allowedList);
-		else 
+		else
 			ExtensionsHandler.setExtensionsDenied(type, deniedList);
 	}
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 1456)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/ConfigurationHandler.java	(revision 1457)
@@ -26,4 +26,5 @@
 
 import net.fckeditor.IBaseDirProvider;
+import net.fckeditor.tool.Utils;
 
 import org.slf4j.Logger;
@@ -31,9 +32,11 @@
 
 /**
- * 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.
+ * 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. The defaults can be changed by calling the corresponding setter method.
+ * <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 $
@@ -50,4 +53,5 @@
 	private static String fckEditorToolbarSet;
 	private static boolean forceSingleExtension;
+	private static boolean connectorEnabled = false;
 
 	static {
@@ -55,5 +59,5 @@
 		try {
 			defaultProperties.load(new BufferedInputStream(ConfigurationHandler.class
-			    .getResourceAsStream("default.properties")));
+			        .getResourceAsStream("default.properties")));
 		} catch (IOException e) {
 			logger.error("Error while loading the default properties!", e);
@@ -65,10 +69,10 @@
 		fckEditorHeight = defaultProperties.getProperty("fckeditor.height");
 		fckEditorToolbarSet = defaultProperties.getProperty("fckeditor.toolbarset");
-		forceSingleExtension = Boolean.valueOf(defaultProperties.getProperty("fckeditor.forcesingleextension"));
+		forceSingleExtension = Boolean.valueOf(defaultProperties
+		        .getProperty("fckeditor.forcesingleextension"));
 
 		logger.info("Default properties loaded and initialized successfully.");
 	}
 
-	
 	/**
 	 * Getter for the base dir (using for user files).
@@ -84,5 +88,5 @@
 	 * 
 	 * @param baseDir
-	 *          relative to the context root (no leading or ending /).
+	 *            relative to the context root (no leading or ending /).
 	 */
 	public static void setBaseDir(final String baseDir) {
@@ -112,5 +116,5 @@
 	 * 
 	 * @param fckEditorDir
-	 *          relative to the context root (no leading or ending /).
+	 *            relative to the context root (no leading or ending /).
 	 */
 	public static void setFckEditorDir(final String fckEditorDir) {
@@ -131,5 +135,5 @@
 	 * 
 	 * @param fckEditorHeight
-	 *          the default height of the fckeditor.
+	 *            the default height of the fckeditor.
 	 */
 	public static void setFckEditorHeight(final String fckEditorHeight) {
@@ -150,5 +154,5 @@
 	 * 
 	 * @param fckEditorWidth
-	 *          the default width of the fckeditor.
+	 *            the default width of the fckeditor.
 	 */
 	public static void setFckEditorWidth(final String fckEditorWidth) {
@@ -169,37 +173,42 @@
 	 * 
 	 * @param fckEditorToolbarSet
-	 *          the name of the toolbarset.
+	 *            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;
-  }
+	 * @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);
-  }
-  
+	 * 
+	 * @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) {
+		if (Utils.isEmpty(forceSingleExtension))
+			setForceSingleExtension(Boolean.valueOf(defaultProperties
+			        .getProperty("fckeditor.forcesingleextension")));
+		else
+			setForceSingleExtension(Boolean.parseBoolean(forceSingleExtension));
+	}
+
 	/**
 	 * Getter for a default property with the name 'key'.
@@ -220,3 +229,34 @@
 		return defaultProperties;
 	}
+
+	/**
+	 * Specifies if the Connector is enabled or not.
+	 * 
+	 * @return True/false
+	 */
+	public static boolean isConnectorEnabled() {
+		return connectorEnabled;
+	}
+
+	/**
+	 * Setter for enabling/disabling the connector.
+	 * 
+	 * @param enabled
+	 *            the enabled to set
+	 */
+	public static void setConnectorEnabled(boolean enabled) {
+		ConfigurationHandler.connectorEnabled = enabled;
+	}
+
+	/**
+	 * Just a wrapper to {@link #setConnectorEnabled(boolean)}.
+	 * 
+	 * @param enabled
+	 */
+	public static void setConnectorEnabled(final String enabled) {
+		if (Utils.isEmpty(enabled))
+			setConnectorEnabled(false);
+		else
+			setConnectorEnabled(Boolean.parseBoolean(enabled));
+	}
 }
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 1456)
+++ /FCKeditor.Java/branches/2.4/src/main/webapp/WEB-INF/web.xml	(revision 1457)
@@ -9,6 +9,7 @@
 		parameters, if you need different ones.
 		New init parameter:
-			- ForceSingleExtension: Default is true.
-			  (Due to security issues with Apache modules, it is recommended to leave this setting untouched!)		
+			- 'ForceSingleExtension': Default is true.
+			  (Due to security issues with Apache modules, it is recommended to leave this setting untouched!)
+			- 'enabled' : Default is false.		
 	-->
 
@@ -21,4 +22,8 @@
 			net.fckeditor.connector.ConnectorServlet
 		</servlet-class>
+		<init-param>
+			<param-name>enabled</param-name>
+			<param-value>true</param-value>
+		</init-param>
 		<load-on-startup>1</load-on-startup>
 	</servlet>
