Class ResponseAnalyzer

java.lang.Object
Services.ResponseAnalyzer.ResponseAnalyzer

public class ResponseAnalyzer extends Object
Analyzes HTTP responses and extracts structured and atomic objects from JSON responses and response headers.

This class is responsible for converting JSON responses into a tree of StructuredObject and AtomicObject instances. It also extracts relevant information from response headers such as "Set-Cookie" headers.

  • Constructor Details

    • ResponseAnalyzer

      public ResponseAnalyzer(String url, Integer num_req)
      Constructs a ResponseAnalyzer for a specific URL and request number.
      Parameters:
      url - the URL of the HTTP request
      num_req - the index or number of the request
    • ResponseAnalyzer

      public ResponseAnalyzer()
      Default constructor.
  • Method Details

    • getUnstructuredResponse

      public ResponseUnstructured getUnstructuredResponse(String json_response)
      Converts a JSON response string into a ResponseUnstructured object containing StructuredObject and AtomicObject instances.
      Parameters:
      json_response - the JSON string to analyze
      Returns:
      a ResponseUnstructured object containing the parsed structure
    • analyzeResponseHeader

      public void analyzeResponseHeader(Header[] headers, ResponseUnstructured responseUnstructured)
      Analyzes HTTP response headers and extracts atomic objects for headers such as "Set-Cookie".
      Parameters:
      headers - the array of HTTP headers to analyze
      responseUnstructured - the ResponseUnstructured object to add extracted atomic objects