MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / getContentType

Method getContentType

src/main/java/org/htmlunit/WebResponse.java:142–153  ·  view source on GitHub ↗

Returns the content type returned from the server, e.g. "text/html". @return the content type returned from the server, e.g. "text/html"

()

Source from the content-addressed store, hash-verified

140 * @return the content type returned from the server, e.g. "text/html"
141 */
142 public String getContentType() {
143 final String contentTypeHeader = getResponseHeaderValue(HttpHeader.CONTENT_TYPE_LC);
144 if (contentTypeHeader == null) {
145 // Not technically legal but some servers don't return a content-type
146 return "";
147 }
148 final int index = contentTypeHeader.indexOf(';');
149 if (index == -1) {
150 return contentTypeHeader;
151 }
152 return contentTypeHeader.substring(0, index);
153 }
154
155 /**
156 * Returns the content charset specified explicitly in the {@code Content-Type} header

Callers 10

basicMethod · 0.95
getContentCharsetMethod · 0.95
loadAndExecuteMethod · 0.95
getWebResponseMethod · 0.95
loadJavaScriptFromUrlMethod · 0.95
loadStylesheetMethod · 0.95
getResponseMethod · 0.95

Calls 3

substringMethod · 0.80
indexOfMethod · 0.45