Performance optimization for UtilHttp.getFullRequestUrl method: instead of returning a StringBuffer object (synchronized) it now returns a String (immutable); internally it uses a StringBuilder (lighter because not synchronized) within a private context.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1570810 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacopo Cappellato
2014-02-22 08:32:28 +00:00
parent 0bf26e2829
commit 7d8d938a3b
5 changed files with 16 additions and 13 deletions
@@ -129,8 +129,7 @@ public class ContextFilter implements Filter {
httpRequest.setAttribute("_CONTEXT_ROOT_", config.getServletContext().getRealPath("/"));
// set the server root url
StringBuffer serverRootUrl = UtilHttp.getServerRootUrl(httpRequest);
httpRequest.setAttribute("_SERVER_ROOT_URL_", serverRootUrl.toString());
httpRequest.setAttribute("_SERVER_ROOT_URL_", UtilHttp.getServerRootUrl(httpRequest));
// request attributes from redirect call
String reqAttrMapHex = (String) httpRequest.getSession().getAttribute("_REQ_ATTR_MAP_");
@@ -671,7 +671,7 @@ public class ServerHitBin {
serverHit.set("contentId", this.id);
serverHit.set("runningTimeMillis", Long.valueOf(runningTime));
String fullRequestUrl = UtilHttp.getFullRequestUrl(request).toString();
String fullRequestUrl = UtilHttp.getFullRequestUrl(request);
serverHit.set("requestUrl", fullRequestUrl.length() > 250 ? fullRequestUrl.substring(0, 250) : fullRequestUrl);
String referrerUrl = request.getHeader("Referer") != null ? request.getHeader("Referer") : "";