Search in sources :

Example 86 with HttpRequestResponseInfo

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;
}
Also used : HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)

Example 87 with HttpRequestResponseInfo

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;
}
Also used : HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)

Example 88 with HttpRequestResponseInfo

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;
}
Also used : HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) DataTablePopupMenu(com.att.aro.ui.model.DataTablePopupMenu) HttpDelayTableModel(com.att.aro.ui.model.diagnostic.HttpDelayTableModel) TableModel(javax.swing.table.TableModel) TableRowSorter(javax.swing.table.TableRowSorter)

Example 89 with HttpRequestResponseInfo

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;
}
Also used : HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) CacheEntry(com.att.aro.core.packetanalysis.pojo.CacheEntry)

Example 90 with HttpRequestResponseInfo

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;
}
Also used : HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)

Aggregations

HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)108 Session (com.att.aro.core.packetanalysis.pojo.Session)74 ArrayList (java.util.ArrayList)62 BaseTest (com.att.aro.core.BaseTest)40 Test (org.junit.Test)40 AbstractBestPracticeResult (com.att.aro.core.bestpractice.pojo.AbstractBestPracticeResult)29 PacketInfo (com.att.aro.core.packetanalysis.pojo.PacketInfo)14 IOException (java.io.IOException)10 HashMap (java.util.HashMap)10 TreeMap (java.util.TreeMap)10 File (java.io.File)9 IHttpRequestResponseHelper (com.att.aro.core.packetanalysis.IHttpRequestResponseHelper)5 TraceDirectoryResult (com.att.aro.core.packetanalysis.pojo.TraceDirectoryResult)5 TCPPacket (com.att.aro.core.packetreader.pojo.TCPPacket)5 URISyntaxException (java.net.URISyntaxException)5 List (java.util.List)5 PacketAnalyzerResult (com.att.aro.core.packetanalysis.pojo.PacketAnalyzerResult)4 RequestResponseTimeline (com.att.aro.core.packetanalysis.pojo.RequestResponseTimeline)4 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 InetAddress (java.net.InetAddress)4