/** * Adds the names of the standard objects and their * prototypes to the list of excluded names. */ public void excludeStandardObjectNames() { String[] names = { "Object", "Object.prototype", "Function", "Function.prototype", "String", "String.prototype", "Math", // no Math.prototype "Array", "Array.prototype", "Error", "Error.prototype", "Number", "Number.prototype", "Date", "Date.prototype", "RegExp", "RegExp.prototype", "Script", "Script.prototype", "Continuation", "Continuation.prototype", }; for (int i=0; i < names.length; i++) { addExcludedName(names[i]); } String[] optionalNames = { "XML", "XML.prototype", "XMLList", "XMLList.prototype", }; for (int i=0; i < optionalNames.length; i++) { addOptionalExcludedName(optionalNames[i]); } }
@Override protected Object replaceObject(Object obj) throws IOException { if (false) throw new IOException(); // suppress warning String name = table.get(obj); if (name == null) return obj; return new PendingLookup(name); }
public void excludeAllIds(Object[] ids) { for (Object id: ids) { if (id instanceof String && (scope.get((String) id, scope) instanceof Scriptable)) { this.addExcludedName((String)id); } } }
@Override protected Object resolveObject(Object obj) throws IOException { if (obj instanceof ScriptableOutputStream.PendingLookup) { String name = ((ScriptableOutputStream.PendingLookup)obj).getName(); obj = ScriptableOutputStream.lookupQualifiedName(scope, name); if (obj == Scriptable.NOT_FOUND) { throw new IOException("Object " + name + " not found upon " + "deserialization."); } }else if (obj instanceof UniqueTag) { obj = ((UniqueTag)obj).readResolve(); }else if (obj instanceof Undefined) { obj = ((Undefined)obj).readResolve(); } return obj; }
/** * Create a ScriptableInputStream. * @param in the InputStream to read from. * @param scope the top-level scope to create the object in. */ public ScriptableInputStream(InputStream in, Scriptable scope) throws IOException { super(in); this.scope = scope; enableResolveObject(true); Context cx = Context.getCurrentContext(); if (cx != null) { this.classLoader = cx.getApplicationClassLoader(); } }
/** * Adds the names of the standard objects and their * prototypes to the list of excluded names. */ public void excludeStandardObjectNames() { String[] names = { "Object", "Object.prototype", "Function", "Function.prototype", "String", "String.prototype", "Math", // no Math.prototype "Array", "Array.prototype", "Error", "Error.prototype", "Number", "Number.prototype", "Date", "Date.prototype", "RegExp", "RegExp.prototype", "Script", "Script.prototype", "Continuation", "Continuation.prototype", }; for (int i=0; i < names.length; i++) { addExcludedName(names[i]); } String[] optionalNames = { "XML", "XML.prototype", "XMLList", "XMLList.prototype", }; for (int i=0; i < optionalNames.length; i++) { addOptionalExcludedName(optionalNames[i]); } }
@Override protected Object replaceObject(Object obj) throws IOException { if (false) throw new IOException(); // suppress warning String name = table.get(obj); if (name == null) return obj; return new PendingLookup(name); }
/** * Create a ScriptableInputStream. * @param in the InputStream to read from. * @param scope the top-level scope to create the object in. */ public ScriptableInputStream(InputStream in, Scriptable scope) throws IOException { super(in); this.scope = scope; enableResolveObject(true); Context cx = Context.getCurrentContext(); if (cx != null) { this.classLoader = cx.getApplicationClassLoader(); } }
public void excludeAllIds(Object[] ids) { for (Object id: ids) { if (id instanceof String && (scope.get((String) id, scope) instanceof Scriptable)) { this.addExcludedName((String)id); } } }
@Override protected Object replaceObject(Object obj) throws IOException { if (false) throw new IOException(); // suppress warning String name = table.get(obj); if (name == null) return obj; return new PendingLookup(name); }
/** * Create a ScriptableInputStream. * @param in the InputStream to read from. * @param scope the top-level scope to create the object in. */ public ScriptableInputStream(InputStream in, Scriptable scope) throws IOException { super(in); this.scope = scope; enableResolveObject(true); Context cx = Context.getCurrentContext(); if (cx != null) { this.classLoader = cx.getApplicationClassLoader(); } }
public void excludeAllIds(Object[] ids) { for (Object id: ids) { if (id instanceof String && (scope.get((String) id, scope) instanceof Scriptable)) { this.addExcludedName((String)id); } } }
@Override protected Object replaceObject(Object obj) throws IOException { if (false) throw new IOException(); // suppress warning String name = table.get(obj); if (name == null) return obj; return new PendingLookup(name); }
/** * Create a ScriptableInputStream. * @param in the InputStream to read from. * @param scope the top-level scope to create the object in. */ public ScriptableInputStream(InputStream in, Scriptable scope) throws IOException { super(in); this.scope = scope; enableResolveObject(true); Context cx = Context.getCurrentContext(); if (cx != null) { this.classLoader = cx.getApplicationClassLoader(); } }
public void excludeAllIds(Object[] ids) { for (Object id: ids) { if (id instanceof String && (scope.get((String) id, scope) instanceof Scriptable)) { this.addExcludedName((String)id); } } }
protected Object replaceObject(Object obj) throws IOException { String name = (String) table.get(obj); if (name == null) return obj; return new PendingLookup(name); }
/** * Create a ScriptableInputStream. * @param in the InputStream to read from. * @param scope the top-level scope to create the object in. */ public ScriptableInputStream(InputStream in, Scriptable scope) throws IOException { super(in); this.scope = scope; enableResolveObject(true); Context cx = Context.getCurrentContext(); if (cx != null) { this.classLoader = cx.getApplicationClassLoader(); } }
public void excludeAllIds(Object[] ids) { for (Object id: ids) { if (id instanceof String && (scope.get((String) id, scope) instanceof Scriptable)) { this.addExcludedName((String)id); } } }
@Override protected Object replaceObject(Object obj) throws IOException { if (false) throw new IOException(); // suppress warning String name = table.get(obj); if (name == null) return obj; return new PendingLookup(name); }
/** * Create a ScriptableInputStream. * @param in the InputStream to read from. * @param scope the top-level scope to create the object in. */ public ScriptableInputStream(InputStream in, Scriptable scope) throws IOException { super(in); this.scope = scope; enableResolveObject(true); Context cx = Context.getCurrentContext(); if (cx != null) { this.classLoader = cx.getApplicationClassLoader(); } }