Index: /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/GetResponse.java
===================================================================
--- /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/GetResponse.java	(revision 3358)
+++ /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/GetResponse.java	(revision 3359)
@@ -45,8 +45,8 @@
 
 /**
- * Creates an XML response for every <code>GET</code> request of the Connector
- * servlet. This class maps directly to the XML layout described <a
- * href="http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Server_Side_Integration#The_Commands">here</a>.
- *
+ * Represents the XML response for the File Browser's <code>GET</code> request. <br />
+ * The XML response is described <a href="http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Server_Side_Integration#The_Commands"
+ * >here</a> in detail.
+ * 
  * @version $Id$
  */
@@ -57,8 +57,8 @@
 	protected Element foldersElement;
 	protected Element filesElement;
-	
+
 	/** Error number OK */
 	public static final int EN_OK = 0;
-	
+
 	/** Error number CUSTOM ERROR */
 	public static final int EN_CUSTOM_ERROR = 1;
@@ -75,14 +75,17 @@
 	/** Error number UNKNOWN ERROR */
 	public static final int EN_UKNOWN_CREATE_FOLDER_ERROR = 110;
-	
-	/**
-	 * 
-	 * Use this constructor if want to respond a negative/error message with
-	 * custom text.
+
+	/**
+	 * 
+	 * Constructs a response with a specific error number and message.
 	 * 
 	 * @param number
-	 * @param text
-	 */
-	public GetResponse(int number, String text) {
+	 *            error number
+	 * @param message
+	 *            specific message
+	 * @throws RuntimeException
+	 *             if creation of the underlying DOM object failed
+	 */
+	public GetResponse(int number, String message) {
 		try {
 			DocumentBuilderFactory factory = DocumentBuilderFactory
@@ -96,18 +99,25 @@
 		Element root = document.createElement("Connector");
 		document.appendChild(root);
-		setError(number, text);
-	}
-	
-	/**
-	 * Use this constructor if want to respond a positive message.
+		setError(number, message);
+	}
+
+	/**
+	 * Constructs a successful response for a specific command and resource
+	 * type.
 	 * 
 	 * @param command
+	 *            current command
 	 * @param resourceType
+	 *            current resource type
 	 * @param currentFolder
+	 *            current folder
 	 * @param constructedUrl
-	 */
-	public GetResponse(Command command, ResourceType resourceType, 
+	 *            final url
+	 * @throws RuntimeException
+	 *             if creation of the underlying DOM object failed
+	 */
+	public GetResponse(Command command, ResourceType resourceType,
 			String currentFolder, String constructedUrl) {
-	
+
 		try {
 			DocumentBuilderFactory factory = DocumentBuilderFactory
@@ -118,34 +128,39 @@
 			throw new RuntimeException(e);
 		}
-	
+
 		Element root = document.createElement("Connector");
 		document.appendChild(root);
 		root.setAttribute("command", command.toString());
 		root.setAttribute("resourceType", resourceType.getName());
-	
+
 		Element currentFolderElement = document.createElement("CurrentFolder");
 		currentFolderElement.setAttribute("path", currentFolder);
-	
+
 		currentFolderElement.setAttribute("url", constructedUrl);
 		root.appendChild(currentFolderElement);
-	
-	}
-
-	/**
-	 * Use this constructor if want to respond a negative/error message only.
+
+	}
+
+	/**
+	 * Constructs a response with a specific error number only.
 	 * 
 	 * @param number
+	 *            error number
+	 * @throws RuntimeException
+	 *             if creation of the underlying DOM object failed
 	 */
 	public GetResponse(int number) {
 		this(number, null);
 	}
-	
-	/**
-	 * Sets an error number with a custom message.
+
+	/**
+	 * Sets an error number with a message.
 	 * 
 	 * @param number
-	 * @param text
-	 */
-	public void setError(int number, String text) {
+	 *            error number
+	 * @param message
+	 *            specific message
+	 */
+	public void setError(int number, String message) {
 
 		if (errorElement == null) {
@@ -155,13 +170,14 @@
 
 		errorElement.setAttribute("number", String.valueOf(number));
-		if (Utils.isNotEmpty(text))
-			errorElement.setAttribute("text", text);
-
-	}
-
-	/**
-	 * Sets an error number.
+		if (Utils.isNotEmpty(message))
+			errorElement.setAttribute("text", message);
+
+	}
+
+	/**
+	 * Sets an error number only.
 	 * 
 	 * @param number
+	 *            error number
 	 */
 	public void setError(int number) {
@@ -170,8 +186,10 @@
 
 	/**
-	 * Lists all folders as XML tags.
-	 * @param dir
-	 */
-	public void setFolders(final List<String> dirs) {
+	 * Sets folders associated with this response.
+	 * 
+	 * @param folders
+	 *            list with folder names
+	 */
+	public void setFolders(final List<String> folders) {
 		if (foldersElement != null) {
 			Element parent = (Element) foldersElement.getParentNode();
@@ -182,15 +200,17 @@
 		document.getDocumentElement().appendChild(foldersElement);
 
-		for (String file : dirs) {
+		for (String folder : folders) {
 			Element folderElement = document.createElement("Folder");
-			folderElement.setAttribute("name", file);
+			folderElement.setAttribute("name", folder);
 			foldersElement.appendChild(folderElement);
 		}
 	}
-	
-	/**
-	 * Lists all files XML tags.
-	 * 
-	 * @param Map, key is the file name and value is the size of the file in bytes
+
+	/**
+	 * Sets files associated with this response.
+	 * 
+	 * @param files
+	 *            list with maps. Each map represents a file with its specific
+	 *            attributes.
 	 */
 	public void setFiles(final List<Map<String, Object>> files) {
@@ -202,19 +222,26 @@
 		filesElement = document.createElement("Files");
 		document.getDocumentElement().appendChild(filesElement);
-		
+
 		long length = 1L;
 		long tempLength;
-		
+
 		for (Map<String, Object> file : files) {
 			Element fileElement = document.createElement("File");
-			fileElement.setAttribute("name", (String) file.get(Connector.KEY_NAME));
+			fileElement.setAttribute("name", (String) file
+					.get(Connector.KEY_NAME));
 			tempLength = (Long) file.get(Connector.KEY_SIZE);
 			if (tempLength > 1024)
-				length = tempLength/1024;
+				length = tempLength / 1024;
 			fileElement.setAttribute("size", String.valueOf(length));
 			filesElement.appendChild(fileElement);
 		}
 	}
-	
+
+	/**
+	 * Transforms the underlying DOM object to an XML string.
+	 * 
+	 * @throws RuntimeException
+	 *             if transformation failed
+	 */
 	@Override
 	public String toString() {
@@ -237,57 +264,98 @@
 		return sw.toString();
 	}
-	
+
+	/**
+	 * Creates an <code>OK</code> response.
+	 */
 	public static GetResponse getOK() {
 		return new GetResponse(EN_OK);
 	}
-	
+
+	/**
+	 * Creates an <code>INVALID COMMAND</code> error.
+	 */
 	public static GetResponse getInvalidCommandError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
 		return new GetResponse(EN_CUSTOM_ERROR, lm.getInvalidCommandSpecified());
 	}
-	
+
+	/**
+	 * Creates an <code>INVALID RESOURCE TYPE</code> error.
+	 */
 	public static GetResponse getInvalidResourceTypeError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
-		return new GetResponse(EN_CUSTOM_ERROR, lm.getInvalidResouceTypeSpecified());
-	}
-	
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
+		return new GetResponse(EN_CUSTOM_ERROR, lm
+				.getInvalidResouceTypeSpecified());
+	}
+
+	/**
+	 * Creates an <code>INVALID CURRENT FOLDER</code> error.
+	 */
 	public static GetResponse getInvalidCurrentFolderError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
-		return new GetResponse(EN_CUSTOM_ERROR, lm.getInvalidCurrentFolderSpecified());
-	}
-	
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
+		return new GetResponse(EN_CUSTOM_ERROR, lm
+				.getInvalidCurrentFolderSpecified());
+	}
+
 	// TODO which EN to respond?
+	/**
+	 * Creates a <code>GET RESOURCES DISABLED</code> error.
+	 */
 	public static GetResponse getGetResourcesDisabledError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
 		return new GetResponse(EN_CUSTOM_ERROR, lm.getGetResourcesDisabled());
 	}
-	
+
 	// TODO which EN to respond?
+	/**
+	 * Creates a <code>GET RESOURCES READ</code> error.
+	 */
 	public static GetResponse getGetResourcesReadError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
 		return new GetResponse(EN_CUSTOM_ERROR, lm.getGetResourcesReadError());
 	}
-	
+
 	// TODO which EN to respond?
+	/**
+	 * Creates a <code>CREATE FOLDER DISABLED</code> error.
+	 */
 	public static GetResponse getCreateFolderDisabledError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
 		return new GetResponse(EN_CUSTOM_ERROR, lm.getCreateFolderDisabled());
 	}
-	
+
+	/**
+	 * Creates an <code>INVALID NEW FOLDER NAME</code> error.
+	 */
 	public static GetResponse getInvalidNewFolderNameError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
 		return new GetResponse(EN_INVALID_NEW_FOLDER_NAME_ERROR, lm
 				.getInvalidNewFolderNameSpecified());
 	}
