cancel
Showing results for 
Search instead for 
Did you mean: 

Java - Build Dynamic Script Model

drozes
Champ in-the-making
Champ in-the-making
Hi guys;
Been attempting to a compile a web-script on my own through a java class.

I have successfully compiled the FTL using the class "org.springframework.extensions.webscripts.processor.FTLTemplateProcessor;" and processing the string and using a temporary model fro now.

I now need to figure out the javascript compiler to get a real model.
I believe this is the correct class to be using:
"org.springframework.extensions.webscripts.processor.JSScriptProcessor"

My questions are:
1: How to build the default objects that are avialable to javascript serverside files.
2: Any comments on the JSScriptProcessor and if it is able to process content as a string.

Ill be sure to post my class afterwards for any help!
1 REPLY 1

afaust
Legendary Innovator
Legendary Innovator
I am not sure I understand what you are trying to do.
Both the FTLTemplateProcessor and JSScriptProcessor are not compilers themselves - they may use a compiler internally, but may also be configured to use interpretation mode. The JSScriptProcessor is already capable of processing a String as source for the content of a script. Check out its public API defined by the ScriptProcessor interface.

The ProcessorModelHelper provides utility methods to populate a default model based on the current request context. Note that this only provides the same objects avaible to a Share web script. The Repository tier uses a custom framework of processors and utilities for the execution of web scripts and does not reuse most of the Spring web scripts default components.
You can of course always populate the model yourself, depending on what you need to be available.

Regards
Axel