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 1428)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/connector/ConnectorServlet.java	(revision 1429)
@@ -241,5 +241,5 @@
 			currentFolderStr = "/";
 		}
-		
+
 		if (isEmpty(typeStr))
 			typeStr = "File";
@@ -248,8 +248,7 @@
 
 		if (isEmpty(commandStr) || isEmpty(currentFolderStr)
-				|| isEmpty(typeStr)) {
-			ur = new UploadResponse(UploadResponse.EN_ERROR);
-			ur.setCustomMessage(UploadResponse.CM_HTTP_400);
-		} else if (!commandStr.matches("(File|Quick)Upload"))
+				|| isEmpty(typeStr))
+			ur = UploadResponse.UR_BAD_REQUEST;
+		else if (!commandStr.matches("(File|Quick)Upload"))
 			ur = UploadResponse.UR_SECURITY_ERROR;
 		else {
@@ -261,8 +260,7 @@
 
 			if (!isValidPath(currentFolderStr)
-					|| !(new File(currentDirPath).exists())) {
-				ur = new UploadResponse(UploadResponse.EN_ERROR);
-				ur.setCustomMessage(UploadResponse.CM_HTTP_400);
-			} else {
+					|| !(new File(currentDirPath).exists()))
+				ur = UploadResponse.UR_BAD_REQUEST;
+			else {
 
 				String newFilename = null;
@@ -302,12 +300,15 @@
 						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);
 						}
 					}
 				} catch (FileUploadException ex) {
-					ur = new UploadResponse(UploadResponse.EN_ERROR);
-					ur.setCustomMessage(UploadResponse.CM_HTTP_400);
+					ur = UploadResponse.UR_BAD_REQUEST;
 				} catch (Exception e) {
 					ur = UploadResponse.UR_SECURITY_ERROR;
Index: /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/tool/UploadResponse.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/tool/UploadResponse.java	(revision 1428)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/tool/UploadResponse.java	(revision 1429)
@@ -22,4 +22,20 @@
 
 /**
+ * Simply abstracts from the javascript callback to a java class.
+ * 
+ * <p>
+ * The usage is quite easy but can be tricky since varargs are used in the class
+ * constructor.<br/> The requestor expects a JS method callback with variable
+ * arguments size.
+ * </p>
+ * <p>
+ * e.g.
+ * <code>window.parent.OnUploadCompleted(101,'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 UploadResonse(EN_SOME_ERROR,"/some/url/file.img","file.img","no error"):</code>
+ * </p>
  * 
  * @since 2.4
@@ -31,20 +47,92 @@
 
 	// TODO Rename 'En_'-constants to something more intuitive like 'CODE_'
+	/**
+	 * Error number OK
+	 */
 	public static final int EN_OK = 0;
+
+	/**
+	 * Error number ERROR
+	 */
 	public static final int EN_ERROR = 1;
+
+	/**
+	 * Error number WARNING
+	 */
 	public static final int EN_WARNING = 101;
+
+	/**
+	 * Error number RENAMED
+	 */
 	public static final int EN_RENAMED = 201;
+
+	/**
+	 * Error number INVALID EXTENSION
+	 */
 	public static final int EN_INVALID_EXTENSION = 202;
+
+	/**
+	 * Error number SECURITY ERROR
+	 */
 	public static final int EN_SECURITY_ERROR = 203;
+
+	/**
+	 * Error number GENERIC ERROR
+	 */
 	public static final int EN_GENERIC_NUMBER = -1;
 
+	/**
+	 * HTTP 400 Status text
+	 */
 	public static final String CM_HTTP_400 = "400 Bad request";
 
+	/**
+	 * UploadResponse INVALID EXTENSION
+	 */
 	public static final UploadResponse UR_INVALID_EXTENSION = new UploadResponse(
 			EN_INVALID_EXTENSION);
+
+	/**
+	 * UploadResponse SECURITY ERROR
+	 */
 	public static final UploadResponse UR_SECURITY_ERROR = new UploadResponse(
 			EN_SECURITY_ERROR);
+
+	/**
+	 * UploadResponse GENERIC NUMBER
+	 */
 	public static final UploadResponse UR_GENERIC_NUMBER = new UploadResponse(
 			EN_GENERIC_NUMBER);
+
+	/**
+	 * UploadResponse BAD REQUEST
+	 */
+	public static final UploadResponse UR_BAD_REQUEST = new UploadResponse(
+			EN_ERROR, null, null, CM_HTTP_400);
+
+	/**
+	 * Constructs the response with variable amount of parameters.
+	 * <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(EN_OK,"/some/url/to/pic.jpg","pic")</code> or
+	 * <code>UploadResponse(EN_OK)</code> but <b>not</b>
+	 * <code>UploadResponse(EN_OK,"some error message")</code>
+	 * </p>
+	 * <p>
+	 * Use, if possible, the pre-defined error numbers or upload responses.
+	 * </p>
+	 * <p>
+	 * If you need to set error number and message only, use constructor with
+	 * one paremeter and call {@link UploadResponse#setCustomMessage(String)}.
+	 * 
+	 * @param arguments
+	 *            possible argument order:
+	 *            <code>int errorNumber, String fileUrl, String filename, String customMessage</code>
+	 * @throws IllegalArgumentException
+	 *             if amount of arguments is less than 1 and above 4
+	 * @throws IllegalArgumentException
+	 *             if the first argument is not an error number (int)
+	 */
 
 	public UploadResponse(Object... arguments) throws IllegalArgumentException {
@@ -57,9 +145,18 @@
 		if (!(arguments[0] instanceof Integer))
 			throw new IllegalArgumentException(
-			"The first argument has to be an error number (int)");
-			
+					"The first argument has to be an error number (int)");
+
 		System.arraycopy(arguments, 0, parameters, 0, arguments.length);
 	}
 
+	/**
+	 * Sets the message in the UploadResponse.
+	 * 
+	 * Methods automatically determines how many arguments are set and puts the
+	 * message at the end.
+	 * 
+	 * @param customMassage
+	 *            the message you want to pass to the user
+	 */
 	public void setCustomMessage(final String customMassage) {
 		if (Utils.isNotEmpty(customMassage)) {
@@ -75,4 +172,7 @@
 	}
 
+	/**
+	 * Assembles the JavaScript method for the user callback
+	 */
 	@Override
 	public String toString() {
@@ -92,5 +192,5 @@
 			sb.append(",");
 		}
-		
+
 		sb.deleteCharAt(sb.length() - 1);
 		sb.append(");\n");
