new ContentHandler() {
@Override
public boolean onBeforeReadResponse(HttpClientRequest request) {
AgpDPart oThis = AgpDPart.this;
ResponseInfo info = request.getResponseInfo();
Header h;
String s;
s = "responseContentLength "+info.getContentLength();
AgpDPart.LOGGER.finest("onBeforeReadResponse "+s);
h = info.getResponseHeader("Content-Type");
if (h != null) {
HeaderElement elements[] = h.getElements();
// Expect only one header element to be there, no more, no less
if (elements.length == 1) {
String sContentType = elements[0].getName();
String sCharset = null;
NameValuePair nvp = elements[0].getParameterByName("charset");
if (nvp != null) {
sCharset = nvp.getValue();
}
oThis.setContentType(sContentType);
oThis.setCharset(sCharset);
s = "contentType="+sContentType+" charset="+sCharset;
AgpDPart.LOGGER.finest("onBeforeReadResponse "+s);
}
}
h = info.getResponseHeader("Content-Disposition");
if (h != null) {
HeaderElement elements[] = h.getElements();
for (HeaderElement element: elements) {
NameValuePair[] params = element.getParameters();
for (NameValuePair param: params) {