Java 类javax.servlet.jsp.JspContext 实例源码

项目:tomcat7    文件:JspContextWrapper.java   
public JspContextWrapper(JspContext jspContext,
        ArrayList<String> nestedVars, ArrayList<String> atBeginVars,
        ArrayList<String> atEndVars, Map<String,String> aliases) {
    this.invokingJspCtxt = (PageContext) jspContext;
    if (jspContext instanceof JspContextWrapper) {
        rootJspCtxt = ((JspContextWrapper)jspContext).rootJspCtxt;
    }
    else {
        rootJspCtxt = invokingJspCtxt;
    }
    this.nestedVars = nestedVars;
    this.atBeginVars = atBeginVars;
    this.atEndVars = atEndVars;
    this.pageAttributes = new HashMap<String, Object>(16);
    this.aliases = aliases;

    if (nestedVars != null) {
        this.originalNestedVars = new HashMap<String, Object>(nestedVars.size());
    }
    syncBeginTagFile();
}
项目:tomcat7    文件:ScopedAttributeELResolver.java   
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            return page.findAttribute(key);
        }
    }

    return null;
}
项目:tomcat7    文件:ScopedAttributeELResolver.java   
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:JspContextWrapper.java   
public JspContextWrapper(JspContext jspContext,
        ArrayList<String> nestedVars, ArrayList<String> atBeginVars,
        ArrayList<String> atEndVars, Map<String,String> aliases) {
    this.invokingJspCtxt = (PageContext) jspContext;
    if (jspContext instanceof JspContextWrapper) {
        rootJspCtxt = ((JspContextWrapper)jspContext).rootJspCtxt;
    }
    else {
        rootJspCtxt = invokingJspCtxt;
    }
    this.nestedVars = nestedVars;
    this.atBeginVars = atBeginVars;
    this.atEndVars = atEndVars;
    this.pageAttributes = new HashMap<String, Object>(16);
    this.aliases = aliases;

    if (nestedVars != null) {
        this.originalNestedVars = new HashMap<String, Object>(nestedVars.size());
    }
    syncBeginTagFile();
}
项目:apache-tomcat-7.0.73-with-comment    文件:ScopedAttributeELResolver.java   
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            return page.findAttribute(key);
        }
    }

    return null;
}
项目:apache-tomcat-7.0.73-with-comment    文件:ScopedAttributeELResolver.java   
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}
项目:lazycat    文件:JspContextWrapper.java   
public JspContextWrapper(JspContext jspContext, ArrayList<String> nestedVars, ArrayList<String> atBeginVars,
        ArrayList<String> atEndVars, Map<String, String> aliases) {
    this.invokingJspCtxt = (PageContext) jspContext;
    if (jspContext instanceof JspContextWrapper) {
        rootJspCtxt = ((JspContextWrapper) jspContext).rootJspCtxt;
    } else {
        rootJspCtxt = invokingJspCtxt;
    }
    this.nestedVars = nestedVars;
    this.atBeginVars = atBeginVars;
    this.atEndVars = atEndVars;
    this.pageAttributes = new HashMap<String, Object>(16);
    this.aliases = aliases;

    if (nestedVars != null) {
        this.originalNestedVars = new HashMap<String, Object>(nestedVars.size());
    }
    syncBeginTagFile();
}
项目:lazycat    文件:ScopedAttributeELResolver.java   
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context.getContext(JspContext.class);
            return page.findAttribute(key);
        }
    }

    return null;
}
项目:lazycat    文件:ScopedAttributeELResolver.java   
@Override
public void setValue(ELContext context, Object base, Object property, Object value)
        throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context.getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}
