All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xceptance.xlt.engine.har.model.HarEntry Maven / Gradle / Ivy

Go to download

XLT (Xceptance LoadTest) is an extensive load and performance test tool developed and maintained by Xceptance.

There is a newer version: 8.1.0
Show newest version
package com.xceptance.xlt.engine.har.model;

import java.util.Date;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.util.ISO8601Utils;

/**
 * Container for all information about an exported request (and its response if any).
 *
 * @see specification
 */
@JsonPropertyOrder(
    {
        "pageref", "startedDateTime", "time", "request", "response", "cache", "timings", "serverIPAddress", "connection", "comment"
    })
public class HarEntry
{
    private final String pageref;

    private final String startedDateTime;

    private final long time;

    private final HarRequest request;

    private HarResponse response;

    private final HarCache cache;

    private final HarTimings timings;

    private final String serverIPAddress;

    private final String connection;

    private final String comment;

    @JsonCreator
    public HarEntry(@JsonProperty("pageref") String pageref, @JsonProperty("startedDateTime") String startedDateTime,
                    @JsonProperty("time") long time, @JsonProperty("request") HarRequest request,
                    @JsonProperty("response") HarResponse response, @JsonProperty("cache") HarCache cache,
                    @JsonProperty("timings") HarTimings timings, @JsonProperty("serverIPAddress") String serverIPAddress,
                    @JsonProperty("connection") String connection, @JsonProperty("comment") String comment)
    {
        this.pageref = pageref;
        this.startedDateTime = startedDateTime;
        this.time = time;
        this.request = request;
        this.response = response;
        this.cache = cache;
        this.timings = timings;
        this.serverIPAddress = serverIPAddress;
        this.connection = connection;
        this.comment = comment;
    }

    public String getPageref()
    {
        return pageref;
    }

    public String getStartedDateTime()
    {
        return startedDateTime;
    }

    public long getTime()
    {
        return time;
    }

    public HarRequest getRequest()
    {
        return request;
    }

    public HarResponse getResponse()
    {
        return response;
    }

    public HarCache getCache()
    {
        return cache;
    }

    public HarTimings getTimings()
    {
        return timings;
    }

    public String getServerIPAddress()
    {
        return serverIPAddress;
    }

    public String getConnection()
    {
        return connection;
    }

    public String getComment()
    {
        return comment;
    }

    @Override
    public String toString()
    {
        return "HarEntry [response = " + response + ", connection = " + connection + ", time = " + time + ", pageref = " + pageref +
               ", cache = " + cache + ", timings = " + timings + ", request = " + request + ", comment = " + comment +
               ", serverIPAddress = " + serverIPAddress + ", startedDateTime = " + startedDateTime + "]";
    }

    public static class Builder
    {
        private String pageref;

        private String startedDateTime;

        private long time;

        private HarRequest request;

        private HarResponse response;

        private HarCache cache = new HarCache(null, null, null);

        private HarTimings timings;

        private String serverIPAddress;

        private String connection;

        private String comment;

        public Builder withPageref(String pageref)
        {
            this.pageref = pageref;
            return this;
        }

        public Builder withStartedDateTime(String startedDateTime)
        {
            this.startedDateTime = startedDateTime;
            return this;
        }

        public Builder withStartedDateTime(Date startedDateTime)
        {
            this.startedDateTime = ISO8601Utils.format(startedDateTime, true);
            return this;
        }

        public Builder withTime(long time)
        {
            this.time = time;
            return this;
        }

        public Builder withRequest(HarRequest request)
        {
            this.request = request;
            return this;
        }

        public Builder withResponse(HarResponse response)
        {
            this.response = response;
            return this;
        }

        public Builder withCache(HarCache cache)
        {
            this.cache = cache;
            return this;
        }

        public Builder withTimings(HarTimings timings)
        {
            this.timings = timings;
            return this;
        }

        public Builder withServerIPAddress(String serverIPAddress)
        {
            this.serverIPAddress = serverIPAddress;
            return this;
        }

        public Builder withConnection(String connection)
        {
            this.connection = connection;
            return this;
        }

        public Builder withComment(String comment)
        {
            this.comment = comment;
            return this;
        }

        public HarEntry build()
        {
            return new HarEntry(pageref, startedDateTime, time, request, response, cache, timings, serverIPAddress, connection, comment);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy