made RequestTrans and ResponseTrans implement Externalizable instead of Serializable

renamed ResponseTrans.mainSkin to .skin to avoid confusion
This commit is contained in:
hns 2001-02-28 15:06:49 +00:00
parent 9f3dc4cfb8
commit d45f3240ce
3 changed files with 40 additions and 8 deletions

View file

@ -12,7 +12,7 @@ import helma.objectmodel.*;
* class are directly exposed to JavaScript as global property req.
*/
public class RequestTrans implements Serializable {
public class RequestTrans implements Externalizable {
public String path;
public String session;
@ -72,4 +72,15 @@ public class RequestTrans implements Serializable {
}
}
public void readExternal (ObjectInput s) throws ClassNotFoundException, IOException {
path = s.readUTF ();
session = s.readUTF ();
values = (Hashtable) s.readObject ();
}
public void writeExternal (ObjectOutput s) throws IOException {
s.writeUTF (path);
s.writeUTF (session);
s.writeObject (values);
}
}

View file

@ -13,7 +13,7 @@ import helma.util.*;
* class are directly exposed to JavaScript as global property res.
*/
public class ResponseTrans implements Serializable {
public class ResponseTrans implements Externalizable {
public String contentType = "text/html";
// the actual response
@ -40,7 +40,7 @@ public class ResponseTrans implements Serializable {
public transient String title, head, body, message, error;
// name of the skin to be rendered after completion, if any
public transient String mainSkin = null;
public transient String skin = null;
public ResponseTrans () {
@ -52,7 +52,7 @@ public class ResponseTrans implements Serializable {
if (buffer != null)
buffer.setLength (0);
redirect = null;
mainSkin = null;
skin = null;
title = head = body = message = error = "";
}
@ -227,6 +227,27 @@ public class ResponseTrans implements Serializable {
return cookieValues[i];
}
public void readExternal (ObjectInput s) throws ClassNotFoundException, IOException {
contentType = (String) s.readObject ();
response = (byte[]) s.readObject ();
redirect = (String) s.readObject ();
cookieKeys = (String[]) s.readObject ();
cookieValues = (String[]) s.readObject ();
cookieDays = (int[]) s.readObject ();
nCookies = s.readInt ();
cache = s.readBoolean ();
}
public void writeExternal (ObjectOutput s) throws IOException {
s.writeObject (contentType);
s.writeObject (response);
s.writeObject (redirect);
s.writeObject (cookieKeys);
s.writeObject (cookieValues);
s.writeObject (cookieDays);
s.writeInt (nCookies);
s.writeBoolean (cache);
}
}

View file

@ -293,10 +293,10 @@ public class RequestEvaluator implements Runnable {
try {
localrtx.timer.beginEvent (requestPath+" execute");
current.doIndirectCall (evaluator, current, action.getFunctionName (), new ESValue[0]);
if (res.mainSkin != null) {
Skin mainSkin = getSkin (null, res.mainSkin);
if (mainSkin != null)
mainSkin.render (this, null, null);
if (res.skin != null) {
Skin skin = getSkin (null, res.skin);
if (skin != null)
skin.render (this, null, null);
}
localrtx.timer.endEvent (requestPath+" execute");
} catch (RedirectException redirect) {