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 1698)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/connector/ConnectorServlet.java	(revision 1699)
@@ -129,7 +129,7 @@
 					.getDefaultResourceType(typeStr);
 
-			String typePath = constructResourceTypeUrl(resourceType, request);
+			String typePath = Utils.constructResponseUrl(request, resourceType, 
+					currentFolderStr, false, false);
 			String typeDirPath = getServletContext().getRealPath(typePath);
-			String currentPath = typePath + currentFolderStr;
 
 			File typeDir = new File(typeDirPath);
@@ -143,5 +143,7 @@
 
 				xr = new XmlResponse(command, resourceType, currentFolderStr,
-						currentPath, request);
+						Utils.constructResponseUrl(request, resourceType, 
+								currentFolderStr, true, 
+								ConnectorHandler.isFullUrl()));
 
 				if (command.equals(CommandHandler.GET_FOLDERS))
@@ -228,7 +230,7 @@
 			ResourceTypeHandler resourceType = ResourceTypeHandler.getDefaultResourceType(typeStr);
 			
-			String typePath = constructResourceTypeUrl(resourceType, request);
+			String typePath = Utils.constructResponseUrl(request, resourceType, 
+					currentFolderStr, false, false);
 			String typeDirPath = getServletContext().getRealPath(typePath);
-			String currentPath = typePath + currentFolderStr;
 
 			File typeDir = new File(typeDirPath);
@@ -273,11 +275,14 @@
 						if (Utils.isEmpty(newFilename))
 							ur = new UploadResponse(UploadResponse.EN_OK, Utils
-									.constructServerAddress(request,
-											currentPath).concat(filename));
+									.constructResponseUrl(request,
+											resourceType, currentFolderStr,
+											true, ConnectorHandler.isFullUrl())
+									.concat(filename));
 						else
 							ur = new UploadResponse(UploadResponse.EN_RENAMED,
-									Utils.constructServerAddress(request,
-											currentPath).concat(newFilename),
-									newFilename);
+									Utils.constructResponseUrl(request,
+											resourceType, currentFolderStr,
+											true, ConnectorHandler.isFullUrl())
+											.concat(newFilename), newFilename);
 
 						// secure image check
@@ -309,24 +314,3 @@
 	}
 
-	private String constructResponseUrl(final ResourceTypeHandler fileType,
-	        final String currentFolderString, final HttpServletRequest request) {
-		StringBuffer sb = new StringBuffer();
-		sb.append(ConnectorHandler.getUserFilesPath(request));
-		sb.append(fileType.getPath());
-		if (Utils.isNotEmpty(currentFolderString))
-			sb.append(currentFolderString);
-		return Utils.replaceAll(sb.toString(), "//", "/");
-	}
-	
-	/**
-	 * TODO document me!
-	 * @param resourceType
-	 * @param request
-	 * @return
-	 */
-	private String constructResourceTypeUrl(final ResourceTypeHandler resourceType,
-			final HttpServletRequest request) {
-		return constructResponseUrl(resourceType, null, request);
-	}
-
 }
Index: /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/response/XmlResponse.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/response/XmlResponse.java	(revision 1698)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/response/XmlResponse.java	(revision 1699)
@@ -25,5 +25,4 @@
 import java.io.StringWriter;
 
-import javax.servlet.http.HttpServletRequest;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -78,11 +77,12 @@
 
 	/**
+	 * 
 	 * @param command
-	 *            file browser
+	 * @param resourceType
+	 * @param currentFolder
 	 * @param constructedUrl
-	 *            TODO
 	 */
-	public XmlResponse(CommandHandler command, ResourceTypeHandler type, String currentFolder,
-			String constructedUrl, HttpServletRequest request) {
+	public XmlResponse(CommandHandler command, ResourceTypeHandler resourceType, 
+			String currentFolder, String constructedUrl) {
 
 		try {
@@ -98,11 +98,10 @@
 		document.appendChild(root);
 		root.setAttribute("command", command.toString());
-		root.setAttribute("resourceType", type.toString());
+		root.setAttribute("resourceType", resourceType.toString());
 
 		Element currentFolderElement = document.createElement("CurrentFolder");
 		currentFolderElement.setAttribute("path", currentFolder);
 
-		currentFolderElement.setAttribute("url", Utils.constructServerAddress(
-				request, constructedUrl));
+		currentFolderElement.setAttribute("url", constructedUrl);
 		root.appendChild(currentFolderElement);
 
Index: /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/tool/Utils.java
===================================================================
--- /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/tool/Utils.java	(revision 1698)
+++ /FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/tool/Utils.java	(revision 1699)
@@ -28,4 +28,5 @@
 
 import net.fckeditor.handlers.ConnectorHandler;
+import net.fckeditor.handlers.ResourceTypeHandler;
 
 
@@ -146,4 +147,44 @@
 		else
 			return request.getContextPath() + url;
-	}	
+	}
+	
+	/**
+	 * 
+	 * @param request
+	 * @param resourceType
+	 * @param urlPath TODO
+	 * @param prependContextPath
+	 * @param fullUrl
+	 * @return
+	 */
+	public static String constructResponseUrl(HttpServletRequest request,
+			ResourceTypeHandler resourceType, String urlPath,
+			boolean prependContextPath, boolean fullUrl) {
+			
+		StringBuffer sb = new StringBuffer();
+		
+		if (fullUrl) {
+			String address = request.getRequestURL().toString();
+			sb.append(address.substring(0, address.indexOf('/', 8))
+					+ request.getContextPath());
+		}
+		
+		if (prependContextPath && !fullUrl)
+			sb.append(request.getContextPath());
+		
+		sb.append(ConnectorHandler.getUserFilesPath(request));
+		sb.append(resourceType.getPath());
+		
+		if (isNotEmpty(urlPath))
+			sb.append(urlPath);
+		
+		return sb.toString();
+	}
+	
+	public static String constructResponseUrl(HttpServletRequest request,
+			ResourceTypeHandler resourceType, boolean prependContextPath, 
+			boolean fullUrl) {
+		return constructResponseUrl(request, resourceType, null, 
+				prependContextPath, fullUrl);
+	}
 }
