use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class ScriptsImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
ScriptsResult result = new ScriptsResult();
for (Session session : tracedata.getSessionlist()) {
for (HttpRequestResponseInfo req : session.getRequestResponseInfo()) {
if (req.getDirection() == HttpDirection.RESPONSE && req.getContentLength() > 0 && req.getContentType() != null && reqhelper.isHtml(req.getContentType())) {
result = analyzeHtml(req, session, result);
}
}
}
String text = "";
if (result.getFirstFailedHtml() == null) {
result.setResultType(BPResultType.PASS);
text = MessageFormat.format(textResultPass, result.getNumberOfFailedFiles());
result.setResultText(text);
result.setResultExcelText(BPResultType.PASS.getDescription());
} else {
result.setResultType(BPResultType.FAIL);
text = MessageFormat.format(textResults, ApplicationConfig.getInstance().getAppShortName(), result.getNumberOfFailedFiles());
result.setResultText(text);
result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.FAIL.getDescription(), result.getNumberOfFailedFiles()));
}
result.setAboutText(aboutText);
result.setDetailTitle(detailTitle);
result.setLearnMoreUrl(learnMoreUrl);
result.setOverviewTitle(overviewTitle);
result.setExportAllNumberOfScriptsFiles(exportAllNumberOfScriptsFiles);
return result;
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class Http4xx5xxImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
Http4xx5xxResult result = new Http4xx5xxResult();
Map<Integer, HttpRequestResponseInfo> firstErrorRespMap4XX = new HashMap<Integer, HttpRequestResponseInfo>();
SortedMap<Integer, Integer> httpErrorCounts4XX = new TreeMap<Integer, Integer>();
List<Http4xx5xxStatusResponseCodesEntry> httpResCodelist = new ArrayList<Http4xx5xxStatusResponseCodesEntry>();
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() >= 400 && req.getStatusCode() < 600) {
Integer code = req.getStatusCode();
Integer count = httpErrorCounts4XX.get(code);
if (count != null) {
httpErrorCounts4XX.put(code, count + 1);
} else {
httpErrorCounts4XX.put(code, 1);
firstErrorRespMap4XX.put(code, req);
}
httpResCodelist.add(new Http4xx5xxStatusResponseCodesEntry(req, lastRequestObj, session.getDomainName()));
}
}
}
if (httpErrorCounts4XX.isEmpty()) {
result.setResultType(BPResultType.PASS);
result.setResultText(textResultPass);
result.setResultExcelText(BPResultType.PASS.getDescription());
} else {
result.setResultType(BPResultType.FAIL);
result.setResultText(Http3xx4xxHelper.createFailResult(httpErrorCounts4XX, textResults, errorPlural, errorSingular));
result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.FAIL.getDescription(), Http3xx4xxHelper.formatErrorCodesToText(httpErrorCounts4XX)));
}
result.setAboutText(aboutText);
result.setDetailTitle(detailTitle);
result.setLearnMoreUrl(learnMoreUrl);
result.setOverviewTitle(overviewTitle);
result.setExportAllHttpError(exportAllHttpError);
result.setFirstErrorRespMap4XX(firstErrorRespMap4XX);
result.setHttpErrorCounts4XX(httpErrorCounts4XX);
result.setHttpResCodelist(httpResCodelist);
return result;
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class ImageCompressionImpl method compressImages.
private void compressImages() {
ExecutorService exec = Executors.newFixedThreadPool(5);
for (final Session session : packetResult.getSessionlist()) {
for (final HttpRequestResponseInfo req : session.getRequestResponseInfo()) {
if (req.getDirection() == HttpDirection.RESPONSE && req.getContentType() != null && req.getContentType().contains("image/")) {
String extractedImage = ImageHelper.extractFullNameFromRRInfo(req);
if ((!extractedImage.isEmpty() && !(extractedImage.contains(".jpeg") || extractedImage.contains(".jpg"))) && req.getContentType().contains("jpeg")) {
extractedImage = Util.parseImageName(extractedImage, req);
}
File imgFile = new File(imageFolderPath + extractedImage);
if (imgFile.exists() && !imgFile.isDirectory()) {
int posExtn = extractedImage.lastIndexOf(".");
String imgExtn = extractedImage.substring(posExtn + 1, extractedImage.length());
if (Util.isJPG(imgFile, imgExtn)) {
final String imageFile = extractedImage;
exec.submit(new Runnable() {
@Override
public void run() {
compressImage(imageFolderPath, imageFile);
}
});
}
}
}
}
}
try {
// Time out after 10 minutes
exec.shutdown();
exec.awaitTermination(10, TimeUnit.MINUTES);
} catch (InterruptedException e) {
LOGGER.error(e.getMessage(), e);
}
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class SimultnsUtil method createDomainsTCPSessions.
public List<SessionValues> createDomainsTCPSessions(Collection<Session> allTCPSessions) {
List<SessionValues> sessionValues = new ArrayList<SessionValues>();
Session lastSession = null;
for (Session aSession : allTCPSessions) {
if (aSession != null) {
if (!aSession.getRequestResponseInfo().isEmpty()) {
for (HttpRequestResponseInfo req : aSession.getRequestResponseInfo()) {
sessionValues = addSessionValues(sessionValues, lastSession, aSession, req);
lastSession = aSession;
}
} else {
HttpRequestResponseInfo reqResp = new HttpRequestResponseInfo();
if (aSession.getRemoteHostName() != null) {
reqResp.setHostName(aSession.getRemoteHostName());
reqResp.setFirstDataPacket(aSession.getTcpPackets().get(0));
}
sessionValues = addSessionValues(sessionValues, lastSession, aSession, reqResp);
}
}
}
return sessionValues;
}
use of com.att.aro.core.packetanalysis.pojo.HttpRequestResponseInfo in project VideoOptimzer by attdevsupport.
the class MultipleConnectionsEntry method assignHostAndHttpInfo.
private void assignHostAndHttpInfo(HttpRequestResponseInfo httpReqResp, String hostName) {
HttpRequestResponseInfo respons = httpReqResp.getAssocReqResp();
if (respons != null) {
if (respons.getHostName() == null || respons.getHostName().isEmpty()) {
if (httpReqResp.getHostName() == null || httpReqResp.getHostName().isEmpty()) {
this.hostName = hostName;
} else {
this.hostName = httpReqResp.getHostName();
}
} else {
this.hostName = respons.getHostName();
}
this.httpReqObjName = respons.getObjName();
} else {
if (httpReqResp.getHostName() == null || httpReqResp.getHostName().isEmpty()) {
this.hostName = hostName;
} else {
this.hostName = httpReqResp.getHostName();
}
}
String hostNameObj = this.hostName;
if (hostNameObj.contains("/")) {
this.hostName = hostNameObj.substring(hostNameObj.lastIndexOf('/') + 1, hostNameObj.length());
}
}
Aggregations