diff --git a/projects/samskivert/src/java/com/samskivert/servlet/util/RequestUtils.java b/projects/samskivert/src/java/com/samskivert/servlet/util/RequestUtils.java
index 5f6e2c7c..9fa5021b 100644
--- a/projects/samskivert/src/java/com/samskivert/servlet/util/RequestUtils.java
+++ b/projects/samskivert/src/java/com/samskivert/servlet/util/RequestUtils.java
@@ -20,6 +20,9 @@
package com.samskivert.servlet.util;
+import java.util.Iterator;
+import java.util.Map;
+
import javax.servlet.http.HttpServletRequest;
import com.samskivert.util.StringUtil;
@@ -96,4 +99,40 @@ public class RequestUtils
buf.append(path);
return buf.toString();
}
+
+ /**
+ * Reconstructs the request URL including query parameters. Note:
+ * the output of this method is purely for logging purposes only, thus POST
+ * parameters are shown as if they were GET parameters and parameters are
+ * not URL encoded.
+ */
+ public static String reconstructURL (HttpServletRequest req)
+ {
+ StringBuffer buf = req.getRequestURL();
+ Map map = req.getParameterMap();
+ if (map.size() > 0) {
+ buf.append("?");
+ for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) {
+ Map.Entry entry = (Map.Entry)iter.next();
+ buf.append(entry.getKey()).append("=");
+ String[] values = (String[])entry.getValue();
+ if (values.length == 1) {
+ buf.append(values[0]);
+ } else {
+ buf.append("(");
+ for (int ii = 0; ii < values.length; ii++) {
+ if (ii > 0) {
+ buf.append(", ");
+ }
+ buf.append(values[ii]);
+ }
+ buf.append(")");
+ }
+ if (iter.hasNext()) {
+ buf.append("&");
+ }
+ }
+ }
+ return buf.toString();
+ }
}
diff --git a/projects/samskivert/src/java/com/samskivert/velocity/Application.java b/projects/samskivert/src/java/com/samskivert/velocity/Application.java
index 48abfd32..7c2c44b0 100644
--- a/projects/samskivert/src/java/com/samskivert/velocity/Application.java
+++ b/projects/samskivert/src/java/com/samskivert/velocity/Application.java
@@ -36,6 +36,7 @@ import com.samskivert.servlet.RedirectException;
import com.samskivert.servlet.SiteIdentifier;
import com.samskivert.servlet.SiteResourceLoader;
import com.samskivert.servlet.util.ExceptionMap;
+import com.samskivert.servlet.util.RequestUtils;
import com.samskivert.util.StringUtil;
/**
@@ -224,8 +225,7 @@ public class Application
protected String handleException (
HttpServletRequest req, Logic logic, Exception error)
{
- Log.warning("Choked on request [logic=" + logic +
- ", req=" + req.getRequestURI() + "].");
+ Log.warning(logic + " failed on: " + RequestUtils.reconstructURL(req));
Log.logStackTrace(error);
return ExceptionMap.getMessage(error);
}