use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class RequestResponseDetailsPanel method getJRequestResponseTable.
/**
* Initializes and returns the the DataTable that contains Http request and
* response informations.
*/
public DataTable<HttpRequestResponseInfo> getJRequestResponseTable() {
if (jRequestResponseTable == null) {
jRequestResponseTable = new DataTable<HttpRequestResponseInfo>(jRequestResponseTableModel);
jRequestResponseTable.setName(ResourceBundleHelper.getMessageString("diagnostics.request.response.view.tableName"));
jRequestResponseTable.setAutoCreateRowSorter(true);
jRequestResponseTable.setGridColor(Color.LIGHT_GRAY);
DataTablePopupMenu popupMenu = (DataTablePopupMenu) jRequestResponseTable.getPopup();
popupMenu.initialize();
jRequestResponseTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent event) {
// Enable view and save as buttons appropriately
HttpRequestResponseInfo httpRRInfo = jRequestResponseTable.getSelectedItem();
boolean validResponse = httpRRInfo != null && httpRRInfo.getContentLength() > 0 && httpRRInfo.getDirection() == HttpDirection.RESPONSE && httpRRInfo.getStatusCode() != 0;
boolean isVideo = (validResponse) ? ((httpRRInfo != null && httpRRInfo.getContentType() != null) ? httpRRInfo.getContentType().contains("video/") : false) : false;
boolean isApplicationZip = httpRRInfo != null && httpRRInfo.getContentType() != null && httpRRInfo.getContentType().contains("application/zip");
boolean isContentTypeAvailable = httpRRInfo != null && httpRRInfo.getContentType() != null;
getViewBtn().setEnabled(!isApplicationZip && !isVideo && validResponse && isContentTypeAvailable);
getSaveBtn().setEnabled(!isApplicationZip && validResponse && isContentTypeAvailable);
}
});
jRequestResponseTable.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent event) {
if (event.getClickCount() == 2 && getViewBtn().isEnabled()) {
try {
viewContent(jRequestResponseTable.getSelectedItem());
} catch (Exception e) {
LOG.error("Failed to open the content in the view window with unexpected error", e);
new MessageDialogFactory().showPlainDialog(RequestResponseDetailsPanel.this.getTopLevelAncestor(), ResourceBundleHelper.getMessageString("view.requestresponsedetails.error.Message"), ResourceBundleHelper.getMessageString("view.requestresponsedetails.error.Title"));
}
}
}
});
}
return jRequestResponseTable;
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class ExportSessionData method getRequestResponseData.
private List<List<Object>> getRequestResponseData() {
List<List<Object>> requestResponseData = new ArrayList<>();
sessionMap.forEach((sessionKey, sessionData) -> {
for (HttpRequestResponseInfo httpRequestResponseInfo : reqRespMap.get(sessionKey)) {
List<Object> data = new ArrayList<>(sessionData);
data.add(httpRequestResponseInfo.getTimeStamp());
data.add(httpRequestResponseInfo.getDirection());
if (httpRequestResponseInfo.getDirection() == HttpDirection.REQUEST) {
String type = httpRequestResponseInfo.getRequestType();
data.add(type != null ? type : ResourceBundleHelper.getMessageString("rrview.unknownType"));
} else {
data.add(httpRequestResponseInfo.getStatusCode() != 0 ? httpRequestResponseInfo.getStatusCode() : ResourceBundleHelper.getMessageString("rrview.unknownType"));
}
if (httpRequestResponseInfo.getDirection() == HttpDirection.REQUEST) {
data.add(httpRequestResponseInfo.getHostName());
} else {
data.add(httpRequestResponseInfo.getContentType());
}
if (httpRequestResponseInfo.getDirection() == HttpDirection.REQUEST) {
data.add(StringUtils.isNotEmpty(httpRequestResponseInfo.getObjName()) ? httpRequestResponseInfo.getObjName() : httpRequestResponseInfo.getContentLength());
} else {
data.add(httpRequestResponseInfo.getContentLength());
}
data.add(httpRequestResponseInfo.getRawSize());
data.add(getHttpCompression(httpRequestResponseInfo));
requestResponseData.add(data);
}
});
return requestResponseData;
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class ImageMetaDataImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
ImageMdtaResult result = new ImageMdtaResult();
List<String> imageList = new ArrayList<String>();
List<ImageMdataEntry> entrylist = new ArrayList<ImageMdataEntry>();
String imagePath = tracedata.getTraceresult().getTraceDirectory() + System.getProperty("file.separator") + "Image" + System.getProperty("file.separator");
if (Util.isFilesforAnalysisAvailable(new File(imagePath))) {
for (Session session : tracedata.getSessionlist()) {
for (HttpRequestResponseInfo req : session.getRequestResponseInfo()) {
if (req.getDirection() == HttpDirection.RESPONSE && req.getContentType() != null && req.getContentType().contains("image/")) {
String extractedImageName = ImageHelper.extractFullNameFromRRInfo(req);
int pos = extractedImageName.lastIndexOf('.') + 1;
// List<String> imageList = new ArrayList<String>();
File folder = new File(imagePath);
File[] listOfFiles = folder.listFiles();
if (listOfFiles != null) {
runTestForFiles(imageList, entrylist, session, req, imagePath, extractedImageName, pos, listOfFiles);
}
}
}
}
result.setResults(entrylist);
String text = "";
if (entrylist.isEmpty()) {
result.setResultType(BPResultType.PASS);
text = MessageFormat.format(textResultPass, entrylist.size());
result.setResultText(text);
result.setResultExcelText(BPResultType.PASS.getDescription());
} else {
result.setResultType(BPResultType.FAIL);
text = MessageFormat.format(textResults, ApplicationConfig.getInstance().getAppShortName(), entrylist.size());
result.setResultText(text);
result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.FAIL.getDescription(), entrylist.size()));
}
} else {
result.setResultText(noData);
result.setResultExcelText(BPResultType.NO_DATA.getDescription());
result.setResultType(BPResultType.NO_DATA);
}
result.setAboutText(aboutText);
result.setDetailTitle(detailTitle);
result.setLearnMoreUrl(learnMoreUrl);
result.setOverviewTitle(overviewTitle);
result.setExportNumberOfMdataImages(String.valueOf(entrylist.size()));
return result;
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class ImageUIComparatorImpl method getImageList.
private void getImageList() {
String originalImageName = "";
long orgImageSize = 0L;
String imgExtn = "";
for (Session session : tracedataResult.getSessionlist()) {
for (HttpRequestResponseInfo reqResp : session.getRequestResponseInfo()) {
if (reqResp.getDirection() == HttpDirection.RESPONSE && reqResp.getContentType() != null && reqResp.getContentType().contains("image/")) {
originalImageName = Util.extractFullNameFromRequest(reqResp);
if (!originalImageName.isEmpty()) {
File orgImage = new File(imageFolderPath + originalImageName);
orgImageSize = orgImage.length();
int pos = originalImageName.lastIndexOf(".");
imgExtn = originalImageName.substring(pos + 1, originalImageName.length());
if (orgImageSize > 0 && Util.isJPG(orgImage, imgExtn)) {
updateOriginalImageDimensionMap(originalImageName, imgExtn, pos, reqResp);
}
}
}
}
}
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class ImageFormatImpl method getEntryList.
private List<ImageMdataEntry> getEntryList() {
String originalImage = "";
long convertedImgSize = 0L;
long orgImageSize = 0L;
String imgExtn = "";
long orgImgSize;
long convImageSize;
String convImage = "";
String convertedImagesFolderPath = "";
List<ImageMdataEntry> imgEntryList = new ArrayList<ImageMdataEntry>();
for (Session session : tracedataResult.getSessionlist()) {
for (HttpRequestResponseInfo reqResp : session.getRequestResponseInfo()) {
if (reqResp.getDirection() == HttpDirection.RESPONSE && reqResp.getContentType() != null && reqResp.getContentType().contains("image/")) {
originalImage = ImageHelper.extractFullNameFromRRInfo(reqResp);
if ((!originalImage.isEmpty() && !(originalImage.contains(".jpeg") || originalImage.contains(".jpg"))) && reqResp.getContentType().contains("jpeg")) {
originalImage = Util.parseImageName(originalImage, reqResp);
}
File orgImage = new File(imageFolderPath + originalImage);
orgImageSize = orgImage.length();
int pos = originalImage.lastIndexOf(".");
imgExtn = originalImage.substring(pos + 1, originalImage.length());
if (orgImageSize > 0 && Util.isJPG(orgImage, imgExtn)) {
convertedImagesFolderPath = imageFolderPath + "Format" + System.getProperty("file.separator");
convImage = convertedImagesFolderPath + originalImage.substring(0, originalImage.lastIndexOf(".") + 1) + convExtn;
convertedImgSize = new File(convImage).length();
long indSavings = (orgImageSize - convertedImgSize) * 100 / orgImageSize;
if (convertedImgSize > 0 && (indSavings >= 15)) {
orginalImagesSize = orginalImagesSize + orgImageSize;
convImgsSize = convImgsSize + convertedImgSize;
orgImgSize = orgImageSize / 1024;
convImageSize = convertedImgSize / 1024;
imgEntryList.add(new ImageMdataEntry(reqResp, session.getDomainName(), imageFolderPath + originalImage, orgImgSize, convImageSize, Long.toString(indSavings)));
}
}
}
}
}
return imgEntryList;
}
Aggregations