@Override public WebResponse getServletResponse() throws IOException { try { Field _webResponse = getAccessibleField(getClass(), "_webResponse"); boolean newWebResponse = _webResponse.get(this) == null; super.getServletResponse(); if (newWebResponse) { _webResponse.set(this, new PatchedServletUnitWebResponse( // getFieldValue(this, "_client", ServletUnitClient.class), // getFieldValue(this, "_frame", FrameSelector.class), // getFieldValue(this, "_effectiveURL", URL.class), // getResponse(), getFieldValue(this, "_client", ServletUnitClient.class) .getExceptionsThrownOnErrorStatus())); } return (WebResponse) _webResponse.get(this); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } }
@Override public WebResponse getServletResponse() throws IOException { try { Field _webResponse = getAccessibleField(getClass(), "_webResponse"); boolean newWebResponse = _webResponse.get(this) == null; super.getServletResponse(); if (newWebResponse) { _webResponse.set(this, new PatchedServletUnitWebResponse( // getFieldValue(this, "_client", ServletUnitClient.class), // getFieldValue(this, "_frame", FrameSelector.class), // getFieldValue(this, "_effectiveURL", URL.class), // getResponse(), getFieldValue(this, "_client", ServletUnitClient.class) .getExceptionsThrownOnErrorStatus())); } return (WebResponse) _webResponse.get(this); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } }
/** * 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; }