项目:beyondj    文件:JspContextWrapper.java   
public JspContextWrapper(JspContext jspContext,
        ArrayList<String> nestedVars, ArrayList<String> atBeginVars,
        ArrayList<String> atEndVars, Map<String,String> aliases) {
    this.invokingJspCtxt = (PageContext) jspContext;
    if (jspContext instanceof JspContextWrapper) {
        rootJspCtxt = ((JspContextWrapper)jspContext).rootJspCtxt;
    }
    else {
        rootJspCtxt = invokingJspCtxt;
    }
    this.nestedVars = nestedVars;
    this.atBeginVars = atBeginVars;
    this.atEndVars = atEndVars;
    this.pageAttributes = new HashMap<>(16);
    this.aliases = aliases;

    if (nestedVars != null) {
        this.originalNestedVars = new HashMap<>(nestedVars.size());
    } else {
        this.originalNestedVars = null;
    }
    syncBeginTagFile();
}
项目:beyondj    文件:ScopedAttributeELResolver.java   
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(base, property);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}
项目:dgm    文件:JoyMenuTag.java   
/**
 * Ecriture HTML du Tag
 * @throws JspException
 * @throws IOException 
 */
@Override
public void doTag() throws JspException, IOException {
    JspContext jsp = this.getJspContext();
    JspWriter out =jsp.getOut();

    // Create a top menu or reuse the existing one
    if (menuCache == null) {
        leftMenu(out);

    } else {
        out.println("<div id='" + cssDivMenu + "'>");
        out.println(menuCache);
        out.println("</div>");
    }
}
项目:dgm    文件:JoyMenuMegaTag.java   
/**
 * Ecriture HTML du Tag
 * @throws JspException
 * @throws IOException 
 */
@Override
public void doTag() throws JspException, IOException {
    JspContext jsp = this.getJspContext();
    JspWriter out =jsp.getOut();

    try {
        Action actionform = (Action)jsp.findAttribute(C.ACTION_FORM_BEAN);
        String embedded = actionform.getSessionAttr("mode");
        if (embedded.equalsIgnoreCase("embedded")) 
            leftMenu(out);
        else 
            topMenu(out);

    } catch (IOException ex) {
        Joy.log().debug ( ex.toString());
        out.println("No menu defined.");
    }
}
项目:packagedrone    文件:JspContextWrapper.java   
public JspContextWrapper(JspContext jspContext,
                            ArrayList<String> nestedVars,
                            ArrayList<String> atBeginVars,
                            ArrayList<String> atEndVars,
                            Map<String, String> aliases) {
       this.invokingJspCtxt = (PageContext) jspContext;
this.nestedVars = nestedVars;
this.atBeginVars = atBeginVars;
this.atEndVars = atEndVars;
this.pageAttributes = new Hashtable<String, Object>(16);
this.aliases = aliases;

if (nestedVars != null) {
    this.originalNestedVars =
               new HashMap<String, Object>(nestedVars.size());
}
syncBeginTagFile();
   }
项目:class-guard    文件:JspContextWrapper.java   
public JspContextWrapper(JspContext jspContext,
        ArrayList<String> nestedVars, ArrayList<String> atBeginVars,
        ArrayList<String> atEndVars, Map<String,String> aliases) {
    this.invokingJspCtxt = (PageContext) jspContext;
    if (jspContext instanceof JspContextWrapper) {
        rootJspCtxt = ((JspContextWrapper)jspContext).rootJspCtxt;
    }
    else {
        rootJspCtxt = invokingJspCtxt;
    }
    this.nestedVars = nestedVars;
    this.atBeginVars = atBeginVars;
    this.atEndVars = atEndVars;
    this.pageAttributes = new HashMap<String, Object>(16);
    this.aliases = aliases;

    if (nestedVars != null) {
        this.originalNestedVars = new HashMap<String, Object>(nestedVars.size());
    }
    syncBeginTagFile();
}
项目:class-guard    文件:ScopedAttributeELResolver.java   
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            return page.findAttribute(key);
        }
    }

    return null;
}
项目:class-guard    文件:ScopedAttributeELResolver.java   
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}
项目:package-drone    文件:JspContextWrapper.java   
public JspContextWrapper(JspContext jspContext,
                            ArrayList<String> nestedVars,
                            ArrayList<String> atBeginVars,
                            ArrayList<String> atEndVars,
                            Map<String, String> aliases) {
       this.invokingJspCtxt = (PageContext) jspContext;
this.nestedVars = nestedVars;
this.atBeginVars = atBeginVars;
this.atEndVars = atEndVars;
this.pageAttributes = new Hashtable<String, Object>(16);
this.aliases = aliases;

if (nestedVars != null) {
    this.originalNestedVars =
               new HashMap<String, Object>(nestedVars.size());
}
syncBeginTagFile();
   }