-	
+
+	/**
+	 * Creates a <code>FOLDER ALREADY EXISTS</code> error.
+	 */
 	public static GetResponse getFolderAlreadyExistsError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
 		return new GetResponse(EN_FOLDER_ALREADY_EXISTS_ERROR, lm
 				.getFolderAlreadyExistsError());
 	}
-	
+
 	// TODO which EN to respond?
+	/**
+	 * Creates a <code>CREATE FOLDER WRITE</code> error.
+	 */
 	public static GetResponse getCreateFolderWriteError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
 		return new GetResponse(EN_UKNOWN_CREATE_FOLDER_ERROR, lm
 				.getCreateFolderWriteError());
Index: /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/UploadResponse.java
===================================================================
--- /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/UploadResponse.java	(revision 3358)
+++ /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/response/UploadResponse.java	(revision 3359)
@@ -26,19 +26,23 @@
 
 /**
- * Simply abstracts from the JavaScript callback to a Java object.
- * 
+ * Represents the HTML/JavaScript callback/response for the File Browser's
+ * <code>POST</code> request.<br />
+ * The response is described <a href="http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Server_Side_Integration#FileUpload_.28HTML.29"
+ * >here</a> in detail.
  * <p>
- * The usage is quite easy but can be tricky since varargs are used in the class
- * constructor.<br/> The requester expects a JS method callback with variable
- * arguments size.
+ * This class utilizes varags to reflect the JavaScript callback function in an
+ * optimal way. However, varargs can be tricky. You can always omit passed
+ * parameters from right to left but any violation may result in an exception or
+ * a failed callback.
  * </p>
  * <p>
- * e.g.
- * <code>window.parent.OnUploadCompleted(101,'some/url/file.img','file.img','no error');</code>
+ * For example: <code>window.parent.OnUploadCompleted(101,'some/url/file.img','file.img','no error')</code> can be mapped with
+ * 
+ * <code>UploadResponse ur = new UploadResponse(SC_SOME_ERROR,"/some/url/file.img","file.img","no error")</code>
+ * .
  * </p>
  * <p>
- * The UploadResponse constructor behaves the same way by simply calling it
- * with:<br/>
- * <code>UploadResponse ur = new UploadResponse(SC_SOME_ERROR,"/some/url/file.img","file.img","no error"):</code>
+ * But <code>window.parent.OnUploadCompleted(101,'some/url/file.img','no error')</code> is an illegal callback and
+ * will fail.
  * </p>
  * 
@@ -54,8 +58,8 @@
 	/** Error number CUSTOM ERROR */
 	public static final int EN_CUSTOM_ERROR = 1;
