Examples of AttributeContext


Examples of org.apache.tiles.AttributeContext

     * @param request The request context.
     * @param definition The definition to render.
     * @since 2.1.3
     */
    protected void render(TilesRequestContext request, Definition definition) {
        AttributeContext originalContext = getAttributeContext(request);
        BasicAttributeContext subContext = new BasicAttributeContext(originalContext);
        subContext.inherit(definition);

        pushContext(subContext, request);

View Full Code Here

Examples of org.apache.tiles.AttributeContext

     */
    private Attribute computeAttribute(PageContext context) {
        Attribute attribute = (Attribute) value;

        if (attribute == null) {
            AttributeContext evaluatingContext = container
                    .getAttributeContext(context);
            attribute = evaluatingContext.getAttribute(name);
            if (attribute == null) {
                attribute = computeDefaultAttribute();
                if (attribute == null && !ignore) {
                    throw new NoSuchAttributeException("Attribute '" + name
                            + "' not found.");
View Full Code Here

Examples of org.apache.tiles.AttributeContext

     */
    @Test(expected = TilesJspException.class)
    public void testTagNullEvaluateException() throws TilesJspException {
        PageContext pageContext = createMock(PageContext.class);
        TilesContainer container = createMock(TilesContainer.class);
        AttributeContext attributeContext = createMock(AttributeContext.class);
        Attribute attribute = new Attribute("myValue");
        expect(pageContext.getAttribute(
                ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME,
                PageContext.REQUEST_SCOPE)).andReturn(container);
        expect(container.getAttributeContext(pageContext)).andReturn(attributeContext);
        expect(attributeContext.getAttribute("attributeName")).andReturn(attribute);
        expect(container.evaluate(attribute, pageContext)).andReturn(null);

        replay(pageContext, container, attributeContext);
        ImportAttributeTag tag = new ImportAttributeTag();
        tag.setPageContext(pageContext);
View Full Code Here

Examples of org.apache.tiles.AttributeContext

     */
    @Test
    public void testTagNullEvaluateIgnoreException() throws TilesJspException {
        PageContext pageContext = createMock(PageContext.class);
        TilesContainer container = createMock(TilesContainer.class);
        AttributeContext attributeContext = createMock(AttributeContext.class);
        Attribute attribute = new Attribute("myValue");
        expect(pageContext.getAttribute(
                ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME,
                PageContext.REQUEST_SCOPE)).andReturn(container);
        expect(container.getAttributeContext(pageContext)).andReturn(attributeContext);
        expect(attributeContext.getAttribute("attributeName")).andReturn(attribute);
        expect(container.evaluate(attribute, pageContext)).andReturn(null);

        replay(pageContext, container, attributeContext);
        ImportAttributeTag tag = new ImportAttributeTag();
        tag.setPageContext(pageContext);
View Full Code Here

Examples of org.apache.tiles.AttributeContext

     */
    @Test(expected = TilesJspException.class)
    public void testTagNullEvaluateAllException() throws TilesJspException {
        PageContext pageContext = createMock(PageContext.class);
        TilesContainer container = createMock(TilesContainer.class);
        AttributeContext attributeContext = createMock(AttributeContext.class);
        Attribute attribute = new Attribute("myValue");
        expect(pageContext.getAttribute(
                ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME,
                PageContext.REQUEST_SCOPE)).andReturn(container);
        expect(container.getAttributeContext(pageContext)).andReturn(attributeContext);
        expect(attributeContext.getAttribute("attributeName")).andReturn(attribute);
        expect(container.evaluate(attribute, pageContext)).andReturn(null);
        expect(attributeContext.getCascadedAttributeNames()).andReturn(null);
        Set<String> names = new HashSet<String>();
        names.add("attributeName");
        expect(attributeContext.getLocalAttributeNames()).andReturn(names);

        replay(pageContext, container, attributeContext);
        ImportAttributeTag tag = new ImportAttributeTag();
        tag.setPageContext(pageContext);
        tag.doStartTag();
View Full Code Here

Examples of org.apache.tiles.AttributeContext

     */
    @Test
    public void testTagNullEvaluateAllIgnoreException() throws TilesJspException {
        PageContext pageContext = createMock(PageContext.class);
        TilesContainer container = createMock(TilesContainer.class);
        AttributeContext attributeContext = createMock(AttributeContext.class);
        Attribute attribute = new Attribute("myValue");
        expect(pageContext.getAttribute(
                ServletUtil.CURRENT_CONTAINER_ATTRIBUTE_NAME,
                PageContext.REQUEST_SCOPE)).andReturn(container);
        expect(container.getAttributeContext(pageContext)).andReturn(attributeContext);
        expect(attributeContext.getAttribute("attributeName")).andReturn(attribute);
        expect(container.evaluate(attribute, pageContext)).andReturn(null);
        expect(attributeContext.getCascadedAttributeNames()).andReturn(null);
        Set<String> names = new HashSet<String>();
        names.add("attributeName");
        expect(attributeContext.getLocalAttributeNames()).andReturn(names);

        replay(pageContext, container, attributeContext);
        ImportAttributeTag tag = new ImportAttributeTag();
        tag.setPageContext(pageContext);
        tag.setIgnore(true);
View Full Code Here

Examples of org.apache.tiles.AttributeContext

        ServletContext servletContext = EasyMock
                .createMock(ServletContext.class);
        RequestDispatcher rd = EasyMock.createMock(RequestDispatcher.class);
        TilesRequestContext requestContext = new ServletTilesRequestContext(
                servletContext, request, response);
        AttributeContext attributeContext = EasyMock
                .createMock(AttributeContext.class);

        EasyMock.expect(servletContext.getRequestDispatcher("/my/url.do"))
                .andReturn(rd);
        rd.include(request, response);
View Full Code Here

Examples of org.apache.tiles.AttributeContext

        }

        attribute = (Attribute) value;

        if (attribute == null) {
            AttributeContext evaluatingContext = container
                    .getAttributeContext(context);
            attribute = evaluatingContext.getAttribute(name);
            if (attribute == null && !ignore) {
                throw new NoSuchAttributeException("Attribute '" + name
                        + "' not found.");
            }
        }
View Full Code Here

Examples of org.apache.tiles.AttributeContext

    }

    /** {@inheritDoc} */
    public void renderContext(Object... requestItems) {
        TilesRequestContext request = getRequestContext(requestItems);
        AttributeContext attributeContext = getAttributeContext(request);

        if (!isPermitted(request, attributeContext.getRoles())) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Access to current attribute context denied. "
                        + "User not in role '" + attributeContext.getRoles());
            }
            return;
        }

        render(request, attributeContext);
View Full Code Here

Examples of org.apache.tiles.AttributeContext

     *
     * @param tilesContext The request context to use.
     * @return The current attribute context.
     */
    private AttributeContext getAttributeContext(TilesRequestContext tilesContext) {
        AttributeContext context = getContext(tilesContext);
        if (context == null) {
            context = new BasicAttributeContext();
            pushContext(context, tilesContext);
        }
        return context;
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.