项目:apache-tomcat-7.0.57    文件:JspContextWrapper.java   
public JspContextWrapper(JspContext jspContext,
        ArrayList<String> nestedVars, ArrayList<String> atBeginVars,
        ArrayList<String> atEndVars, Map<String,String> aliases) {
    this.invokingJspCtxt = (PageContext) jspContext;
    if (jspContext instanceof JspContextWrapper) {
        rootJspCtxt = ((JspContextWrapper)jspContext).rootJspCtxt;
    }
    else {
        rootJspCtxt = invokingJspCtxt;
    }
    this.nestedVars = nestedVars;
    this.atBeginVars = atBeginVars;
    this.atEndVars = atEndVars;
    this.pageAttributes = new HashMap<String, Object>(16);
    this.aliases = aliases;

    if (nestedVars != null) {
        this.originalNestedVars = new HashMap<String, Object>(nestedVars.size());
    }
    syncBeginTagFile();
}
项目:apache-tomcat-7.0.57    文件:ScopedAttributeELResolver.java   
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            return page.findAttribute(key);
        }
    }

    return null;
}
项目:apache-tomcat-7.0.57    文件:ScopedAttributeELResolver.java   
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}
项目:apache-tomcat-7.0.57    文件:JspContextWrapper.java   
public JspContextWrapper(JspContext jspContext,
        ArrayList<String> nestedVars, ArrayList<String> atBeginVars,
        ArrayList<String> atEndVars, Map<String,String> aliases) {
    this.invokingJspCtxt = (PageContext) jspContext;
    if (jspContext instanceof JspContextWrapper) {
        rootJspCtxt = ((JspContextWrapper)jspContext).rootJspCtxt;
    }
    else {
        rootJspCtxt = invokingJspCtxt;
    }
    this.nestedVars = nestedVars;
    this.atBeginVars = atBeginVars;
    this.atEndVars = atEndVars;
    this.pageAttributes = new HashMap<String, Object>(16);
    this.aliases = aliases;

    if (nestedVars != null) {
        this.originalNestedVars = new HashMap<String, Object>(nestedVars.size());
    }
    syncBeginTagFile();
}
项目:apache-tomcat-7.0.57    文件:ScopedAttributeELResolver.java   
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            return page.findAttribute(key);
        }
    }

    return null;
}
项目:apache-tomcat-7.0.57    文件:ScopedAttributeELResolver.java   
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}
项目:mobile-starting-framework    文件:PageTagThemeTest.java   
@Before
public void setup() throws Exception {
    mockPageContext = new MockPageContext(mockServletContext, new MockHttpServletRequest(), new MockHttpServletResponse());
    tag = new PageTag();
    tag.setAppcacheEnabled("false");
    tag.setJspContext(mockPageContext);
    tag.setJspBody(new JspFragment() {
        @Override
        public void invoke(Writer out) throws JspException, IOException {
        }

        @Override
        public JspContext getJspContext() {
            return null;
        }
    });
}
项目:sinavi-jfw    文件:PankuzuTag.java   
/**
 * パンクズリストを表示します。
 * このメソッドはJSP-BODYを評価せずに、
 * 既存のHTMLテンプレート、あるいはクラスコンフィグオーバライドされたHTMLテンプレートを利用します。
 * @throws JspException JSP処理中にエラーが発生した場合
 * @throws IOException 入出力エラーの場合
 */
