Java Code Examples for net.lightbody.bmp.core.har.HarEntry#getResponse()

The following examples show how to use net.lightbody.bmp.core.har.HarEntry#getResponse() . 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 vote down vote up
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: HeadersTabHolder.java    From CapturePacket with MIT License 4 votes vote down vote up
@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 3
Source File: CaptureEntryViewHolder.java    From CapturePacket with MIT License 4 votes vote down vote up
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,"");
    }
}