Add body field to Page

This commit is contained in:
XiangRongLin 2021-04-02 21:34:04 +02:00
parent 4e0be60ddc
commit 3af26a2821
1 changed files with 17 additions and 6 deletions

View File

@ -11,32 +11,39 @@ public class Page implements Serializable {
private final String id; private final String id;
private final List<String> ids; private final List<String> ids;
private final Map<String, String> cookies; private final Map<String, String> cookies;
private final byte[] body;
public Page(final String url, final String id, final List<String> ids, final Map<String, String> cookies) { public Page(final String url, final String id, final List<String> ids,
final Map<String, String> cookies, final byte[] body) {
this.url = url; this.url = url;
this.id = id; this.id = id;
this.ids = ids; this.ids = ids;
this.cookies = cookies; this.cookies = cookies;
this.body = body;
} }
public Page(final String url) { public Page(final String url) {
this(url, null, null, null); this(url, null, null, null, null);
} }
public Page(final String url, final String id) { public Page(final String url, final String id) {
this(url, id, null, null); this(url, id, null, null, null);
}
public Page(final String url, final byte[] body) {
this(url, null, null, null, body);
} }
public Page(final String url, final Map<String, String> cookies) { public Page(final String url, final Map<String, String> cookies) {
this(url, null, null, cookies); this(url, null, null, cookies, null);
} }
public Page(final List<String> ids) { public Page(final List<String> ids) {
this(null, null, ids, null); this(null, null, ids, null, null);
} }
public Page(final List<String> ids, final Map<String, String> cookies) { public Page(final List<String> ids, final Map<String, String> cookies) {
this(null, null, ids, cookies); this(null, null, ids, cookies, null);
} }
public String getUrl() { public String getUrl() {
@ -59,4 +66,8 @@ public class Page implements Serializable {
return page != null && (!isNullOrEmpty(page.getUrl()) return page != null && (!isNullOrEmpty(page.getUrl())
|| !isNullOrEmpty(page.getIds())); || !isNullOrEmpty(page.getIds()));
} }
public byte[] getBody() {
return body;
}
} }