Explicitly specify all HTTP payload content as JSON, for compatibility
with Elasticsearch 6.x
Change-Id: Ibd6ad7bfd627a5c1bdfb04a950472e4cedfd790d
Issue-ID: AAI-1650
Signed-off-by: mark.j.leonard <mark.j.leonard@gmail.com>
try {
conn.setRequestMethod("PUT");
try {
conn.setRequestMethod("PUT");
- conn.setRequestProperty("Content-Type", "application/json");
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to PUT.", e);
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to PUT.", e);
try {
conn.setRequestMethod("PUT");
try {
conn.setRequestMethod("PUT");
- conn.setRequestProperty("Content-Type", "application/json");
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to PUT.", e);
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to PUT.", e);
private void attachDocument(HttpURLConnection conn, DocumentStoreDataEntity doc)
throws DocumentStoreOperationException {
private void attachDocument(HttpURLConnection conn, DocumentStoreDataEntity doc)
throws DocumentStoreOperationException {
- conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Connection", "Close");
attachContent(conn, doc.getContentInJson());
}
conn.setRequestProperty("Connection", "Close");
attachContent(conn, doc.getContentInJson());
}
try {
conn.setRequestMethod("PUT");
try {
conn.setRequestMethod("PUT");
- conn.setRequestProperty("Content-Type", "application/json");
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to PUT.", e);
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to PUT.", e);
try {
conn.setRequestMethod("POST");
try {
conn.setRequestMethod("POST");
- conn.setRequestProperty("Content-Type", "application/json");
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to POST.", e);
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to POST.", e);
try {
conn.setRequestMethod("POST");
try {
conn.setRequestMethod("POST");
- conn.setRequestProperty("Content-Type", "application/json");
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to POST.", e);
} catch (ProtocolException e) {
shutdownConnection(conn);
throw new DocumentStoreOperationException("Failed to set HTTP request method to POST.", e);
try {
conn = (HttpURLConnection) url.openConnection();
try {
conn = (HttpURLConnection) url.openConnection();
+ conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
} catch (IOException e) {
shutdownConnection(conn);
conn.setDoOutput(true);
} catch (IOException e) {
shutdownConnection(conn);