Search in sources :

Example 1 with HttpCode3xxEntry

use of com.att.aro.core.bestpractice.pojo.HttpCode3xxEntry in project VideoOptimzer by attdevsupport.

the class BpConnectionsHttp3xxTablePanel method getContentTable.

/**
 * Initializes and returns the RequestResponseTable.
 */
@SuppressWarnings("unchecked")
public DataTable<HttpCode3xxEntry> getContentTable() {
    if (contentTable == null) {
        contentTable = new DataTable<HttpCode3xxEntry>(tableModel);
        contentTable.setName(ResourceBundleHelper.getMessageString("connections.301.302.response.tableName"));
        contentTable.setAutoCreateRowSorter(true);
        contentTable.setGridColor(Color.LIGHT_GRAY);
        contentTable.setRowHeight(ROW_HEIGHT);
        contentTable.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
        DataTablePopupMenu popupMenu = (DataTablePopupMenu) contentTable.getPopup();
        popupMenu.initialize();
    }
    return contentTable;
}
Also used : DataTablePopupMenu(com.att.aro.ui.model.DataTablePopupMenu) HttpCode3xxEntry(com.att.aro.core.bestpractice.pojo.HttpCode3xxEntry)

Example 2 with HttpCode3xxEntry

use of com.att.aro.core.bestpractice.pojo.HttpCode3xxEntry in project VideoOptimzer by attdevsupport.

the class Http3xxCodeImpl method runTest.

@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
    Http3xxCodeResult result = new Http3xxCodeResult();
    SortedMap<Integer, Integer> httpRedirectCounts3XX = new TreeMap<Integer, Integer>();
    Map<Integer, HttpRequestResponseInfo> firstResMap = new HashMap<Integer, HttpRequestResponseInfo>();
    List<HttpCode3xxEntry> httprescodelist = new ArrayList<HttpCode3xxEntry>();
    HttpRequestResponseInfo lastRequestObj = null;
    for (Session session : tracedata.getSessionlist()) {
        lastRequestObj = null;
        for (HttpRequestResponseInfo req : session.getRequestResponseInfo()) {
            if (req.getDirection() == HttpDirection.REQUEST) {
                lastRequestObj = req;
            }
            if (req.getDirection() == HttpDirection.RESPONSE && HttpRequestResponseInfo.HTTP_SCHEME.equals(req.getScheme()) && req.getStatusCode() >= 300 && req.getStatusCode() < 400) {
                Integer code = req.getStatusCode();
                Integer count = httpRedirectCounts3XX.get(code);
                if (count != null) {
                    httpRedirectCounts3XX.put(code, count + 1);
                } else {
                    httpRedirectCounts3XX.put(code, 1);
                    firstResMap.put(code, req);
                }
                httprescodelist.add(new HttpCode3xxEntry(req, lastRequestObj, session.getDomainName()));
            }
        }
    }
    if (httpRedirectCounts3XX.isEmpty()) {
        result.setResultType(BPResultType.PASS);
        result.setResultText(textResultPass);
        result.setResultExcelText(BPResultType.PASS.getDescription());
    } else {
        result.setResultType(BPResultType.FAIL);
        result.setResultText(Http3xx4xxHelper.createFailResult(httpRedirectCounts3XX, textResults, errorPlural, errorSingular));
        result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.FAIL.getDescription(), Http3xx4xxHelper.formatErrorCodesToText(httpRedirectCounts3XX)));
    }
    result.setAboutText(aboutText);
    result.setDetailTitle(detailTitle);
    result.setLearnMoreUrl(learnMoreUrl);
    result.setOverviewTitle(overviewTitle);
    result.setExportAllHttpError(exportAllHttpError);
    result.setHttp3xxResCode(httprescodelist);
    result.setHttpRedirectCounts3XX(httpRedirectCounts3XX);
    result.setFirstResMap(firstResMap);
    return result;
}
Also used : HashMap(java.util.HashMap) HttpRequestResponseInfo(com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo) ArrayList(java.util.ArrayList) Http3xxCodeResult(com.att.aro.core.bestpractice.pojo.Http3xxCodeResult) TreeMap(java.util.TreeMap) HttpCode3xxEntry(com.att.aro.core.bestpractice.pojo.HttpCode3xxEntry) Session(com.att.aro.core.packetanalysis.pojo.Session)

Aggregations

HttpCode3xxEntry (com.att.aro.core.bestpractice.pojo.HttpCode3xxEntry)2 Http3xxCodeResult (com.att.aro.core.bestpractice.pojo.Http3xxCodeResult)1 HttpRequestResponseInfo (com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo)1 Session (com.att.aro.core.packetanalysis.pojo.Session)1 DataTablePopupMenu (com.att.aro.ui.model.DataTablePopupMenu)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 TreeMap (java.util.TreeMap)1