public static ApiResponseSet<String> httpMessageToSet(int historyId, int historyType, HttpMessage msg) {
        Map<String, String> map = new HashMap<>();
        map.put("id", String.valueOf(historyId));
        map.put("type", String.valueOf(historyType));
        map.put("timestamp", String.valueOf(msg.getTimeSentMillis()));
        map.put("rtt", String.valueOf(msg.getTimeElapsedMillis()));
        map.put("cookieParams", msg.getCookieParamsAsString());
        map.put("note", msg.getNote());
        map.put("requestHeader", msg.getRequestHeader().toString());
        map.put("requestBody", msg.getRequestBody().toString());
        map.put("responseHeader", msg.getResponseHeader().toString());

        if (HttpHeader.GZIP.equals(msg.getResponseHeader().getHeader(HttpHeader.CONTENT_ENCODING))) {
            // Uncompress gziped content
            try (ByteArrayInputStream bais = new ByteArrayInputStream(msg.getResponseBody().getBytes());
                 GZIPInputStream gis = new GZIPInputStream(bais);
                 InputStreamReader isr = new InputStreamReader(gis);
                 BufferedReader br = new BufferedReader(isr);) {
                StringBuilder sb = new StringBuilder();
                String line = null;
                while ((line = br.readLine()) != null) {
                    sb.append(line);
                }
                map.put("responseBody", sb.toString());
            } catch (IOException e) {
                LOGGER.error("Unable to uncompress gzip content: " + e.getMessage(), e);
                map.put("responseBody", msg.getResponseBody().toString());
            }
        } else {
            map.put("responseBody", msg.getResponseBody().toString());
        }

        List<String> tags = Collections.emptyList();
        try {
            tags = HistoryReference.getTags(historyId);
        } catch (DatabaseException e) {
            LOGGER.warn("Failed to obtain the tags for message with ID " + historyId, e);
        }
        return new HttpMessageResponseSet(map, tags);
    }
public static ApiResponseSet < String > httpMessageToSet ( int historyId , int historyType , HttpMessage msg ) { Map < String , String > map = new HashMap < > ( ) ; map . put ( "id" , String . valueOf ( historyId ) ) ; map . put ( "type" , String . valueOf ( historyType ) ) ; map . put ( "timestamp" , String . valueOf ( msg . getTimeSentMillis ( ) ) ) ; map . put ( "rtt" , String . valueOf ( msg . getTimeElapsedMillis ( ) ) ) ; map . put ( "cookieParams" , msg . getCookieParamsAsString ( ) ) ; map . put ( "note" , msg . getNote ( ) ) ; map . put ( "requestHeader" , msg . getRequestHeader ( ) . toString ( ) ) ; map . put ( "requestBody" , msg . getRequestBody ( ) . toString ( ) ) ; map . put ( "responseHeader" , msg . getResponseHeader ( ) . toString ( ) ) ; if ( HttpHeader . GZIP . equals ( msg . getResponseHeader ( ) . getHeader ( HttpHeader . CONTENT_ENCODING ) ) ) { try ( ByteArrayInputStream bais = new ByteArrayInputStream ( msg . getResponseBody ( ) . getBytes ( ) ) ; GZIPInputStream gis = new GZIPInputStream ( bais ) ; InputStreamReader isr = new InputStreamReader ( gis ) ; BufferedReader br = new BufferedReader ( isr ) ; ) { StringBuilder sb = new StringBuilder ( ) ; String line = null ; while ( ( line = br . readLine ( ) ) != null ) { sb . append ( line ) ; } map . put ( "responseBody" , sb . toString ( ) ) ; } catch ( IOException e ) { LOGGER . error ( "Unable to uncompress gzip content: " + e . getMessage ( ) , e ) ; map . put ( "responseBody" , msg . getResponseBody ( ) . toString ( ) ) ; } } else { map . put ( "responseBody" , msg . getResponseBody ( ) . toString ( ) ) ; } List < String > tags = Collections . emptyList ( ) ; try { tags = HistoryReference . getTags ( historyId ) ; } catch ( DatabaseException e ) { LOGGER . warn ( "Failed to obtain the tags for message with ID " + historyId , e ) ; } return new HttpMessageResponseSet ( map , tags ) ; }
Converts the given HTTP message into an {@code ApiResponseSet}.

@param historyId the ID of the message
@param historyType the type of the message
@param msg the HTTP message to be converted
@return the {@code ApiResponseSet} with the ID, type and the HTTP message
@since 2.6.0