forked from chromiumembedded/java-cef
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathCefResponse_N.java
More file actions
187 lines (164 loc) · 5.11 KB
/
CefResponse_N.java
File metadata and controls
187 lines (164 loc) · 5.11 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
// 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 org.cef.callback.CefNative;
import org.cef.handler.CefLoadHandler.ErrorCode;
import java.util.Map;
class CefResponse_N extends CefResponse implements CefNative {
// Used internally to store a pointer to the CEF object.
private long N_CefHandle = 0;
@Override
public void setNativeRef(String identifer, long nativeRef) {
N_CefHandle = nativeRef;
}
@Override
public long getNativeRef(String identifer) {
return N_CefHandle;
}
CefResponse_N() {
super();
}
public static CefResponse createNative() {
try {
return CefResponse_N.N_Create();
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
return null;
}
}
@Override
public void dispose() {
try {
N_Dispose(N_CefHandle);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
@Override
public boolean isReadOnly() {
try {
return N_IsReadOnly(N_CefHandle);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
return false;
}
@Override
public ErrorCode getError() {
try {
return N_GetError(N_CefHandle);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
return null;
}
@Override
public void setError(ErrorCode errorCode) {
try {
N_SetError(N_CefHandle, errorCode);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
@Override
public int getStatus() {
try {
return N_GetStatus(N_CefHandle);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
return 0;
}
@Override
public void setStatus(int status) {
try {
N_SetStatus(N_CefHandle, status);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
@Override
public String getStatusText() {
try {
return N_GetStatusText(N_CefHandle);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
return null;
}
@Override
public void setStatusText(String statusText) {
try {
N_SetStatusText(N_CefHandle, statusText);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
@Override
public String getMimeType() {
try {
return N_GetMimeType(N_CefHandle);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
return null;
}
@Override
public void setMimeType(String mimeType) {
try {
N_SetMimeType(N_CefHandle, mimeType);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
@Override
public String getHeaderByName(String name) {
try {
return N_GetHeaderByName(N_CefHandle, name);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
return null;
}
@Override
public void setHeaderByName(String name, String value, boolean overwrite) {
try {
N_SetHeaderByName(N_CefHandle, name, value, overwrite);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
@Override
public void getHeaderMap(Map<String, String> headerMap) {
try {
N_GetHeaderMap(N_CefHandle, headerMap);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
@Override
public void setHeaderMap(Map<String, String> headerMap) {
try {
N_SetHeaderMap(N_CefHandle, headerMap);
} catch (UnsatisfiedLinkError ule) {
ule.printStackTrace();
}
}
private final native static CefResponse_N N_Create();
private final native void N_Dispose(long self);
private final native boolean N_IsReadOnly(long self);
private final native ErrorCode N_GetError(long self);
private final native void N_SetError(long self, ErrorCode errorCode);
private final native int N_GetStatus(long self);
private final native void N_SetStatus(long self, int status);
private final native String N_GetStatusText(long self);
private final native void N_SetStatusText(long self, String statusText);
private final native String N_GetMimeType(long self);
private final native void N_SetMimeType(long self, String mimeType);
private final native String N_GetHeaderByName(long self, String name);
private final native void N_SetHeaderByName(
long self, String name, String value, boolean overwrite);
private final native void N_GetHeaderMap(long self, Map<String, String> headerMap);
private final native void N_SetHeaderMap(long self, Map<String, String> headerMap);
}