Package jst

Examples of jst.ScriptRuntime.invoke()


    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        try {
            String scriptName = getScriptName(servletRequest);
            ScriptRuntime runtime = initializeScript( scriptName, (HttpServletRequest)servletRequest, (HttpServletResponse)servletResponse );
            writeResponse( servletResponse, runtime.invoke() );
        } catch( TemplateException ex ) {
            writeScriptError( (HttpServletRequest)servletRequest, (HttpServletResponse)servletResponse, ex );
        }
    }
View Full Code Here


        ScriptRuntime runtime = templateContext.load( "templates/exception.jst");
        runtime.addGlobalVariable( "request", request );
        runtime.addGlobalVariable( "response", response );
        runtime.addGlobalVariable( "servletContext", servletContext );
        runtime.addVariable("ex", ex );
        writeResponse( response, runtime.invoke() );
    }

    private ScriptRuntime initializeScript(String scriptName, HttpServletRequest request, HttpServletResponse response) throws IOException {
        ScriptRuntime runtime = templateContext.load( scriptName );
View Full Code Here

    public Object evaluate( String url, Map<String,Object> data ) throws IOException {
        ScriptRuntime runtime = load(url);
        for( String key : data.keySet() ) {
            runtime.addVariable( key, data.get(key) );
        }
        return runtime.invoke();
    }

    public void include(String url) throws IOException {
        context.include( url );
    }
View Full Code Here

            for( String name : ((Map<String,Object>)objects).keySet() ) {
                runtime.addVariable( name, objects.get( name ) );
            }

            Object value = runtime.invoke();

            writeResponse(httpServletResponse, value);
        } catch( TemplateException ex ) {
            ScriptRuntime runtime = templates.load( "templates/exception.jst" );
View Full Code Here

            runtime.addGlobalVariable( "request", httpServletRequest);
            runtime.addGlobalVariable( "response", httpServletResponse );
            runtime.addGlobalVariable( "servletContext", getServletContext() );
            runtime.addVariable("ex", ex );

            writeResponse( httpServletResponse, runtime.invoke() );
        }
    }

    private void writeResponse(HttpServletResponse httpServletResponse, Object value) throws IOException {
        PrintWriter writer = httpServletResponse.getWriter();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.