Package javax.servlet

Examples of javax.servlet.RequestDispatcher.include()


   
    // The source is dynamically generated
    RequestDispatcher dispatcher = request.getRequestDispatcher(xmlPath);
    SlingGeneratorServletOutputStream output = new SlingGeneratorServletOutputStream();
    ServletResponse newResponse = new SlingGeneratorServletResponse(response, output);
    dispatcher.include(request, newResponse);
    byte[] bytes = output.toByteArray();
    if (bytes.length > 0)
      return new ByteArrayInputStream(bytes);
   
    return null;
View Full Code Here


            public String getServletPath() {
                return "";
            }
        };

        rd.include(wrapped, resp);
    }
}
View Full Code Here

    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

                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

                    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

                        // Forward to the index
                        RequestDispatcher dispatcher=request.getRequestDispatcher(ipath);
                        if (dispatcher!=null)
                        {
                            if (included.booleanValue())
                                dispatcher.include(request,response);
                            else
                            {
                                request.setAttribute("org.mortbay.jetty.welcome",ipath);
                                dispatcher.forward(request,response);
                            }
View Full Code Here

    if (rd == null) {
      response.appendBody("Template not found: "+template);
      return;
    }
    try {
      rd.include(request, response);
    } catch (Exception ex) {
//      Logger.getLogger().log("Error while processing template: "+ex.toString(), Logger.LEVEL_WARNING);
      response.appendBody("Failed to read template: "+ex.toString());
    }
  }
View Full Code Here

            }
            ByteArrayServletOutputStream basos =
                new ByteArrayServletOutputStream();
            ResponseIncludeWrapper responseIncludeWrapper =
                new ResponseIncludeWrapper(context, req, res, basos);
            rd.include(req, responseIncludeWrapper);
            //We can't assume the included servlet flushed its output
            responseIncludeWrapper.flushOutputStreamOrWriter();
            byte[] bytes = basos.toByteArray();

            //Assume platform default encoding unless otherwise specified
View Full Code Here

        try
        {
            _pageContext.getOut().flush();

            dispatcher.include(request, _pageContext.getResponse());
        }
        catch (IOException ex)
        {
            throw new JspException(
                Tapestry.format("URLRetriever.io-exception", servletPath, ex.getMessage()));
View Full Code Here

            throw new IOException("No request dispatcher returned for path '"
                    + path + "'");
        }

        try {
            rd.include(request, response);
        } catch (ServletException ex) {
            throw ServletUtil.wrapServletException(ex, "ServletException including path '"
                    + path + "'.");
        }
    }
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.