Java Code Examples for net.lightbody.bmp.core.har.HarEntry#getRequest()
The following examples show how to use
net.lightbody.bmp.core.har.HarEntry#getRequest() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContentTabHolder.java From CapturePacket with MIT License | 6 votes |
private List<? extends INameValue> getOverViewList(HarEntry harEntry) { ArrayList<HarNameValuePair> pairs = new ArrayList<>(); HarRequest harRequest = harEntry.getRequest(); HarResponse harResponse = harEntry.getResponse(); if (harRequest != null) { String url = harRequest.getUrl(); try { url = URLDecoder.decode(url, "utf-8"); } catch (Exception e) { e.printStackTrace(); } pairs.add(new HarNameValuePair("URL", url)); pairs.add(new HarNameValuePair("Method", harRequest.getMethod())); } if (harResponse != null) { pairs.add(new HarNameValuePair("Code", harResponse.getStatus() + "")); pairs.add(new HarNameValuePair("Size", harResponse.getBodySize() + "Bytes")); } pairs.add(new HarNameValuePair("TotalTime", harEntry.getTime() + "ms")); return pairs; }
Example 2
Source File: ClosestHarEntryElectorImpl.java From bobcat with Apache License 2.0 | 6 votes |
/** * This method returns the most similar entry described by predicate. * It is using and algorithm, that filters all requests that doesn't have match with url prefix * and finds the best parameters match by checking how many parameters have the same value that * predicate defines. The most similar request is elected to being the best match. However, if * all requests will be filtered, then null is returned. * * @param harEntries List of entries to be searched * @return bestEntry The most similar entry or null if no request's url match url prefix */ @Override public HarEntry findSimilarEntry(List<HarEntry> harEntries) { HarEntry bestEntry = null; int bestScore = 0; List<HarEntry> matchingUrl = findEntriesWithUrl(predicate, harEntries); for (HarEntry harEntry : matchingUrl) { QueryStringParameters parametrizable = new QueryStringParameters(harEntry.getRequest()); int harEntryScore = predicate.calculateScore(parametrizable.retrieve()); if (harEntryScore > bestScore) { bestScore = harEntryScore; bestEntry = harEntry; } } return bestEntry; }
Example 3
Source File: HeadersTabHolder.java From CapturePacket with MIT License | 4 votes |
@Override public void onBindHolder(HarEntry harEntry,String tabText) { HarRequest request = harEntry.getRequest(); HarResponse response = harEntry.getResponse(); mAdapter.setHeaders(request == null ? null :request.getHeaders(),response == null ? null :response.getHeaders()); }
Example 4
Source File: CaptureEntryViewHolder.java From CapturePacket with MIT License | 4 votes |
void setData(HarEntry harEntry,int position,SimpleDateFormat format){ mHarEntry = harEntry; if (mEntryTabDelegate != null && mEntryTabDelegate.mHarEntry == harEntry ) { onClick(mBarView); } else { setDefaultBackground(); } HarRequest request = harEntry.getRequest(); HarResponse response = harEntry.getResponse(); setItemContent(HarEntryViewBar.TYPE_ID,String.valueOf(position)); Date startedDateTime = harEntry.getStartedDateTime(); if (startedDateTime != null) { setItemContent(HarEntryViewBar.TYPE_STARTED_TIME, format.format(startedDateTime)); } else { setItemContent(HarEntryViewBar.TYPE_STARTED_TIME, ""); } if (request != null) { setItemContent(HarEntryViewBar.TYPE_METHOD,request.getMethod()); String url = request.getUrl(); if (url != null) { Uri uri = Uri.parse(url); setItemContent(HarEntryViewBar.TYPE_HOST,uri.getHost()); setItemContent(HarEntryViewBar.TYPE_PATH,uri.getPath()); }else { setItemContent(HarEntryViewBar.TYPE_HOST,""); setItemContent(HarEntryViewBar.TYPE_PATH,""); } } else { setItemContent(HarEntryViewBar.TYPE_METHOD,""); setItemContent(HarEntryViewBar.TYPE_HOST,""); setItemContent(HarEntryViewBar.TYPE_PATH,""); } if (response != null) { setItemContent(HarEntryViewBar.TYPE_STATUS,String.valueOf(response.getStatus())); setItemContent(HarEntryViewBar.TYPE_TOTAL_SIZE,response.getBodySize()+ " bytes"); setItemContent(HarEntryViewBar.TYPE_TOTAL_TIME,harEntry.getTime() + "ms"); } else { setItemContent(HarEntryViewBar.TYPE_STATUS,""); setItemContent(HarEntryViewBar.TYPE_TOTAL_SIZE,""); setItemContent(HarEntryViewBar.TYPE_TOTAL_TIME,""); } }