/** * Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path. A RequestDispatcher * object can be used to forward a request to the resource or to include the resource in a response. The resource can be dynamic or static. * The pathname must begin with a "/" and is interpreted as relative to the current context root. Use getContext to obtain a * RequestDispatcher for resources in foreign contexts. This method returns null if the ServletContext cannot return a * RequestDispatcher. **/ public javax.servlet.RequestDispatcher getRequestDispatcher( String path ) { try { URL url = new URL( "http", "localhost", _application.getContextPath() + path ); return new RequestDispatcherImpl( _application, url ); } catch (ServletException e) { return null; } catch (MalformedURLException e) { return null; } }
/** * Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path. A RequestDispatcher * object can be used to forward a request to the resource or to include the resource in a response. The resource can be dynamic or static. * The pathname must begin with a "/" and is interpreted as relative to the current context root. Use getContext to obtain a * RequestDispatcher for resources in foreign contexts. This method returns null if the ServletContext cannot return a * RequestDispatcher. **/ public javax.servlet.RequestDispatcher getRequestDispatcher( String path ) { try { URL url = new URL( "http", "localhost", _application.getContextPath() + path ); return new RequestDispatcherImpl( _application, url ); } catch (ServletException e) { return null; } catch (MalformedURLException e) { return null; } }
/** * Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path. A RequestDispatcher * object can be used to forward a request to the resource or to include the resource in a response. The resource can be dynamic or static. * The pathname must begin with a "/" and is interpreted as relative to the current context root. Use getContext to obtain a * RequestDispatcher for resources in foreign contexts. This method returns null if the ServletContext cannot return a * RequestDispatcher. **/ public javax.servlet.RequestDispatcher getRequestDispatcher( String path ) { try { URL url = new URL( "http", "localhost", _application.getContextPath() + path ); return new RequestDispatcherImpl( _application, url ); } catch (ServletException e) { return null; } catch (MalformedURLException e) { return null; } }
/** * Returns the final response from the servlet. Note that this method should * only be invoked after all processing has been done to the servlet response. **/ public WebResponse getServletResponse() throws IOException { if (_contextStack.size() != 1) throw new IllegalStateException( "Have not returned from all request dispatchers" ); if (_webResponse == null) { HttpSession session = getRequest().getSession( /* create */ false ); if (session != null && session.isNew()) { Cookie cookie = new Cookie( ServletUnitHttpSession.SESSION_COOKIE_NAME, session.getId() ); cookie.setPath( _application.getContextPath() ); getResponse().addCookie( cookie ); } _webResponse = new ServletUnitWebResponse( _client, _frame, _effectiveURL, getResponse(), _client.getExceptionsThrownOnErrorStatus() ); } return _webResponse; }
/** * Returns the final response from the servlet. Note that this method should * only be invoked after all processing has been done to the servlet response. **/ public WebResponse getServletResponse() throws IOException { if (_contextStack.size() != 1) throw new IllegalStateException( "Have not returned from all request dispatchers" ); if (_webResponse == null) { HttpSession session = getRequest().getSession( /* create */ false ); if (session != null && session.isNew()) { Cookie cookie = new Cookie( ServletUnitHttpSession.SESSION_COOKIE_NAME, session.getId() ); cookie.setPath( _application.getContextPath() ); getResponse().addCookie( cookie ); } _webResponse = new ServletUnitWebResponse( _client, _frame, _effectiveURL, getResponse(), _client.getExceptionsThrownOnErrorStatus() ); } return _webResponse; }
/** * Returns the final response from the servlet. Note that this method should * only be invoked after all processing has been done to the servlet response. **/ public WebResponse getServletResponse() throws IOException { if (_contextStack.size() != 1) throw new IllegalStateException( "Have not returned from all request dispatchers" ); if (_webResponse == null) { HttpSession session = getRequest().getSession( /* create */ false ); if (session != null && session.isNew()) { Cookie cookie = new Cookie( ServletUnitHttpSession.SESSION_COOKIE_NAME, session.getId() ); cookie.setPath( _application.getContextPath() ); getResponse().addCookie( cookie ); } _webResponse = new ServletUnitWebResponse( _client, _frame, _effectiveURL, getResponse(), _client.getExceptionsThrownOnErrorStatus() ); } return _webResponse; }