@Override public ValueExpression resolveVariable(String name) { Object obj = pageCtx.findAttribute(name); if (obj == null) { return null; } return expressionFactoryImpl.createValueExpression(obj, obj.getClass()); }
@Override public JspWriter popBody() { popWriter(); return (JspWriter) getAttribute(OUT); }
SimpleTag tag = (SimpleTag) getTagInstance(); final FreeMarkerPageContext pageContext = PageContextFactory.getCurrentPageContext(); pageContext.pushWriter(new JspWriterAdapter(env.getOut())); try { tag.setJspContext(pageContext); JspTag parentTag = (JspTag) pageContext.peekTopTag(JspTag.class); if (parentTag != null) { tag.setParent(parentTag); setupTag(tag, args, pageContext.getObjectWrapper()); if (body != null) { tag.setJspBody(new JspFragment() { pageContext.pushTopTag(tag); try { tag.doTag(); } finally { pageContext.popTopTag(); pageContext.popWriter();
@Override public BodyContent pushBody() { return (BodyContent) pushWriter(new TagTransformModel.BodyContentImpl(getOut(), true)); }
@Override public void close() { if (closed) { return; } closed = true; if (needPop) { pageContext.popWriter(); } pageContext.popTopTag(); try { if (isTryCatchFinally) { ((TryCatchFinally) tag).doFinally(); } // No pooling yet tag.release(); } finally { if (needDoublePop) { pageContext.popWriter(); } } }
@Override public void removeAttribute(String name, int scope) { switch(scope) { case PAGE_SCOPE: { environment.getGlobalNamespace().remove(name); break; } case REQUEST_SCOPE: { getRequest().removeAttribute(name); break; } case SESSION_SCOPE: { HttpSession session = getSession(false); if (session != null) { session.removeAttribute(name); } break; } case APPLICATION_SCOPE: { getServletContext().removeAttribute(name); break; } default: { throw new IllegalArgumentException("Invalid scope: " + scope); } } }
Tag tag = (Tag) getTagInstance(); FreeMarkerPageContext pageContext = PageContextFactory.getCurrentPageContext(); Tag parentTag = (Tag) pageContext.peekTopTag(Tag.class); tag.setParent(parentTag); tag.setPageContext(pageContext); setupTag(tag, args, pageContext.getObjectWrapper()); if (out != pageContext.getOut()) { throw new TemplateModelException( "out != pageContext.getOut(). Out is " + out + " pageContext.getOut() is " + pageContext.getOut()); pageContext.pushWriter((JspWriter) out); usesAdapter = true; pageContext.pushTopTag(tag); pageContext.pushWriter(w); return w; } catch (Exception e) {
@Override public int getAttributesScope(String name) { if (getAttribute(name, PAGE_SCOPE) != null) return PAGE_SCOPE; if (getAttribute(name, REQUEST_SCOPE) != null) return REQUEST_SCOPE; if (getAttribute(name, SESSION_SCOPE) != null) return SESSION_SCOPE; if (getAttribute(name, APPLICATION_SCOPE) != null) return APPLICATION_SCOPE; return 0; }
/** * Includes the specified path. The flush argument is ignored! */ public void include(String path, boolean flush) throws IOException, ServletException { super.include(path); } }
@Override public void invoke(Writer out) throws JspException, IOException { try { body.render(out == null ? pageContext.getOut() : out); } catch (TemplateException e) { throw new TemplateExceptionWrapperJspException(e); } } });
@Override public HttpSession getSession() { return getSession(false); }
@Override public void setAttribute(String name, Object value, int scope) { switch(scope) { case PAGE_SCOPE: { try { environment.setGlobalVariable(name, wrapper.wrap(value)); break; } catch (TemplateModelException e) { throw new UndeclaredThrowableException(e); } } case REQUEST_SCOPE: { getRequest().setAttribute(name, value); break; } case SESSION_SCOPE: { getSession(true).setAttribute(name, value); break; } case APPLICATION_SCOPE: { getServletContext().setAttribute(name, value); break; } default: { throw new IllegalArgumentException("Invalid scope " + scope); } } }
Tag tag = (Tag) getTagInstance(); FreeMarkerPageContext pageContext = PageContextFactory.getCurrentPageContext(); Tag parentTag = (Tag) pageContext.peekTopTag(Tag.class); tag.setParent(parentTag); tag.setPageContext(pageContext); setupTag(tag, args, pageContext.getObjectWrapper()); if (out != pageContext.getOut()) { throw new TemplateModelException( "out != pageContext.getOut(). Out is " + out + " pageContext.getOut() is " + pageContext.getOut()); pageContext.pushWriter((JspWriter) out); usesAdapter = true; pageContext.pushTopTag(tag); pageContext.pushWriter(w); return w; } catch (Exception e) {
@Override public BodyContent pushBody() { return (BodyContent) pushWriter(new TagTransformModel.BodyContentImpl(getOut(), true)); }
@Override public Object findAttribute(String name) { Object retval = getAttribute(name, PAGE_SCOPE); if (retval != null) return retval; retval = getAttribute(name, REQUEST_SCOPE); if (retval != null) return retval; retval = getAttribute(name, SESSION_SCOPE); if (retval != null) return retval; return getAttribute(name, APPLICATION_SCOPE); }
/** * Includes the specified path. The flush argument is ignored! */ public void include(String path, boolean flush) throws IOException, ServletException { super.include(path); } }
public void invoke(Writer out) throws JspException, IOException { try { body.render(out == null ? pageContext.getOut() : out); } catch(TemplateException e) { throw new JspException(e); } } });
@Override public HttpSession getSession() { return getSession(false); }
@Override public Enumeration getAttributeNamesInScope(int scope) { switch(scope) { case PAGE_SCOPE: { try { return new TemplateHashModelExEnumeration(environment.getGlobalNamespace()); } catch (TemplateModelException e) { throw new UndeclaredThrowableException(e); } } case REQUEST_SCOPE: { return getRequest().getAttributeNames(); } case SESSION_SCOPE: { HttpSession session = getSession(false); if (session != null) { return session.getAttributeNames(); } return Collections.enumeration(Collections.EMPTY_SET); } case APPLICATION_SCOPE: { return getServletContext().getAttributeNames(); } default: { throw new IllegalArgumentException("Invalid scope " + scope); } } }