Mantis - Quercus
Viewing Issue Advanced Details
5340 minor always 01-21-13 21:13 02-05-13 04:01
ngoc  
 
normal  
new 4.0.34  
open  
none    
none  
0005340: Make QuercusCompiledScript Serializable
My project need save QuercusCompiledScript to datastore-memcache (appengine).
So I need QuercusCompiledScript implements Serializable .

- I can extends or rewrite another version of it , but it have QuercusScriptEngine and QuercusProgram fields non Serializable too .
- make transient it will cause null if reconstruct from datastore
Example my code in use :

QuercusScriptEngine engine = new QuercusScriptEngine(new QuercusScriptEngineFactory(), quercus);

String sayHelloVN ="<h1>hello <?php echo 'vietnam'; ?> </h1>" ;
CompiledScript script = engine.compile(sayHelloVN);

MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService();
syncCache.put("test", script );

CompiledScript compiledscript = (CompiledScript)syncCache.get("test");
compiledscript.eval();

Notes
(0006180)
ngoc   
02-05-13 03:59   
Please fix this issue , all CompiledScript is Serializable except QuercusCompiledScript
(0006181)
ngoc   
02-05-13 04:01   
String sayHelloVN ="<h1>hello </h1>" +
                    "<?php return 'Boy'; ?>";
          QuercusScriptEngine engine = new QuercusScriptEngine(new QuercusScriptEngineFactory());
          
          
          QuercusCompiledScript script = (QuercusCompiledScript) engine.compile(sayHelloVN);
         System.out.println(script.eval());
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream oos = new ObjectOutputStream(baos);
         oos.writeObject(script);

Sample test code