Package org.apache.sling.scripting.javascript.io

Examples of org.apache.sling.scripting.javascript.io.EspReader

The nice thing about this reader is, that the line numbers of the resulting stream match the line numbers of the matching contents of the input stream. Due to the insertion of write() calls, column numbers will not necessarily match, though. This is especially true if you mix ECMA code tags (<% %>) with template text on the same line.

For maximum performance it is advisable to not create the EspReader with a plain FileReader or InputStreamReader but rather with a BufferedReader based on one of the simpler Readers. The reasons for this is, that we call the base reader character by character. This in turn is not too performing if the base reader does not buffer its input.


            }
        }

        // wrap the reader in an EspReader for ESP scripts
        if (scriptName.endsWith(RhinoJavaScriptEngineFactory.ESP_SCRIPT_EXTENSION)) {
            scriptReader = new EspReader(scriptReader);
        }

        // container for replaced properties
        Map<String, Object> replacedProperties = null;
        Scriptable scope = null;
View Full Code Here


        Reader scriptReader = new InputStreamReader(scriptStream);

        // check whether we have to wrap the basic reader
        if (scriptName
            .endsWith(RhinoJavaScriptEngineFactory.ESP_SCRIPT_EXTENSION)) {
          scriptReader = new EspReader(scriptReader);
        }

        // read the suff buffered for better performance
        scriptReader = new BufferedReader(scriptReader);
View Full Code Here

      Reader scriptReader = new InputStreamReader(scriptStream);

      // check whether we have to wrap the basic reader
      if (scriptName
          .endsWith(RhinoJavaScriptEngineFactory.ESP_SCRIPT_EXTENSION)) {
        scriptReader = new EspReader(scriptReader);
      }

      // read the suff buffered for better performance
      scriptReader = new BufferedReader(scriptReader);
View Full Code Here

    /** Convert the script read on scriptReader to javascript code and
     *  write the result to output using a BodyOnlyScriptFilteredCopy,
     *  to keep only the part that's relevant for the document body
     */
    void generateCode(Reader scriptReader, PrintWriter output) throws IOException {
        final EspReader er = new EspReader(scriptReader);
        er.setOutInitStatement("");
        output.println("out=document;");
        new BodyOnlyScriptFilteredCopy().copy(er,output);
    }
View Full Code Here

            }
        }

        // wrap the reader in an EspReader for ESP scripts
        if (scriptName.endsWith(RhinoJavaScriptEngineFactory.ESP_SCRIPT_EXTENSION)) {
            scriptReader = new EspReader(scriptReader);
        }

        // create a rhino Context and execute the script
        try {
           
View Full Code Here

                // reader for the stream
                Reader scriptReader = new InputStreamReader(scriptStream);

                // check whether we have to wrap the basic reader
                if (scriptName.endsWith(RhinoJavaScriptEngineFactory.ESP_SCRIPT_EXTENSION)) {
                    scriptReader = new EspReader(scriptReader);
                }

                // read the suff buffered for better performance
                scriptReader = new BufferedReader(scriptReader);
View Full Code Here

            }
        }

        // wrap the reader in an EspReader for ESP scripts
        if (scriptName.endsWith(RhinoJavaScriptEngineFactory.ESP_SCRIPT_EXTENSION)) {
            scriptReader = new EspReader(scriptReader);
        }

        // container for replaced properties
        Map<String, Object> replacedProperties = null;
        Scriptable scope = null;
View Full Code Here

                // reader for the stream
                Reader scriptReader = new InputStreamReader(scriptStream);

                // check whether we have to wrap the basic reader
                if (scriptName.endsWith(RhinoJavaScriptEngineFactory.ESP_SCRIPT_EXTENSION)) {
                    scriptReader = new EspReader(scriptReader);
                }

                // read the suff buffered for better performance
                scriptReader = new BufferedReader(scriptReader);
View Full Code Here

TOP

Related Classes of org.apache.sling.scripting.javascript.io.EspReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.