You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by al...@apache.org on 2007/06/13 03:11:50 UTC

svn commit: r546695 - /incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/AjaxServerAndClientTimeFilter.java

Author: almaw
Date: Tue Jun 12 18:11:49 2007
New Revision: 546695

URL: http://svn.apache.org/viewvc?view=rev&rev=546695
Log:
WICKET-341

Modified:
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/AjaxServerAndClientTimeFilter.java

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/AjaxServerAndClientTimeFilter.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/AjaxServerAndClientTimeFilter.java?view=diff&rev=546695&r1=546694&r2=546695
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/AjaxServerAndClientTimeFilter.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/AjaxServerAndClientTimeFilter.java Tue Jun 12 18:11:49 2007
@@ -22,13 +22,12 @@
 import org.apache.wicket.Application;
 import org.apache.wicket.IResponseFilter;
 import org.apache.wicket.RequestCycle;
-import org.apache.wicket.model.Model;
 import org.apache.wicket.util.string.AppendingStringBuffer;
 import org.apache.wicket.util.string.JavascriptUtils;
+import org.apache.wicket.util.string.interpolator.MapVariableInterpolator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
  * This is a filter that injects javascript code to the top head portion and
  * after the body so that the time can me measured what the client parse time
@@ -98,15 +97,11 @@
 	 */
 	private String getStatusString(long timeTaken, String resourceKey)
 	{
-		Map map = new HashMap(4);
+		final String txt = Application.get().getResourceSettings().getLocalizer().getString(resourceKey, null,
+		"Server parsetime: ${servertime}, Client parsetime: ${clienttime}");
+		final Map map = new HashMap(4);
 		map.put("clienttime", "' + (new Date().getTime() - clientTimeVariable)/1000 +  's");
 		map.put("servertime", ((double)timeTaken) / 1000 + "s");
-		AppendingStringBuffer defaultValue = new AppendingStringBuffer(128);
-		defaultValue.append("Server parsetime: ");
-		defaultValue.append(((double)timeTaken) / 1000);
-		defaultValue.append("s, Client parsetime: ' + (new Date().getTime() - clientTimeVariable)/1000 +  's");
-		String txt = Application.get().getResourceSettings().getLocalizer().getString(resourceKey,
-				null, Model.valueOf(map), defaultValue.toString());
-		return txt;
+		return MapVariableInterpolator.interpolate(txt, map);
 	}
 }