String clocation = _getResponseHeader(method, "Content-Location", null);
if (clocation != null)
uri = new URI(clocation); // get the content-location
InputStream in = _getInputStream(method);
Parser parser = Parser.INSTANCE;
ParserOptions parserOptions = parser.getDefaultParserOptions();
MimeType mimeType = _getContentType(method);
if (mimeType != null) {
parserOptions.setCharset(
_getContentType(method).getParameter(
"charset"));
}
Document<T> doc = parser.parse(in, uri, parserOptions);
doc.setContentType(mimeType.toString());