Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/Dispatcher.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/Dispatcher.java	(revision 2729)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/Dispatcher.java	(revision 2730)
@@ -36,4 +36,5 @@
 import net.fckeditor.handlers.ConnectorHandler;
 import net.fckeditor.handlers.ExtensionsHandler;
+import net.fckeditor.handlers.PropertiesLoader;
 import net.fckeditor.handlers.RequestCycleHandler;
 import net.fckeditor.handlers.ResourceType;
@@ -44,4 +45,5 @@
 import net.fckeditor.tool.Utils;
 import net.fckeditor.tool.UtilsFile;
+import net.fckeditor.tool.UtilsResponse;
 
 import org.apache.commons.fileupload.FileItem;
@@ -153,10 +155,9 @@
 							|| command
 									.equals(Command.GET_FOLDERS_AND_FILES)) {
-						// TODO I don't like this code, it has to be more
-						// generic
-						String responseUrl = context.buildUrl(ConnectorHandler
-								.getUserFilesPath());
+						String url = UtilsResponse.getUrl(RequestCycleHandler
+								.getUserFilesPath(request), type, context
+								.getCurrentFolderStr());
 						getResponse = getFoldersAndOrFiles(command, type, context
-								.getCurrentFolderStr(), responseUrl);
+								.getCurrentFolderStr(), url);
 					}
 				} catch (InvalidCurrentFolderException e) {
@@ -189,5 +190,5 @@
 	 * @param type
 	 * @param currentFolderStr
-	 * @param responseUrl
+	 * @param url
 	 * @return
 	 * @throws InvalidCurrentFolderException
@@ -196,8 +197,8 @@
 	private GetResponse getFoldersAndOrFiles(final Command command,
 			final ResourceType type, final String currentFolderStr,
-			final String responseUrl) throws InvalidCurrentFolderException,
+			final String url) throws InvalidCurrentFolderException,
 			SecurityException {
 		GetResponse getResponse = new GetResponse(command, type,
-				currentFolderStr, responseUrl);
+				currentFolderStr, url);
 		getResponse.setFolders(connector.getFolders(type, currentFolderStr));
 		if (command.equals(Command.GET_FOLDERS_AND_FILES))
@@ -265,5 +266,5 @@
 				// Secure image check (can't be done if QuickUpload)
 				else if (type.equals(ResourceType.IMAGE)
-						&& ConnectorHandler.isSecureImageUploads()
+						&& PropertiesLoader.isSecureImageUploads()
 						&& !UtilsFile.isImage(uplFile.getInputStream())) {
 					uploadResponse = UploadResponse.getErrorInvalidExtension();
@@ -276,14 +277,14 @@
 							.getCurrentFolderStr(), sanitizedFileName, uplFile
 							.getInputStream());
-					// TODO I don't like this either
-					String responseUrl = context.buildUrl(ConnectorHandler
-							.getUserFilesPath());
+					String fileUrl = UtilsResponse.fileUrl(RequestCycleHandler
+							.getUserFilesPath(request), type, context
+							.getCurrentFolderStr(), newFileName);
+
 					if (sanitizedFileName.equals(newFileName))
 						uploadResponse = new UploadResponse(
-								UploadResponse.SC_OK, responseUrl);
+								UploadResponse.SC_OK, fileUrl);
 					else {
 						uploadResponse = new UploadResponse(
-								UploadResponse.SC_RENAMED, responseUrl,
-								newFileName);
+								UploadResponse.SC_RENAMED, fileUrl, newFileName);
 						logger.debug("Parameter NewFile (renamed): {}",
 								newFileName);
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/impl/ContextConnector.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/impl/ContextConnector.java	(revision 2729)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/connector/impl/ContextConnector.java	(revision 2730)
@@ -27,4 +27,5 @@
 
 import net.fckeditor.handlers.ConnectorHandler;
+import net.fckeditor.handlers.PropertiesLoader;
 
 /**
@@ -46,5 +47,5 @@
 
 		AbstracLocalFileSystemConnector.servletContext = servletContext;
-		String defaultAbsolutePath = getRealUserFilesAbsolutePath(ConnectorHandler
+		String defaultAbsolutePath = getRealUserFilesAbsolutePath(PropertiesLoader
 				.getUserFilesPath());
 
Index: FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/requestcycle/ThreadLocalData.java
===================================================================
--- FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/requestcycle/ThreadLocalData.java	(revision 2729)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/requestcycle/ThreadLocalData.java	(revision 2730)
@@ -57,6 +57,6 @@
 	 */
 	public static void endRequest() {
-		request = null;
-		context = null;
+		request.set(null);
+		context.set(null);
 	}
 }
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 2729)
+++ FCKeditor.Java/trunk/java-core/src/main/java/net/fckeditor/tool/UtilsResponse.java	(revision 2730)
@@ -21,25 +21,28 @@
 package net.fckeditor.tool;
 
+import net.fckeditor.handlers.ResourceType;
+
 /**
  * Some static helper methods in conjunction with the servlet response.
- *
+ * 
  * @version $Id$
  */
 public class UtilsResponse {
 
-	/**
-	 * Constructs a URL from different parameters. This method is about to
-	 * change in version 2.5.
-	 * TODO has to be improved
-	 */
-	public static String constructResponseUrl(String filePath, String resourceTypePath, String urlPath) {
+	public static String getUrl(String userFilesPath, ResourceType type,
+			String currentFolder) {
+		return fileUrl(userFilesPath, type, currentFolder, null);
+	}
+
+	public static String fileUrl(String userFilesPath, ResourceType type,
+			String currentFolder, String filename) {
+		
 		StringBuffer sb = new StringBuffer();
-		   	
-		sb.append(filePath);
-		if (Utils.isNotEmpty(resourceTypePath))
-			sb.append(resourceTypePath);
-		
-		if (Utils.isNotEmpty(urlPath))
-			sb.append(urlPath);
+		if(Utils.isNotEmpty(userFilesPath))
+			sb.append(userFilesPath);
+		sb.append(type.getPath());
+		sb.append(currentFolder);
+		if (Utils.isNotEmpty(filename))
+			sb.append(filename);
 		
 		return sb.toString();
