Make public fields in RequestTrans private, remove transient modifier, add getters and setters as needed,

synchronize getter and setter for action to fix inconsistent behaviour.
This commit is contained in:
hns 2005-08-18 21:46:52 +00:00
parent 97c5399c9b
commit 04d8589d29
3 changed files with 36 additions and 14 deletions

View file

@ -92,7 +92,7 @@ public class RequestBean implements Serializable {
// property related methods:
public String getAction() {
return req.action;
return req.getAction();
}
/**
@ -110,7 +110,7 @@ public class RequestBean implements Serializable {
* @return ...
*/
public long getRuntime() {
return (System.currentTimeMillis() - req.startTime);
return (System.currentTimeMillis() - req.getStartTime());
}
/**

View file

@ -46,8 +46,8 @@ public class RequestTrans implements Serializable {
public final static String INTERNAL = "INTERNAL";
// the servlet request and response, may be null
HttpServletRequest request;
HttpServletResponse response;
final HttpServletRequest request;
final HttpServletResponse response;
// the uri path of the request
public String path;
@ -56,10 +56,10 @@ public class RequestTrans implements Serializable {
public String session;
// the map of form and cookie data
private Map values;
private final Map values;
// the HTTP request method
private String method;
private final String method;
// timestamp of client-cached version, if present in request
private long ifModifiedSince = -1;
@ -68,12 +68,12 @@ public class RequestTrans implements Serializable {
private Set etags;
// when was execution started on this request?
public transient long startTime;
private final long startTime;
// the name of the action being invoked
public transient String action;
private transient String httpUsername;
private transient String httpPassword;
private String action;
private String httpUsername;
private String httpPassword;
/**
* Create a new Request transmitter with an empty data map.
@ -81,7 +81,9 @@ public class RequestTrans implements Serializable {
public RequestTrans(String method) {
this.method = method;
this.request = null;
this.response = null;
values = new SystemMap();
startTime = System.currentTimeMillis();
}
/**
@ -92,6 +94,7 @@ public class RequestTrans implements Serializable {
this.request = request;
this.response = response;
values = new SystemMap();
startTime = System.currentTimeMillis();
}
/**
@ -180,6 +183,27 @@ public class RequestTrans implements Serializable {
return POST.equalsIgnoreCase(method);
}
/**
* Get the request's action.
*/
public synchronized String getAction() {
return action;
}
/**
* Set the request's action.
*/
public synchronized void setAction(String action) {
this.action = action;
}
/**
* Get the time the request was created.
*/
public long getStartTime() {
return startTime;
}
/**
*
*

View file

@ -160,8 +160,6 @@ public final class RequestEvaluator implements Runnable {
root = app.getDataRoot();
req.startTime = System.currentTimeMillis();
initGlobals(root);
if (error != null) {
@ -319,7 +317,7 @@ public final class RequestEvaluator implements Runnable {
// beginning of execution section
try {
// set the req.action property, cutting off the _action suffix
req.action = action.substring(0, action.length() - 7);
req.setAction(action.substring(0, action.length() - 7));
// reset skin recursion detection counter
skinDepth = 0;