Package org.microproxy.extras
Class ServerReplay.Builder
java.lang.Object
org.microproxy.extras.ServerReplay.Builder
- Enclosing class:
ServerReplay
Configures a
ServerReplay.-
Method Summary
Modifier and TypeMethodDescriptionadd(Collection<RecordedExchange> recorded) Adds recorded exchanges.build()Creates the addon.extra(ServerReplay.Extra extra) What happens to requests without a recording (defaultServerReplay.Extra.forward()).ignoreContent(boolean ignore) Ignores request bodies when matching (default false).ignoreHost(boolean ignore) Ignores the host when matching (default false).ignoreParams(String... names) Query parameters to ignore when matching.ignorePayloadParams(String... names) Form fields ofapplication/x-www-form-urlencodedbodies to ignore when matching; the other fields are compared instead of the whole body.ignorePort(boolean ignore) Ignores the port when matching (default false).Adds the exchanges recorded in a HAR or WARC file, or in every such file of a directory (seeRecordedExchange.load(java.nio.file.Path)).maxBodySize(int bytes) Largest request body buffered to compare it (default 16 MiB); a larger one is answered with413, unless bodies are ignored.refresh(boolean refresh) Shifts the dates of replayed responses by the time since they were recorded (default true).reuse(boolean reuse) Keeps answering with a recording rather than using it up (default false: each answers once).useHeaders(String... names) Request headers that must match too.
-
Method Details
-
load
Adds the exchanges recorded in a HAR or WARC file, or in every such file of a directory (seeRecordedExchange.load(java.nio.file.Path)).- Parameters:
path- a file or directory- Returns:
- this builder
- Throws:
IOException- if a file cannot be read or is in neither format
-
add
Adds recorded exchanges.- Parameters:
recorded- the exchanges, in recorded order- Returns:
- this builder
-
ignoreContent
Ignores request bodies when matching (default false).- Parameters:
ignore- whether to ignore bodies- Returns:
- this builder
-
ignoreHost
Ignores the host when matching (default false).- Parameters:
ignore- whether to ignore the host- Returns:
- this builder
-
ignorePort
Ignores the port when matching (default false).- Parameters:
ignore- whether to ignore the port- Returns:
- this builder
-
ignoreParams
Query parameters to ignore when matching.- Parameters:
names- parameter names- Returns:
- this builder
-
ignorePayloadParams
Form fields ofapplication/x-www-form-urlencodedbodies to ignore when matching; the other fields are compared instead of the whole body.- Parameters:
names- field names- Returns:
- this builder
-
useHeaders
Request headers that must match too.- Parameters:
names- header names- Returns:
- this builder
-
reuse
Keeps answering with a recording rather than using it up (default false: each answers once).- Parameters:
reuse- whether recordings can be replayed any number of times- Returns:
- this builder
-
extra
What happens to requests without a recording (defaultServerReplay.Extra.forward()).- Parameters:
extra- forward, kill or a status- Returns:
- this builder
-
refresh
Shifts the dates of replayed responses by the time since they were recorded (default true).- Parameters:
refresh- whether to refresh dates- Returns:
- this builder
-
maxBodySize
Largest request body buffered to compare it (default 16 MiB); a larger one is answered with413, unless bodies are ignored.- Parameters:
bytes- the buffer limit- Returns:
- this builder
-
build
Creates the addon.- Returns:
- the configured addon
-