use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class Util method extractFullNameFromRequest.
/**
* Extracts the object name from the request.
*
* @param hrri
* @return object name
*/
public static String extractFullNameFromRequest(HttpRequestResponseInfo hrri) {
HttpRequestResponseInfo req = hrri.getDirection().equals(HttpDirection.RESPONSE) ? hrri.getAssocReqResp() : hrri;
String extractedName = "";
String objectName = "";
if (req != null) {
String fullPathName = req.getObjName();
if (fullPathName != null) {
objectName = fullPathName.substring(fullPathName.lastIndexOf("/") + 1);
int pos = objectName.lastIndexOf("/") + 1;
extractedName = objectName.substring(pos);
}
}
return extractedName;
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class ImageHelper method extractFullNameFromRRInfo.
public static String extractFullNameFromRRInfo(HttpRequestResponseInfo hrri) {
HttpRequestResponseInfo rsp = hrri.getAssocReqResp();
String extractedImageName = "";
String imageName = "";
if (rsp != null && rsp.getObjName() != null) {
String imagefromReq = rsp.getObjName();
imageName = imagefromReq.substring(imagefromReq.lastIndexOf(Util.FILE_SEPARATOR) + 1);
int pos = imageName.lastIndexOf("/") + 1;
extractedImageName = imageName.substring(pos);
}
return extractedImageName;
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class HttpDelayPanel method getHttpDelayTable.
/**
* Initializes and returns the the DataTable that contains HTTP delay informations.
*/
public DataTable<HttpRequestResponseInfo> getHttpDelayTable() {
if (httpDelayTable == null) {
httpDelayTable = new DataTable<HttpRequestResponseInfo>(httpDelayTableModel);
httpDelayTable.setName(ResourceBundleHelper.getMessageString("diagnostics.delay.view.tableName"));
DataTablePopupMenu popupMenu = (DataTablePopupMenu) httpDelayTable.getPopup();
popupMenu.initialize();
httpDelayTable.setAutoCreateRowSorter(true);
httpDelayTable.setGridColor(Color.LIGHT_GRAY);
TableRowSorter<TableModel> sorter = new TableRowSorter<>(httpDelayTable.getModel());
httpDelayTable.setRowSorter(sorter);
}
return httpDelayTable;
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class CacheAnalysisImpl method handleCacheExpiredCommon.
CacheEntry handleCacheExpiredCommon(Session session, HttpRequestResponseInfo response, HttpRequestResponseInfo request, PacketInfo firstPacket, CacheEntry cacheEntry) {
// Check to see if object changed
HttpRequestResponseInfo cachedResponse = cacheEntry.getResponse();
boolean isTheSame = rrhelper.isSameContent(response, cachedResponse, session, cacheEntry.getSession());
CacheEntry newCacheEntry;
if ((response.getLastModified() != null && cachedResponse.getLastModified() != null && !response.getLastModified().equals(cachedResponse.getLastModified())) || !isTheSame) {
newCacheEntry = new CacheEntry(request, response, Diagnosis.CACHING_DIAG_OBJ_CHANGED, firstPacket);
} else if (response.getStatusCode() == 304) {
newCacheEntry = new CacheEntry(request, response, Diagnosis.CACHING_DIAG_OBJ_NOT_CHANGED_304, firstPacket);
} else {
newCacheEntry = null;
}
return newCacheEntry;
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class CacheAnalysisImpl method cacheExpired.
/**
* Cache Expired status analysis.
*
* @param cacheEntry
* @param timestamp
* @return
*/
private CacheExpiration cacheExpired(CacheEntry cacheEntry, Date timestamp) {
HttpRequestResponseInfo request = cacheEntry.getRequest();
HttpRequestResponseInfo response = cacheEntry.getResponse();
/*
* Cases when an object expires (t=time, s=server, c=client) (1) "no-cache"
* header in request/response (2) t >= s.expire (3) t >= c.date + c.max_age (4)
* t >= s.date + s.max_age (overrides 1) (5) s.age >= s.expire - s.date (6)
* s.age >= s.max_age (overrides 4) (7) s.age >= c.max_age
*/
if (request.isNoCache() || request.isPragmaNoCache() || response.isNoCache() || response.isPragmaNoCache()) {
return CacheExpiration.CACHE_EXPIRED;
} else if (response.getDate() != null && response.getMaxAge() != null && timestamp.getTime() > response.getAbsTimeStamp().getTime() + (response.getMaxAge().longValue() * 1000)) {
return CacheExpiration.CACHE_EXPIRED;
} else if (response.getExpires() != null && !timestamp.before(response.getExpires())) {
return CacheExpiration.CACHE_EXPIRED;
} else if (request.getDate() != null && request.getMaxAge() != null && timestamp.getTime() > request.getAbsTimeStamp().getTime() + (request.getMaxAge().longValue() * 1000)) {
return CacheExpiration.CACHE_EXPIRED;
} else if (response.getAge() != null && response.getMaxAge() != null && response.getAge().longValue() > response.getMaxAge().longValue()) {
return CacheExpiration.CACHE_EXPIRED;
} else if (response.getAge() != null && response.getExpires() != null && response.getDate() != null && (response.getAge().longValue() * 1000) >= response.getExpires().getTime() - response.getDate().getTime()) {
return CacheExpiration.CACHE_EXPIRED;
} else if (response.getAge() != null && request.getMaxAge() != null && response.getAge().longValue() >= request.getMaxAge().longValue()) {
return CacheExpiration.CACHE_EXPIRED;
}
/*
* Cases when an object is not expired (1) t < s.expire (2) t < s.date +
* s.maxage
*/
if (response.getExpires() != null && timestamp.before(response.getExpires())) {
return CacheExpiration.CACHE_NOT_EXPIRED;
} else if (response.getDate() != null && response.getMaxAge() != null && timestamp.getTime() < response.getDate().getTime() + (response.getMaxAge().longValue() * 1000)) {
return CacheExpiration.CACHE_NOT_EXPIRED;
}
long oneDay = 86400000L;
if (response.getDate() != null) {
if (timestamp.getTime() < response.getDate().getTime() + oneDay) {
return CacheExpiration.CACHE_NOT_EXPIRED_HEURISTIC;
} else {
return CacheExpiration.CACHE_EXPIRED_HEURISTIC;
}
}
return CacheExpiration.CACHE_NOT_EXPIRED_HEURISTIC;
}
Aggregations