/** * Asserts that the Ajax location header is present. */ public void assertAjaxLocation() { if (null != ((MockHttpServletResponse)getWicketResponse().getHttpServletResponse()).getRedirectLocation()) { throw new AssertionFailedError( "Location header should *not* be present when using Ajax"); } String ajaxLocation = ((MockHttpServletResponse)getWicketResponse().getHttpServletResponse()).getHeader("Ajax-Location"); if (null == ajaxLocation) { throw new AssertionFailedError("Ajax-Location header should be present when using Ajax"); } int statusCode = ((MockHttpServletResponse)getWicketResponse().getHttpServletResponse()).getStatus(); if (statusCode != 200) { throw new AssertionFailedError("Expected HTTP status code to be 200 (OK)"); } }
/** * Asserts that the Ajax location header is present. */ public void assertAjaxLocation() { if (null != ((MockHttpServletResponse)getWicketResponse().getHttpServletResponse()).getRedirectLocation()) { throw new AssertionFailedError( "Location header should *not* be present when using Ajax"); } String ajaxLocation = ((MockHttpServletResponse)getWicketResponse().getHttpServletResponse()).getHeader("Ajax-Location"); if (null == ajaxLocation) { throw new AssertionFailedError("Ajax-Location header should be present when using Ajax"); } int statusCode = ((MockHttpServletResponse)getWicketResponse().getHttpServletResponse()).getStatus(); if (statusCode != 200) { throw new AssertionFailedError("Expected HTTP status code to be 200 (OK)"); } }