cfhttp.set(HTTP_VERSION,(httpMethod.getStatusLine().getHttpVersion()));
//responseHeader
Header[] headers = httpMethod.getResponseHeaders();
StringBuffer raw=new StringBuffer(httpMethod.getStatusLine().toString()+" ");
Struct responseHeader = new StructImpl();
Array setCookie = new ArrayImpl();
for(int i=0;i<headers.length;i++) {
Header header=headers[i];
//print.ln(header);
raw.append(header+" ");
if(header.getName().equalsIgnoreCase("Set-Cookie"))
setCookie.append(header.getValue());
else {
//print.ln(header.getName()+"-"+header.getValue());
Object value=responseHeader.get(KeyImpl.getInstance(header.getName()),null);
if(value==null) responseHeader.set(KeyImpl.getInstance(header.getName()),header.getValue());
else {
Array arr=null;
if(value instanceof Array) {
arr=(Array) value;
}
else {
arr=new ArrayImpl();
responseHeader.set(KeyImpl.getInstance(header.getName()),arr);
arr.appendEL(value);
}
arr.appendEL(header.getValue());
}
}
// Content-Type
if(header.getName().equalsIgnoreCase("Content-Type")) {
mimetype=header.getValue();
if(mimetype==null)mimetype=NO_MIMETYPE;
}
// Content-Encoding
if(header.getName().equalsIgnoreCase("Content-Encoding")) {
contentEncoding=header.getValue();
}
}
cfhttp.set(RESPONSEHEADER,responseHeader);
responseHeader.set(STATUS_CODE,new Double(httpMethod.getStatusCode()));
responseHeader.set(EXPLANATION,(httpMethod.getStatusText()));
if(setCookie.size()>0)responseHeader.set(SET_COOKIE,setCookie);
// is text
boolean isText=
mimetype == null ||
mimetype == NO_MIMETYPE || HTTPUtil.isTextMimeType(mimetype);