-	
+
 	/** Error number CUSTOM WARNING */
 	public static final int EN_CUSTOM_WARNING = 101;
-	
+
 	/** Error number FILE RENAMED WARNING */
 	public static final int EN_FILE_RENAMED_WARNING = 201;
@@ -68,22 +72,16 @@
 
 	/**
-	 * Constructs the response with variable amount of parameters.
+	 * Constructs a response with a varying amount of arguments.
 	 * <p>
-	 * Put the desired parameters in the constructor. You may omit them from
-	 * right to left but you have to remain the order.<br/> e.g.
-	 * <code>UploadResponse(SC_OK,"/some/url/to/pic.jpg","pic")</code> or
-	 * <code>UploadResponse(SC_OK)</code> but <b>not</b>
-	 * <code>UploadResponse(SC_OK,"some error message")</code>
+	 * Use the predefined error numbers or upload responses, if possible.<br />
+	 * If you need to set error number and message only, use constructor with
+	 * one argument and call {@link UploadResponse#setCustomMessage(String)}.
 	 * </p>
 	 * <p>
-	 * Use, if possible, the predefined error numbers or upload responses.
-	 * </p>
-	 * <p>
-	 * If you need to set error number and message only, use constructor with
-	 * one parameter and call {@link UploadResponse#setCustomMessage(String)}.
 	 * 
 	 * @param arguments
 	 *            possible argument order:
 	 *            <code>int errorNumber, String fileUrl, String filename, String customMessage</code>
+	 *            . Omit from right to left.
 	 * @throws IllegalArgumentException
 	 *             if amount of arguments is less than 1 and above 4
@@ -106,5 +104,5 @@
 
 	/**
-	 * Sets the message in the <code>UploadResponse</code>.
+	 * Sets a custom message.
 	 * 
 	 * Methods automatically determines how many arguments are set and puts the
@@ -112,5 +110,5 @@
 	 * 
 	 * @param customMassage
-	 *            the message you want to pass to the user
+	 *            the message you want to respond to the user
 	 */
 	public void setCustomMessage(final String customMassage) {
@@ -126,49 +124,86 @@
 		}
 	}
