public int doEndTag()

in taglib/src/org/apache/taglibs/bsf/scriptlet.java [31:83]


    public int doEndTag() throws JspException {
        try {
            final BodyContent bodyOut = getBodyContent();

            JspWriter out = pageContext.getOut();
            if (bodyOut == null) return EVAL_PAGE;

            if (mgr == null) mgr = new BSFManager();
            final BSFEngine engine = mgr.loadScriptingEngine(language);

            try {
                register( mgr, "request"    , pageContext.getRequest());
                register( mgr, "response"   , pageContext.getResponse());
                register( mgr, "pageContext", pageContext);
                register( mgr, "application", pageContext.getServletContext());
                register( mgr, "out"        , out);
                register( mgr, "config"     , pageContext.getServletConfig());
                register( mgr, "page"       , pageContext.getPage());
                register( mgr, "exception"  , pageContext.getException());
                register( mgr, "session"    , pageContext.getSession());
            } 
            catch( Exception e ) {
                out.println(e.toString());
                e.printStackTrace();
            }

            try {
                AccessController.doPrivileged(new PrivilegedExceptionAction() {
                                                  public Object run() throws Exception {
                                                      HttpServletRequest pnamer =
                    (HttpServletRequest) pageContext.getRequest();
                String pthinfo = (pnamer.getPathInfo() != null) ?
                    pnamer.getPathInfo() : "";
                engine.exec (pnamer.getContextPath() +
                             pnamer.getServletPath() +
                             pthinfo, 
                             lineNo++, 0, bodyOut.getString());
                return null;
                                                  }
                                              });
            }
            catch (PrivilegedActionException prive) {
                throw (BSFException) prive.getException();
            }

        } 
        catch( Exception e ) {
            System.out.println(e.toString());
            e.printStackTrace();
        }

        return EVAL_PAGE;
    }