Package org.gatein.wci

Examples of org.gatein.wci.RequestDispatchCallback


    @Override
    public void dispatch(ServletContext target, HttpServletRequest request, HttpServletResponse response,
            final Callable callable) throws Exception {
        ServletContainer container = ServletContainerFactory.getServletContainer();
        container.include(target, request, response, new RequestDispatchCallback() {
            @Override
            public Object doCallback(ServletContext dispatchedServletContext, HttpServletRequest dispatchedRequest,
                    HttpServletResponse dispatchedResponse, Object handback) throws ServletException, IOException {
                callable.call(dispatchedServletContext, dispatchedRequest, dispatchedResponse);
View Full Code Here


      HttpServletRequest request,
      HttpServletResponse response,
      final Callable callable) throws Exception
   {
      ServletContainer container = ServletContainerFactory.getServletContainer();
      container.include(target, request, response, new RequestDispatchCallback()
      {
         @Override
         public Object doCallback(
            ServletContext dispatchedServletContext,
            HttpServletRequest dispatchedRequest,
View Full Code Here

      {
         throw new ServletException("Could not find the app to dispatch to");
      }

      //
      container.include(app.getServletContext(), req, resp, new RequestDispatchCallback()
      {
         @Override
         public Object doCallback(ServletContext dsc, HttpServletRequest req, HttpServletResponse resp, Object handback) throws ServletException, IOException
         {
            return null;
View Full Code Here

      //
      session = req.getSession();
      String id = session.getId();

      //
      String dispatchedId = (String)container.include(app.getServletContext(), req, resp, new RequestDispatchCallback()
      {
         @Override
         public Object doCallback(ServletContext dispatchedCtx, HttpServletRequest dispatchedReq, HttpServletResponse dispatchedResp, Object handback) throws ServletException, IOException
         {
            if (dispatchedReq.getSession(false) != null)
            {
               throw new ServletException("Was not expecting a session to exist");
            }
            HttpSession dispatchedSession = dispatchedReq.getSession();
            dispatchedSession.setAttribute("payload", "foo");
            return dispatchedSession.getId();
         }
      }, null);

      //
      if (!id.equals(dispatchedId))
      {
         throw new ServletException("Was expecting session ids to be the same");
      }

      // Check we find the same value
      String payload = (String)container.include(app.getServletContext(), req, resp, new RequestDispatchCallback()
      {
         @Override
         public Object doCallback(ServletContext dispatchedCtx, HttpServletRequest dispatchedReq, HttpServletResponse dispatchedResp, Object handback) throws ServletException, IOException
         {
            HttpSession dispatchedSession = dispatchedReq.getSession();
            return dispatchedSession.getAttribute("payload");
         }
      }, null);
      if (!"foo".equals(payload))
      {
         throw new ServletException("Was expecting a foo payload instead of " + payload);
      }

      // Now logout
      container.logout(req, resp);

      //
      payload = (String)container.include(app.getServletContext(), req, resp, new RequestDispatchCallback()
      {
         @Override
         public Object doCallback(ServletContext dispatchedCtx, HttpServletRequest dispatchedReq, HttpServletResponse dispatchedResp, Object handback) throws ServletException, IOException
         {
            HttpSession dispatchedSession = dispatchedReq.getSession();
View Full Code Here

TOP

Related Classes of org.gatein.wci.RequestDispatchCallback

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.