-	
-	
+
+	/**
+	 * Creates an <code>OK</code> response.
+	 */
 	public static UploadResponse getOK(String fileUrl) {
 		return new UploadResponse(EN_OK, fileUrl);
 	}
-	
-	public static UploadResponse getFileRenamedWarning(String fileUrl, String newFileName) {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
+
+	/**
+	 * Creates a <code>FILE RENAMED</code> warning.
+	 */
+	public static UploadResponse getFileRenamedWarning(String fileUrl,
+			String newFileName) {
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
 		return new UploadResponse(EN_FILE_RENAMED_WARNING, fileUrl,
 				newFileName, lm.getFileRenamedWarning(newFileName));
 	}
-	
+
+	/**
+	 * Creates a <code>INVALID FILE TYPE</code> error.
+	 */
 	public static UploadResponse getInvalidFileTypeError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
-		return new UploadResponse(EN_INVALID_FILE_TYPE_ERROR, lm.getInvalidFileTypeSpecified());
-	}
-	
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
+		return new UploadResponse(EN_INVALID_FILE_TYPE_ERROR, lm
+				.getInvalidFileTypeSpecified());
+	}
+
+	/**
+	 * Creates a <code>INVALID COMMAND</code> error.
+	 */
 	public static UploadResponse getInvalidCommandError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
-		return new UploadResponse(EN_CUSTOM_ERROR, null, null, lm.getInvalidCommandSpecified());
-	}
-	
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
+		return new UploadResponse(EN_CUSTOM_ERROR, null, null, lm
+				.getInvalidCommandSpecified());
+	}
+
+	/**
+	 * Creates a <code>INVALID RESOURCE TYPE</code> error.
+	 */
 	public static UploadResponse getInvalidResourceTypeError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
-		return new UploadResponse(EN_CUSTOM_ERROR, null, null, lm.getInvalidResouceTypeSpecified());
-	}
-	
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
+		return new UploadResponse(EN_CUSTOM_ERROR, null, null, lm
+				.getInvalidResouceTypeSpecified());
+	}
+
+	/**
+	 * Creates a <code>INVALID CURRENT FOLDER</code> error.
+	 */
 	public static UploadResponse getInvalidCurrentFolderError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
-		return new UploadResponse(EN_CUSTOM_ERROR, null, null, lm.getInvalidCurrentFolderSpecified());
-	}
-
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
+		return new UploadResponse(EN_CUSTOM_ERROR, null, null, lm
+				.getInvalidCurrentFolderSpecified());
+	}
+
+	/**
+	 * Creates a <code>FILE UPLOAD DISABLED</code> error.
+	 */
 	public static UploadResponse getFileUploadDisabledError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
-		return new UploadResponse(EN_SECURITY_ERROR, null, null, lm.getFileUploadDisabled());
-	}
-	
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
+		return new UploadResponse(EN_SECURITY_ERROR, null, null, lm
+				.getFileUploadDisabled());
+	}
+
 	// TODO which EN to respond?
+	/**
+	 * Creates a <code>FILE UPLOAD WRITE</code> error.
+	 */
 	public static UploadResponse getFileUploadWriteError() {
-		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData.getRequest());
-		return new UploadResponse(EN_CUSTOM_ERROR, null, null, lm.getFileUploadWriteError());
-	}
-
-	/**
-	 * Assembles the JavaScript method for the user callback
+		LocalizedMessages lm = LocalizedMessages.getMessages(ThreadLocalData
+				.getRequest());
+		return new UploadResponse(EN_CUSTOM_ERROR, null, null, lm
+				.getFileUploadWriteError());
+	}
+
+	/**
+	 * Assembles the JavaScript callback.
 	 */
 	@Override
@@ -177,6 +212,8 @@
 		sb.append("<script type=\"text/javascript\">\n");
 		// Compressed version of the document.domain automatic fix script.
-		// The original script can be found at [fckeditor_dir]/_dev/domain_fix_template.js
-		sb.append("(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();\n");
+		// The original script can be found at
+		// [fckeditor_dir]/_dev/domain_fix_template.js
+		sb
+				.append("(function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})();\n");
 		sb.append("window.parent.OnUploadCompleted(");
 
Index: /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/tool/UtilsResponse.java
===================================================================
--- /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/tool/UtilsResponse.java	(revision 3358)
+++ /FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/tool/UtilsResponse.java	(revision 3359)
@@ -54,5 +54,5 @@
 	 * @param filename
 	 *            current chosen file (may be null)
-	 * @return
+	 * @return assembled url for the File Browser
 	 */
 	public static String fileUrl(String userFilesPath, ResourceType type,