protected void render() throws JspException, IOException {
    render(new JspFragment() {
        @Override public JspContext getJspContext() {
            return PankuzuTag.this.getJspContext();
        }
        @Override public void invoke(Writer out) throws JspException, IOException {
            JspContext context = getJspContext();
            ViewId vid = (ViewId) context.getAttribute(var);
            String encodedUrl = encodeURL(vid.getUrl());
            String item = Strings.substitute(DEFAULT_TEMPLATE, Maps
                        .hash("url", encodedUrl)
                        .map("label", Strings.escapeHTML(vid.getLabel()))
                        .map("query", trimQueryMarkerIfGetRequestParameterExists(encodedUrl, vid.getQuery())));
            context.getOut().print(item);
        }
    });
}
项目:commons-taglib    文件:AbstractTagProxy.java   
/**
 * Gets the {@link BeanFactory} from the given {@link JspContext}. The default
 * implementation automagically finds a {@link BeanFactory} that was previously set by
 * a {@link FrameworkServlet}. The result is cached.
 *
 * @param jspContext
 *            {@link JspContext} to be used
 * @return {@link BeanFactory} found
 */
@SuppressWarnings("unchecked")
protected BeanFactory getBeanFactory(JspContext jspContext) {
    Object bfCache = jspContext.getAttribute(TAGPROXY_BEANFACTORY_CACHE, PageContext.APPLICATION_SCOPE);
    if (bfCache != null && bfCache instanceof BeanFactory) {
        return (BeanFactory) bfCache;
    }

    Enumeration<String> en = jspContext.getAttributeNamesInScope(PageContext.APPLICATION_SCOPE);
    while (en.hasMoreElements()) {
        String attribute = en.nextElement();
        if (attribute.startsWith(FrameworkServlet.SERVLET_CONTEXT_PREFIX)) {
            Object bf = jspContext.getAttribute(attribute, PageContext.APPLICATION_SCOPE);
            if (bf != null && bf instanceof BeanFactory) {
                BeanFactory bfBean = (BeanFactory) bf;
                jspContext.setAttribute(TAGPROXY_BEANFACTORY_CACHE, bfBean, PageContext.APPLICATION_SCOPE);
                return bfBean;
            }
        }
    }

    throw new IllegalStateException("Could not find a BeanFactory. Use a FrameworkServlet or @BeanFactoryReference.");
}
项目:WBSAirback    文件:ScopedAttributeELResolver.java   
@Override
public Object getValue(ELContext context, Object base, Object property)
        throws NullPointerException, PropertyNotFoundException, ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            return page.findAttribute(key);
        }
    }

    return null;
}
项目:WBSAirback    文件:ScopedAttributeELResolver.java   
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}
项目:zeprs    文件:RenderPageAction.java   
protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

        JspFactory _jspxFactory = null;
        PageContext pageContext = null;
        _jspxFactory = JspFactory.getDefaultFactory();
        response.setContentType("text/html");

        pageContext = _jspxFactory.getPageContext(this.getServlet(), request, response, null, true, 8192, true);
        JspContext jspContext = pageContext;
        java.util.ArrayList _jspx_nested = null;
        java.util.ArrayList _jspx_at_begin = null;
        java.util.ArrayList _jspx_at_end = null;
        jspContext = new org.apache.jasper.runtime.JspContextWrapper(jspContext, _jspx_nested, _jspx_at_begin, _jspx_at_end, null);

        /*patientid_005fdistricts_tag tag = new patientid_005fdistricts_tag();
        tag.setJspContext(jspContext);
        try {
            tag.doTag();
        } catch (JspException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }*/

        return mapping.findForward(SUCCESS_FORWARD);
    }
项目:ehcachetag    文件:CacheTagTest.java   
/**
 * Test doStartTag where the first modifier throws an exception
 * @throws JspException 
 */
