Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 0eb6936

Browse files
committed
#272 Using JSON UTF8 for all calls now
1 parent ef25739 commit 0eb6936

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

src/main/java/com/marklogic/mgmt/ManageClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,15 @@ public Fragment getXmlAsSecurityUser(String path, String... namespacePrefixesAnd
258258
public String getJson(String path) {
259259
logRequest(path, "JSON", "GET");
260260
HttpHeaders headers = new HttpHeaders();
261-
headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
261+
headers.set("Accept", MediaType.APPLICATION_JSON_UTF8_VALUE);
262262
return getRestTemplate().exchange(buildUri(path), HttpMethod.GET, new HttpEntity<>(headers), String.class)
263263
.getBody();
264264
}
265265

266266
public String getJson(URI uri) {
267267
logRequest(uri.toString(), "JSON", "GET");
268268
HttpHeaders headers = new HttpHeaders();
269-
headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
269+
headers.set("Accept", MediaType.APPLICATION_JSON_UTF8_VALUE);
270270
return getRestTemplate().exchange(uri, HttpMethod.GET, new HttpEntity<>(headers), String.class).getBody();
271271
}
272272

@@ -284,7 +284,7 @@ public String getJsonAsAdmin(String path) {
284284
public String getJsonAsSecurityUser(String path) {
285285
logSecurityUserRequest(path, "JSON", "GET");
286286
HttpHeaders headers = new HttpHeaders();
287-
headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
287+
headers.set("Accept", MediaType.APPLICATION_JSON_UTF8_VALUE);
288288
return securityUserRestTemplate.exchange(buildUri(path), HttpMethod.GET, new HttpEntity<>(headers), String.class)
289289
.getBody();
290290
}
@@ -319,7 +319,7 @@ public void deleteAsSecurityUser(String path) {
319319
*/
320320
public HttpEntity<String> buildJsonEntity(String json) {
321321
HttpHeaders headers = new HttpHeaders();
322-
headers.setContentType(MediaType.APPLICATION_JSON);
322+
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
323323
if (manageConfig != null && manageConfig.isCleanJsonPayloads()) {
324324
json = cleanJsonPayload(json);
325325
}

src/main/java/com/marklogic/mgmt/admin/AdminManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void init(String licenseKey, String licensee) {
6262
@Override
6363
public boolean execute() {
6464
HttpHeaders headers = new HttpHeaders();
65-
headers.setContentType(MediaType.APPLICATION_JSON);
65+
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
6666
HttpEntity<String> entity = new HttpEntity<String>(payload, headers);
6767
try {
6868
ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.POST, entity, String.class);
@@ -108,7 +108,7 @@ public void installAdmin(String username, String password) {
108108
@Override
109109
public boolean execute() {
110110
HttpHeaders headers = new HttpHeaders();
111-
headers.setContentType(MediaType.APPLICATION_JSON);
111+
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
112112
HttpEntity<String> entity = new HttpEntity<String>(payload, headers);
113113
try {
114114
ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.POST, entity, String.class);
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
{
2-
"database-name": "%%DATABASE%%"
3-
}
2+
"database-name": "%%DATABASE%%",
3+
"range-element-index": [
4+
{
5+
"collation": "http://marklogic.com/collation/",
6+
"invalid-values": "reject",
7+
"localname": "ÉÉÉ",
8+
"namespace-uri": "",
9+
"range-value-positions": false,
10+
"scalar-type": "string"
11+
}
12+
]
13+
}

0 commit comments

Comments
 (0)