Package org.rendersnake

Examples of org.rendersnake.PageContext


    }

    private void copyParametersIntoPageContext(HttpServletRequest req, HtmlServletCanvas canvas) {
        // copy query parameters into pageContext
        Enumeration<String> names = req.getParameterNames();
        PageContext ctx = canvas.getPageContext();
        while (names.hasMoreElements()) {
            String key = names.nextElement();
            Object value = req.getParameter(key);
            ctx.set(key,value);
        }
    }
View Full Code Here


public class PageContextTest extends TestCase {

    private PageContext ctx;
   
    public void setUp() {
        ctx = new PageContext();
    }
View Full Code Here

      return UNRESOLVED;
   
    HttpServletRequest request = (HttpServletRequest)(webRequest.getNativeRequest());
    HttpServletResponse response = (HttpServletResponse)(webRequest.getNativeResponse());
        HtmlCanvas canvas = HtmlCanvasFactory.createCanvas(request,response,response.getWriter());
        PageContext context = canvas.getPageContext();
       
        boolean empty = true;
    if (this.shareSessionAttributes) {
        HttpSession session = request.getSession(false);
        if (session != null) {           
            Enumeration<?> enumerator = session.getAttributeNames();
            while(enumerator.hasMoreElements()) {
                String name = (String)enumerator.nextElement();
                context.set(name,session.getAttribute(name));
                empty = false;
            }
            if (!empty) context.attributes.push();
        }
    }
    empty = true;
        if (this.shareRequestParameters) {
            Enumeration<?> enumerator = request.getParameterNames();
            while(enumerator.hasMoreElements()) {
                String name = (String)enumerator.nextElement();
                context.set(name,request.getParameter(name));
                empty = false;
            }
            if (!empty) context.attributes.push();         
        }   
        empty = true;
    if (this.shareRequestAttributes) {
        Enumeration<?> enumerator = request.getAttributeNames();
            while(enumerator.hasMoreElements()) {
                String name = (String)enumerator.nextElement();
                if (!name.startsWith("org.springframework")) { // no need for spring internals
                    context.set(name,request.getAttribute(name));
                    empty = false;
                }
            }
            if (!empty) context.attributes.push();       
    }
View Full Code Here

        Renderable component = this.dispatchMap.get(uri);
        if (component == null) {
            response.sendError(404);
        } else {
            HtmlCanvas canvas = HtmlCanvasFactory.createCanvas(request,response,response.getWriter());
            PageContext context = canvas.getPageContext();
            String q = request.getQueryString();
            context.withObject(PageContext.REQUEST_PATH, request.getPathTranslated());
            context.withObject(PageContext.REQUEST_URIQ, request.getRequestURI() + (q == null ? "" : "?" + q));
            context.withObject(PageContext.SESSION, new SessionAttributesMap(request));
            context.withObject(PageContext.REQUEST_PARAMETERS, new RequestParametersMap(request))
            context.withObject(PageContext.REQUEST_HEADERS, new RequestHeadersMap(request));
            canvas.render(component);         
        }
    }
View Full Code Here

public class PageContextTest extends TestCase {

    private PageContext ctx;
   
    public void setUp() {
        ctx = new PageContext();
    }
View Full Code Here

TOP

Related Classes of org.rendersnake.PageContext

Copyright © 2018 www.massapicom. 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.