Remove some java compilation warnings of ControlApplet (OFBIZ-4102)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1062438 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<Map.Entry<String, Object>> entrySet = args.entrySet();
|
||||
for (Map.Entry<String, Object> entry : entrySet) {
|
||||
String name = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
String valueStr = null;
|
||||
if (name != null && value != null) {
|
||||
|
||||
Reference in New Issue
Block a user