/** * @return value of content-type header */ @Override public String getContentType() { return getHeader("Content-Type"); }
/** * @return value of content-type header */ @Override public String getContentType() { return getHeader("Content-Type"); }
/** * Retrieves the content disposition from the response header. * * @return the content disposition from the response header */ public String getContentDispositionFromResponseHeader() { return getLastResponse().getHeader("Content-Disposition"); }
/** * Retrieves the last-modified value from the response header. * * @return the last-modified value from the response header */ public String getLastModifiedFromResponseHeader() { return getLastResponse().getHeader("Last-Modified"); }
/** * Retrieves the content disposition from the response header. * * @return the content disposition from the response header */ public String getContentDispositionFromResponseHeader() { return getLastResponse().getHeader("Content-Disposition"); }
/** * Retrieves the last-modified value from the response header. * * @return the last-modified value from the response header */ public String getLastModifiedFromResponseHeader() { return getLastResponse().getHeader("Last-Modified"); }
/** * Retrieves the content length from the response header. * * @return the content length from the response header */ public int getContentLengthFromResponseHeader() { String contentLength = getLastResponse().getHeader("Content-Length"); assertNotNull("No Content-Length header found", contentLength); return Integer.parseInt(contentLength); }
/** * Retrieves the content length from the response header. * * @return the content length from the response header */ public int getContentLengthFromResponseHeader() { String contentLength = getLastResponse().getHeader("Content-Length"); assertNotNull("No Content-Length header found", contentLength); return Integer.parseInt(contentLength); }
/** * @return binary response */ public String getBinaryResponse() { String ctheader = getHeader("Content-Length"); if (ctheader == null) { return getDocument(); } else { return getDocument().substring(0, Integer.valueOf(ctheader)); } }
/** * @return binary response */ public String getBinaryResponse() { String ctheader = getHeader("Content-Length"); if (ctheader == null) { return getDocument(); } else { return getDocument().substring(0, Integer.valueOf(ctheader)); } }
/** * Asserts that the Ajax location header is present. */ public void assertAjaxLocation() { if (null != getLastResponse().getHeader("Location")) { fail("Location header should *not* be present when using Ajax"); } String ajaxLocation = getLastResponse().getHeader("Ajax-Location"); if (null == ajaxLocation) { throw new AssertionFailedError("Ajax-Location header should be present when using Ajax"); } int statusCode = getLastResponse().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 != getLastResponse().getHeader("Location")) { fail("Location header should *not* be present when using Ajax"); } String ajaxLocation = getLastResponse().getHeader("Ajax-Location"); if (null == ajaxLocation) { fail("Ajax-Location header should be present when using Ajax"); } int statusCode = getLastResponse().getStatus(); if (statusCode != 200) { fail("Expected HTTP status code to be 200 (OK)"); } }