Index: trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/proxy/HttpMonitorRemoteExchangeHandler.java
===================================================================
--- trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/proxy/HttpMonitorRemoteExchangeHandler.java	(revision 1567)
+++ trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/proxy/HttpMonitorRemoteExchangeHandler.java	(revision 1614)
@@ -142,46 +142,51 @@
      */
     @Override
-    public void handleHttpExchange(HttpExchange httpExchange) {
+    public synchronized void handleHttpExchange(HttpExchange httpExchange) {
         // send the exchange to the server and wait for completion
-        synchronized (openRequests) {
-            Request httpMonitorRequest = httpClient.newRequest(httpMonitorServer, httpMonitorPort);
-            httpMonitorRequest.method(HttpMethod.POST);
-            httpMonitorRequest.version(HttpVersion.HTTP_1_1);
-
-            OutputStreamContentProvider out = new OutputStreamContentProvider();
-            httpMonitorRequest.content(out);
-            httpMonitorRequest.send(this);
-
-            try {
-                JAXBContext jaxbContext =
-                        JAXBContext.newInstance(HttpExchange.class.getPackage().getName());
-                Marshaller marshaller = jaxbContext.createMarshaller();
-
-                OutputStreamWriter writer = new OutputStreamWriter(out.getOutputStream(), "UTF-8");
-                marshaller.marshal(new ObjectFactory().createHttpExchange(httpExchange), writer);
-
-                out.getOutputStream().close();
-            }
-            catch (JAXBException e) {
-                Console.printerrln("could not convert request and response to XML string: " + e);
-                Console.logException(e);
-            }
-            catch (IOException e) {
-                Console.printerrln
+        Request httpMonitorRequest = httpClient.newRequest(httpMonitorServer, httpMonitorPort);
+        httpMonitorRequest.method(HttpMethod.POST);
+        httpMonitorRequest.version(HttpVersion.HTTP_1_1);
+
+        OutputStreamContentProvider out = new OutputStreamContentProvider();
+        httpMonitorRequest.content(out);
+        
+        openRequests.add(httpMonitorRequest);
+        httpMonitorRequest.send(this);
+
+        try {
+            JAXBContext jaxbContext =
+                JAXBContext.newInstance(HttpExchange.class.getPackage().getName());
+            Marshaller marshaller = jaxbContext.createMarshaller();
+
+            OutputStreamWriter writer = new OutputStreamWriter(out.getOutputStream(), "UTF-8");
+            marshaller.marshal(new ObjectFactory().createHttpExchange(httpExchange), writer);
+
+            out.getOutputStream().close();
+        }
+        catch (JAXBException e) {
+            Console.printerrln("could not convert request and response to XML string: " + e);
+            Console.logException(e);
+        }
+        catch (IOException e) {
+            Console.printerrln
                 ("could not close the stream for sending data to the HTML monitor: " + e);
-                Console.logException(e);
-            }
-            
-            openRequests.add(httpMonitorRequest);
-            
-            try {
-                // wait for the request to be removed fromt the list asynchronously
-                while (openRequests.contains(httpMonitorRequest)) {
-                    openRequests.wait();
+            Console.logException(e);
+        }
+
+        try {
+            // wait for the request to be removed from the list asynchronously
+            int count = 30;
+            while (openRequests.contains(httpMonitorRequest)) {
+                this.wait(1000);
+                
+                if (--count == 0) {
+                    // after 30 seconds, cancel the sending of the loggin request
+                    openRequests.remove(httpMonitorRequest);
+                    break;
                 }
             }
-            catch (InterruptedException e) {
-                // ignore, as this may only happen on system shutdown
-            }
+        }
+        catch (InterruptedException e) {
+            // ignore, as this may only happen on system shutdown
         }
     }
@@ -191,5 +196,5 @@
      */
     @Override
-    public void onComplete(Result result) {
+    public synchronized void onComplete(Result result) {
         if (result.isFailed()) {
             Console.traceln
@@ -198,8 +203,6 @@
         }
         
-        synchronized (openRequests) {
-            openRequests.remove(result.getRequest());
-            openRequests.notify();
-        }
+        openRequests.remove(result.getRequest());
+        this.notify();
     }
 
Index: trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/proxy/HttpMonitoringProxyServlet.java
===================================================================
--- trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/proxy/HttpMonitoringProxyServlet.java	(revision 1567)
+++ trunk/autoquest-httpmonitor/src/main/java/de/ugoe/cs/autoquest/httpmonitor/proxy/HttpMonitoringProxyServlet.java	(revision 1614)
@@ -19,4 +19,5 @@
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.net.URLDecoder;
 import java.net.URLEncoder;
 import java.nio.ByteBuffer;
@@ -99,8 +100,19 @@
     protected URI rewriteURI(HttpServletRequest request) {
         try {
+            String query = request.getQueryString();
+            
+            if (query != null) {
+                query = URLDecoder.decode(query, "UTF-8");
+            }
+            
             return new URI(request.getScheme(), null, proxiedServer, proxiedPort,
-                           request.getPathInfo(), request.getQueryString(), null);
+                           request.getPathInfo(), query, null);
         }
         catch (URISyntaxException e) {
+            Console.printerrln("could not rewrite URI: " + e);
+            Console.logException(e);
+            return null;
+        }
+        catch (UnsupportedEncodingException e) {
             Console.printerrln("could not rewrite URI: " + e);
             Console.logException(e);
@@ -365,5 +377,11 @@
                 }
             }
-            return result.toString();
+            
+            if (result.length() <= 0) {
+                return null;
+            }
+            else {
+                return result.toString();
+            }
         }
 
