de.sstoehr.harreader.model.HarPostData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of har-reader Show documentation
Show all versions of har-reader Show documentation
A library to access HTTP archive format with Java
The newest version!
package de.sstoehr.harreader.model;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Builder;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Information about POST data.
* @see specification
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Builder(toBuilder = true)
public record HarPostData(
@Nullable String mimeType,
@Nonnull List params,
@Nullable String text,
@Nullable String comment,
@Nonnull Map additional) {
public HarPostData() {
this(null, Collections.emptyList(), null, null, new HashMap<>());
}
public HarPostData(@Nullable String mimeType,
@Nullable List params,
@Nullable String text,
@Nullable String comment,
@Nullable Map additional) {
this.mimeType = mimeType;
this.params = (params == null) ? Collections.emptyList() : params;
this.text = text;
this.comment = comment;
this.additional = (additional == null) ? new HashMap<>() : additional;
}
/**
* @return Map with additional keys, which are not officially supported by the HAR specification
*/
@JsonAnyGetter
public Map additional() {
return additional;
}
@JsonAnySetter
public void setAdditionalField(String key, Object value) {
this.additional.put(key, value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy