setJMXMBeanAttribute(mBeanName, attributeName, value);
}
private HttpResponseBean buildHttpResponseBean(HttpResponse httpResponse, String response, Date requestTime, Date responseTime) {
HttpResponseBean httpResponseBean = new HttpResponseBean();
Header[] headersArray = httpResponse.getAllHeaders();
Map<String, String> headersMap = new HashMap<String, String>();
for (Header header: headersArray) {
String[] headerAttributes = header.toString().split(": ");
headersMap.put(headerAttributes[0], headerAttributes[1].replace("\r\n", ""));
}
httpResponseBean.setResponseHeaders(headersMap);
httpResponseBean.setHttpStatusCode(httpResponse.getStatusLine().getStatusCode());
httpResponseBean.setHttpStatusText(httpResponse.getStatusLine().getReasonPhrase());
httpResponseBean.setRequestTime(new Timestamp(requestTime.getTime()));
httpResponseBean.setResponseTime(new Timestamp(responseTime.getTime()));
if ((response != null) && (!response.equalsIgnoreCase(""))) {
httpResponseBean.setResponseObject(response);
} else {
httpResponseBean.setResponseObject(null);
}
return httpResponseBean;
}