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. * 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 path;
public String session; 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. * 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"; public String contentType = "text/html";
// the actual response // the actual response
@ -40,7 +40,7 @@ public class ResponseTrans implements Serializable {
public transient String title, head, body, message, error; public transient String title, head, body, message, error;
// name of the skin to be rendered after completion, if any // name of the skin to be rendered after completion, if any
public transient String mainSkin = null; public transient String skin = null;
public ResponseTrans () { public ResponseTrans () {
@ -52,7 +52,7 @@ public class ResponseTrans implements Serializable {
if (buffer != null) if (buffer != null)
buffer.setLength (0); buffer.setLength (0);
redirect = null; redirect = null;
mainSkin = null; skin = null;
title = head = body = message = error = ""; title = head = body = message = error = "";
} }
@ -227,6 +227,27 @@ public class ResponseTrans implements Serializable {
return cookieValues[i]; 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 { try {
localrtx.timer.beginEvent (requestPath+" execute"); localrtx.timer.beginEvent (requestPath+" execute");
current.doIndirectCall (evaluator, current, action.getFunctionName (), new ESValue[0]); current.doIndirectCall (evaluator, current, action.getFunctionName (), new ESValue[0]);
if (res.mainSkin != null) { if (res.skin != null) {
Skin mainSkin = getSkin (null, res.mainSkin); Skin skin = getSkin (null, res.skin);
if (mainSkin != null) if (skin != null)
mainSkin.render (this, null, null); skin.render (this, null, null);
} }
localrtx.timer.endEvent (requestPath+" execute"); localrtx.timer.endEvent (requestPath+" execute");
} catch (RedirectException redirect) { } catch (RedirectException redirect) {