Package org.apache.tiles.servlet.context

Examples of org.apache.tiles.servlet.context.ServletTilesRequestContext


     * @deprecated Use
     * {@link #JspTilesRequestContext(TilesRequestContext, PageContext)}.
     */
    @Deprecated
    public JspTilesRequestContext(ServletContext context, PageContext pageContext) {
        this(new ServletTilesRequestContext(context,
                (HttpServletRequest) pageContext.getRequest(),
                (HttpServletResponse) pageContext.getResponse()), pageContext);
    }
View Full Code Here


        HttpServletResponse response = EasyMock
                .createMock(HttpServletResponse.class);
        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"))
View Full Code Here

    @Override
    public void execute(TilesRequestContext tilesContext,
            AttributeContext attributeContext) {

        if (tilesContext instanceof ServletTilesRequestContext) {
            ServletTilesRequestContext servletTilesContext =
                (ServletTilesRequestContext) tilesContext;
            HttpServletRequest request = servletTilesContext.getRequest();
            HttpServletResponse response = servletTilesContext.getResponse();
            ServletContext servletContext = (ServletContext) servletTilesContext
                    .getContext();
            RequestDispatcher rd = servletContext.getRequestDispatcher(url);
            if (rd == null) {
                throw new PreparerException(
                    "Controller can't find url '" + url + "'.");
View Full Code Here

     * @deprecated Use
     * {@link #JspTilesRequestContext(TilesRequestContext, PageContext)}.
     */
    @Deprecated
    public JspTilesRequestContext(ServletContext context, PageContext pageContext) {
        this(new ServletTilesRequestContext(context,
                (HttpServletRequest) pageContext.getRequest(),
                (HttpServletResponse) pageContext.getResponse()), pageContext);
    }
View Full Code Here

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

        EasyMock.expect(request.getRequestDispatcher("/my/url.do"))
View Full Code Here

    @Override
    public void write(Object value, Attribute attribute,
            TilesRequestContext request) throws IOException {
        if (value != null) {
            if (value instanceof String) {
                ServletTilesRequestContext servletRequest = ServletUtil.getServletRequest(request);
                // then get a context
                Context context = velocityView.createContext(servletRequest
                        .getRequest(), servletRequest.getResponse());

                // get the template
                Template template = velocityView.getTemplate((String) value);

                // merge the template and context into the writer
View Full Code Here

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

        EasyMock.expect(request.getRequestDispatcher("/my/url.do"))
View Full Code Here

            }
            TilesRequestContext enclosedRequest;
            if (parent != null) {
                enclosedRequest = parent.createRequestContext(context, request, response);
            } else {
                enclosedRequest = new ServletTilesRequestContext(context, request, response);
            }
            return new VelocityTilesRequestContext(enclosedRequest,
                    ctx, writer);
        } else if (requestItems.length == 1
            && requestItems[0] instanceof VelocityTilesRequestContext) {
View Full Code Here

            TilesRequestContext enclosedRequest;
            if (parent != null) {
                enclosedRequest = parent.createRequestContext(context, request,
                        response);
            } else {
                enclosedRequest = new ServletTilesRequestContext(context,
                        (HttpServletRequest) request,
                        (HttpServletResponse) response);
            }
            return new JspTilesRequestContext(enclosedRequest, pageContext);
        }
View Full Code Here

    @Override
    public void write(Object value, Attribute attribute,
            TilesRequestContext request) throws IOException {
        if (value != null) {
            if (value instanceof String) {
                ServletTilesRequestContext servletRequest = ServletUtil.getServletRequest(request);
                HttpServletRequest httpRequest = servletRequest.getRequest();
                HttpServletResponse httpResponse = servletRequest.getResponse();
                servlet.setValue((String) value);
                try {
                    servlet.doGet(httpRequest,
                            new ExternalWriterHttpServletResponse(httpResponse,
                                    request.getPrintWriter()));
View Full Code Here

TOP

Related Classes of org.apache.tiles.servlet.context.ServletTilesRequestContext

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.