-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCefResponse.java
More file actions
93 lines (75 loc) · 2.33 KB
/
Copy pathCefResponse.java
File metadata and controls
93 lines (75 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Copyright (c) 2014 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
package org.cef.network;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
/**
* Class used to represent a web response. The methods of this class may be
* called on any thread.
*/
public abstract class CefResponse {
// This CTOR can't be called directly. Call method create() instead.
CefResponse() {}
/**
* Create a new CefRequest object.
*/
public static final CefResponse create() {
return CefResponse_N.createNative();
}
/**
* Returns true if this object is read-only.
*/
public abstract boolean isReadOnly();
/**
* Get the response status code.
*/
public abstract int getStatus();
/**
* Set the response status code.
*/
public abstract void setStatus(int status);
/**
* Get the response status text.
*/
public abstract String getStatusText();
/**
* Set the response status text.
*/
public abstract void setStatusText(String statusText);
/**
* Get the response mime type.
*/
public abstract String getMimeType();
/**
* Set the response mime type.
*/
public abstract void setMimeType(String mimeType);
/**
* Get the value for the specified response header field.
*/
public abstract String getHeader(String name);
/**
* Get all response header fields.
*/
public abstract void getHeaderMap(Map<String, String> headerMap);
/**
* Set all response header fields.
*/
public abstract void setHeaderMap(Map<String, String> headerMap);
@Override
public String toString() {
String returnValue = "\nHTTP-Response:";
returnValue += "\n HTTP/1.1 " + getStatus() + " " + getStatusText();
returnValue += "\n Content-Type: " + getMimeType();
Map<String, String> headerMap = new HashMap<>();
getHeaderMap(headerMap);
Set<Entry<String, String>> entrySet = headerMap.entrySet();
for (Entry<String, String> entry : entrySet) {
returnValue += " " + entry.getKey() + "=" + entry.getValue() + "\n";
}
return returnValue;
}
}