Package javax.servlet

Examples of javax.servlet.RequestDispatcher


    replay(injector, binding, requestMock, mockBinding);

    // Have to init the Servlet before we can dispatch to it.
    servletDefinition.init(null, injector, Sets.<HttpServlet>newIdentityHashSet());

    final RequestDispatcher dispatcher = new ManagedServletPipeline(
        injector)
        .getRequestDispatcher(pattern);

    assertNotNull(dispatcher);
    dispatcher.include(requestMock, createMock(HttpServletResponse.class));

    assertTrue("Include did not dispatch to our servlet!", run[0]);

    verify(injector, requestMock, mockBinding);
  }
View Full Code Here


    replay(injector, binding, requestMock, mockResponse, mockBinding);

    // Have to init the Servlet before we can dispatch to it.
    servletDefinition.init(null, injector, Sets.<HttpServlet>newIdentityHashSet());

    final RequestDispatcher dispatcher = new ManagedServletPipeline(injector)
        .getRequestDispatcher(pattern);

    assertNotNull(dispatcher);
    dispatcher.forward(requestMock, mockResponse);

    assertTrue("Include did not dispatch to our servlet!", paths.contains(pattern));

    verify(injector, requestMock, mockResponse, mockBinding);
  }
View Full Code Here

    replay(injector, binding, mockRequest, mockResponse, mockBinding);

    // Have to init the Servlet before we can dispatch to it.
    servletDefinition.init(null, injector, Sets.<HttpServlet>newIdentityHashSet());

    final RequestDispatcher dispatcher = new ManagedServletPipeline(injector)
        .getRequestDispatcher(pattern);

    assertNotNull(dispatcher);

    try {
      dispatcher.forward(mockRequest, mockResponse);
    }
    finally {
      verify(injector, mockRequest, mockResponse, mockBinding);
    }
  }
View Full Code Here

        try {

            request.setAttribute("val", "dispatched");
            String jspPath = (String)appProperties.getProperty(JSP.PATH_PROPERTY);
            RequestDispatcher dispatcher = request.getRequestDispatcher(jspPath + "basic.jsp");
            dispatcher.forward(request, response);

        } catch (Exception e) {
            logger.error("error", e);
        }
    }
View Full Code Here

                    HttpServletResponse response, AppProperties properties)
                    throws ServletException, IOException {

                String jspPath = (String) properties.getProperty(JSP.PATH_PROPERTY);
                request.setAttribute("val", "Included");
                RequestDispatcher dispatcher =
                        request.getRequestDispatcher(jspPath + "basic.jsp");
                dispatcher.include(request, response);
            }
        };
    }
View Full Code Here

                request.setAttribute(key, attributes.get(key));
            }
        }

        String jspPath = (String)properties.getProperty(PATH_PROPERTY);
        RequestDispatcher dispatcher = request.getRequestDispatcher(jspPath + jsp);
        dispatcher.forward(request, response);
    }
View Full Code Here

        @Override
        public RequestDispatcher getRequestDispatcher(String path)
        {
            RequestDispatcherProvider provider = (RequestDispatcherProvider) getAttribute(Dispatcher.REQUEST_DISPATCHER_PROVIDER);
            RequestDispatcher dispatcher = null;
            if (provider != null)
            {
                dispatcher = provider.getRequestDispatcher(path);
            }
            return (dispatcher != null) ? dispatcher : super.getRequestDispatcher(path);
View Full Code Here

                    assertEquals("bar=qux&quu", req.getQueryString());

                    resp.getWriter().println("NOT_SEND");

                    // ServletContext#getRequestDispatcher only takes absolute paths...
                    RequestDispatcher disp = req.getServletContext().getRequestDispatcher("forward");
                    assertNull("ServletContext returned RequestDispatcher for relative path?!", disp);
                    // Causes a request to ourselves being made (/test/forward)...
                    disp = req.getRequestDispatcher("forward");
                    assertNotNull("ServletRequest returned NO RequestDispatcher for relative path?!", disp);

                    disp.forward(req, resp);
                    resp.getWriter().println("NOT_SEND");
                }
            }
        };
View Full Code Here

                    assertEquals("bar=qux&quu", req.getQueryString());

                    resp.getWriter().println("BEFORE");

                    // ServletContext#getRequestDispatcher only takes absolute paths...
                    RequestDispatcher disp = req.getServletContext().getRequestDispatcher("include");
                    assertNull("ServletContext returned RequestDispatcher for relative path?!", disp);
                    // Causes a request to ourselves being made (/test/forward)...
                    disp = req.getRequestDispatcher("include");
                    assertNotNull("ServletRequest returned NO RequestDispatcher for relative path?!", disp);

                    disp.include(req, resp);
                    resp.getWriter().println("AFTER");
                }
            }
        };
View Full Code Here

        if (name == null)
        {
            return null;
        }

        RequestDispatcher dispatcher = this.provider.getNamedDispatcher(name);
        return dispatcher != null ? dispatcher : super.getNamedDispatcher(name);
    }
View Full Code Here

TOP

Related Classes of javax.servlet.RequestDispatcher

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.