Class RequestResponseDocBuilder
TrafficHttpHandler and SitemapIndexReporter.-
Method Summary
Modifier and TypeMethodDescriptionstatic StringbuildBestEffortUrl(burp.api.montoya.http.message.requests.HttpRequest request, burp.api.montoya.http.HttpService service, Map<String, Object> requestDoc, String logPrefix) Resolves the best-effort request URL for top-level traffic documents.buildRequestDoc(burp.api.montoya.http.message.requests.HttpRequest request) Builds a request sub-document matching the traffic index request shape.buildResponseDoc(burp.api.montoya.http.message.responses.HttpResponse response) Builds a response sub-document matching the traffic index response shape.static StringsafeRequestUrl(burp.api.montoya.http.message.requests.HttpRequest request, String logPrefix) ReturnsHttpRequest.url()when available, ornullwhen Montoya throws.
-
Method Details
-
buildRequestDoc
public static Map<String,Object> buildRequestDoc(burp.api.montoya.http.message.requests.HttpRequest request) Builds a request sub-document matching the traffic index request shape.Body bytes are always stored as full base64 in
body.b64for exact replay. When the payload is classified as textual,body.textcontains the full decoded text.- Parameters:
request- the HTTP request (never null)- Returns:
- map with method, path, headers, parameters, and body content fields.
-
buildBestEffortUrl
public static String buildBestEffortUrl(burp.api.montoya.http.message.requests.HttpRequest request, burp.api.montoya.http.HttpService service, Map<String, Object> requestDoc, String logPrefix) Resolves the best-effort request URL for top-level traffic documents.When
HttpRequest.url()throws for malformed or partially bound Repeater requests, this helper reconstructs a usable URL fromHttpServiceplus the already-recovered request path so top-level fields stay aligned with the nested request document.- Parameters:
request- request whose direct URL accessor may throwservice- HTTP service backing the requestrequestDoc- already-built request sub-document, usually frombuildRequestDoc(HttpRequest)logPrefix- logger prefix without brackets, for example"RepeaterTabs"- Returns:
- direct URL when available, otherwise a best-effort reconstructed URL or
null
-
buildResponseDoc
public static Map<String,Object> buildResponseDoc(burp.api.montoya.http.message.responses.HttpResponse response) Builds a response sub-document matching the traffic index response shape.Body bytes are always stored as full base64 in
body.b64for exact replay. When the payload is classified as textual,body.textcontains the full decoded text. ForHttpResponseReceived, response attributes such asvisible_textare preserved as returned by Montoya.- Parameters:
response- the HTTP response (never null)- Returns:
- map with status, headers, cookies, and body content fields.
-
safeRequestUrl
public static String safeRequestUrl(burp.api.montoya.http.message.requests.HttpRequest request, String logPrefix) ReturnsHttpRequest.url()when available, ornullwhen Montoya throws.Use this for lightweight call sites (for example scope filtering) that only need a safe URL lookup without the reconstruction cost of
buildBestEffortUrl(burp.api.montoya.http.message.requests.HttpRequest, burp.api.montoya.http.HttpService, java.util.Map<java.lang.String, java.lang.Object>, java.lang.String). The logged context mirrors the reconstruction helper so failure reasons stay traceable across exports.- Parameters:
request- request whose direct URL accessor may throwlogPrefix- logger prefix without brackets, for example"Sitemap"- Returns:
- trimmed URL when available, otherwise
null
-