@Test
public void doStartTag_modifier_not_found() throws JspException {
    // given
    testSubject.setKey("testkey");
    CacheTagModifier modifier = Mockito.mock(CacheTagModifier.class);
    Mockito.doThrow(new RuntimeException()).when(modifier).beforeLookup(Mockito.any(CacheTag.class), Mockito.any(JspContext.class));
    Mockito.when(cacheTagModifierFactory.getCacheTagModifier(Mockito.anyString())).thenReturn(modifier);

    // when
    int actualResult = testSubject.doStartTag();

    // then
    Assert.assertEquals(BodyTagSupport.EVAL_BODY_INCLUDE, actualResult);

    // cleanup
    Assert.assertNull(testSubject.getKey());
    Assert.assertNull(testSubject.getCache());
    Assert.assertEquals("", testSubject.getModifiers());
}
项目:ehcachetag    文件:CacheTagTest.java   
/**
 * Test doStartTag where the first modifier throws an exception
 * @throws JspException 
 */
@Test
public void doStartTag_modifier_exception() throws JspException {
    // given
    testSubject.setKey("testkey");
    CacheTagModifier modifier = Mockito.mock(CacheTagModifier.class);
    Mockito.doThrow(new RuntimeException()).when(modifier).beforeLookup(Mockito.any(CacheTag.class), Mockito.any(JspContext.class));
    Mockito.when(cacheTagModifierFactory.getCacheTagModifier(Mockito.anyString())).thenReturn(modifier);

    // when
    int actualResult = testSubject.doStartTag();

    // then
    Assert.assertEquals(BodyTagSupport.EVAL_BODY_INCLUDE, actualResult);

    verifyCleanup();
}
项目:ehcachetag    文件:CacheTagTest.java   
@Test
public void testDoBeforeUpdate() throws Exception {
    // given
    String testInput = "A";

    CacheTagModifier modifierB = Mockito.mock(CacheTagModifier.class);
    Mockito.when(modifierB.beforeUpdate(Mockito.any(CacheTag.class), Mockito.any(JspContext.class), Mockito.eq("A"))).thenReturn("AB");
    Mockito.when(cacheTagModifierFactory.getCacheTagModifier("modifierB")).thenReturn(modifierB);

    CacheTagModifier modifierC = Mockito.mock(CacheTagModifier.class);
    Mockito.when(modifierC.beforeUpdate(Mockito.any(CacheTag.class), Mockito.any(JspContext.class), Mockito.eq("AB"))).thenReturn("CAB");
    Mockito.when(cacheTagModifierFactory.getCacheTagModifier("modifierC")).thenReturn(modifierC);

    testSubject.setModifiers("modifierB,modifierC");
    Mockito.when(pageContext.findAttribute(EHCacheTagConstants.MODIFIER_FACTORY_ATTRIBUTE)).thenReturn(cacheTagModifierFactory);

    // when
    String actualResult = testSubject.doBeforeUpdate(testInput);

    // then
    Assert.assertEquals("CAB", actualResult);
    Mockito.verify(modifierB).beforeUpdate(Mockito.any(CacheTag.class), Mockito.any(JspContext.class), Mockito.eq("A"));
    Mockito.verify(modifierC).beforeUpdate(Mockito.any(CacheTag.class), Mockito.any(JspContext.class), Mockito.eq("AB"));

    Mockito.verifyNoMoreInteractions(modifierB, modifierC);
}
项目:ehcachetag    文件:CacheTagTest.java   
@Test
public void testDoAfterRetrieval() throws Exception {
    // given
    String testInput = "A";

    CacheTagModifier modifierB = Mockito.mock(CacheTagModifier.class);
    Mockito.when(modifierB.afterRetrieval(Mockito.any(CacheTag.class), Mockito.any(JspContext.class), Mockito.eq("A"))).thenReturn("AB");
    Mockito.when(cacheTagModifierFactory.getCacheTagModifier("modifierB")).thenReturn(modifierB);

    CacheTagModifier modifierC = Mockito.mock(CacheTagModifier.class);
    Mockito.when(modifierC.afterRetrieval(Mockito.any(CacheTag.class), Mockito.any(JspContext.class), Mockito.eq("AB"))).thenReturn("CAB");
    Mockito.when(cacheTagModifierFactory.getCacheTagModifier("modifierC")).thenReturn(modifierC);

    testSubject.setModifiers("modifierB,modifierC");
    Mockito.when(pageContext.findAttribute(EHCacheTagConstants.MODIFIER_FACTORY_ATTRIBUTE)).thenReturn(cacheTagModifierFactory);

    // when
    String actualResult = testSubject.doAfterRetrieval(testInput);

    // then
    Assert.assertEquals("CAB", actualResult);
    Mockito.verify(modifierB).afterRetrieval(Mockito.any(CacheTag.class), Mockito.any(JspContext.class), Mockito.eq("A"));
    Mockito.verify(modifierC).afterRetrieval(Mockito.any(CacheTag.class), Mockito.any(JspContext.class), Mockito.eq("AB"));
    Mockito.verifyNoMoreInteractions(modifierB, modifierC);
}
项目:tomcat7    文件:JspContextWrapper.java   
@Override
public Object getContext(@SuppressWarnings("rawtypes") Class key) {
    if (key == JspContext.class) {
        return pageContext;
    }
    return wrapped.getContext(key);
}
项目:lams    文件:JspContextWrapper.java   
public JspContextWrapper(JspContext jspContext, ArrayList nestedVars,
        ArrayList atBeginVars, ArrayList atEndVars, Map aliases) {
    this.invokingJspCtxt = (PageContext) jspContext;
    this.nestedVars = nestedVars;
    this.atBeginVars = atBeginVars;
    this.atEndVars = atEndVars;
    this.pageAttributes = new HashMap<String, Object>(16);
    this.aliases = aliases;

    if (nestedVars != null) {
        this.originalNestedVars = new HashMap<String, Object>(nestedVars.size());
    }
    syncBeginTagFile();
}
项目:apache-tomcat-7.0.73-with-comment    文件:JspContextWrapper.java   
@Override
public Object getContext(@SuppressWarnings("rawtypes") Class key) {
    if (key == JspContext.class) {
        return pageContext;
    }
    return wrapped.getContext(key);
}
项目:lazycat    文件:JspContextWrapper.java   
@Override
public Object getContext(@SuppressWarnings("rawtypes") Class key) {
    if (key == JspContext.class) {
        return pageContext;
    }
    return wrapped.getContext(key);
}
项目:beyondj    文件:JspApplicationContextImpl.java   
public ELContextImpl createELContext(JspContext context) {
    if (context == null) {
        throw new IllegalArgumentException("JspContext was null");
    }

    // create ELContext for JspContext
    final ELResolver r = this.createELResolver();
    ELContextImpl ctx;
    if (Constants.IS_SECURITY_ENABLED) {
        ctx = AccessController.doPrivileged(
                new PrivilegedAction<ELContextImpl>() {
                    @Override
                    public ELContextImpl run() {
                        return new ELContextImpl(r);
                    }
                });
    } else {
        ctx = new ELContextImpl(r);
    }
    ctx.putContext(JspContext.class, context);

    // alert all ELContextListeners
    ELContextEvent event = new ELContextEvent(ctx);
    for (int i = 0; i < this.contextListeners.size(); i++) {
        this.contextListeners.get(i).contextCreated(event);
    }

    return ctx;
}
项目:beyondj    文件:JspFragmentHelper.java   
public JspFragmentHelper( int discriminator, JspContext jspContext,
    JspTag parentTag )
{
    this.discriminator = discriminator;
    this.jspContext = jspContext;
    if(jspContext instanceof PageContext) {
        _jspx_page_context = (PageContext)jspContext;
    } else {
        _jspx_page_context = null;
    }
    this.parentTag = parentTag;
}