diff --git a/applications/content/src/ControlApplet.java b/applications/content/src/ControlApplet.java index 7dfb2d8689..4083592b94 100644 --- a/applications/content/src/ControlApplet.java +++ b/applications/content/src/ControlApplet.java @@ -28,15 +28,17 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; -import java.util.HashMap; -import java.util.Iterator; import java.util.Map; +import java.util.Set; + +import javolution.util.FastMap; import org.ofbiz.base.util.UtilValidate; /** * Control Applet - Client applet for page pushing and (future) chat */ +@SuppressWarnings("serial") public class ControlApplet extends Applet implements Runnable { private static String pushUrl = "/commonapp/control/pushapplet"; @@ -130,7 +132,7 @@ public class ControlApplet extends Applet implements Runnable { } protected void pull() { - Map params = new HashMap(); + Map params = FastMap.newInstance(); params.put("sessionId", this.sessionId.trim()); params.put("visitId", this.visitId.trim()); @@ -160,12 +162,11 @@ public class ControlApplet extends Applet implements Runnable { } protected void push() { - Map params = new HashMap(); + Map params = FastMap.newInstance(); params.put("sessionId", this.sessionId.trim()); params.put("visitId", this.visitId.trim()); params.put("currentPage", this.currentPage.trim()); - String pushResp = null; URL callPushUrl = null; try { callPushUrl = new URL(serverUrl + pushUrl); @@ -174,17 +175,18 @@ public class ControlApplet extends Applet implements Runnable { if (callPushUrl != null) { try { - pushResp = callServer(callPushUrl, params); + callServer(callPushUrl, params); } catch (IOException e) { } } } - private String callServer(URL serverUrl, Map parms) throws IOException { + private String callServer(URL serverUrl, Map parms) throws IOException { // send the request String parameters = this.encodeArgs(parms); - if (debug != null && debug.equalsIgnoreCase("true")) + if (debug != null && debug.equalsIgnoreCase("true")) { System.out.println("Sending parameters: " + parameters); + } URLConnection uc = serverUrl.openConnection(); uc.setDoOutput(true); uc.setRequestProperty("Content-Type","application/x-www-form-urlencoded"); @@ -196,20 +198,21 @@ public class ControlApplet extends Applet implements Runnable { BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream())); String responseStr = in.readLine(); in.close(); - if (responseStr != null) + if (responseStr != null) { responseStr = responseStr.trim(); - if (debug != null && debug.equalsIgnoreCase("true")) + } + if (debug != null && debug.equalsIgnoreCase("true")) { System.out.println("Receive response: " + responseStr); + } return responseStr; } - public String encodeArgs(Map args) { + public String encodeArgs(Map args) { StringBuffer buf = new StringBuffer(); if (args != null) { - Iterator i = args.entrySet().iterator(); - while (i.hasNext()) { - Map.Entry entry = (Map.Entry) i.next(); - String name = (String) entry.getKey(); + Set> entrySet = args.entrySet(); + for (Map.Entry entry : entrySet) { + String name = entry.getKey(); Object value = entry.getValue(); String valueStr = null; if (name != null && value != null) {