}
private void addHistory(HttpMessage msg, int type) {
HistoryReference historyRef = null;
try {
historyRef = new HistoryReference(model.getSession(), type, msg);
} catch (Exception e) {
return;
}
if (type != HistoryReference.TYPE_MANUAL && type != HistoryReference.TYPE_HIDDEN) {
return;
}
// add history to list (log panel). Must use event queue because this proxylistener may not be run from event queue.
synchronized(historyList) {
if (type == HistoryReference.TYPE_MANUAL) {
if (pattern == null) {
addHistoryInEventQueue(historyRef);
} else {
StringBuffer sb = new StringBuffer();
sb.append(msg.getRequestHeader().toString());
sb.append(msg.getRequestBody().toString());
if (!msg.getResponseHeader().isEmpty()) {
sb.append(msg.getResponseHeader().toString());
sb.append(msg.getResponseBody().toString());
}
if (pattern.matcher(sb.toString()).find()) {
addHistoryInEventQueue(historyRef);
}
}
}
}
// add history to site panel. Must use event queue because this proxylistener may not be run from event queue.
final HistoryReference ref = historyRef;
final HttpMessage finalMsg = msg;
if (EventQueue.isDispatchThread()) {
model.getSession().getSiteTree().addPath(ref, msg);
if (isFirstAccess) {
isFirstAccess = false;