Я не принимаю Accept = multipart / form-data в ЗАПРОСЕ, я устанавливаю exchange.getIn (). SetHeader ("CamelAcceptContentType", "application / json"); и exchange.getIn (). setHeader ("Content-Type", "application / json");
ОТВЕТ - Принять = multipart / form-data
CamelHttpMethod = POST, CamelHttpResponseCode = 415, CamelHttpResponseText = Неподдерживаемый тип носителя
Похоже, сервер сообщает мне, что отправляет мне обратно мультимедийный тип данных-данных, но я говорю, что ищу application / json.
Я не отправляю данные запроса из нескольких частей. Может кто-нибудь объяснить, что здесь происходит? благодарю вас! сервер устанавливает это?
StringBuilder authHeader = new StringBuilder("Bearer ");
authHeader.append(token);
LOG.info("Authorization: " + authHeader.toString());
exchange.setProperty("CamelCharsetName", "UTF-8"); //"CamelCharsetName" Exchange.CHARSET_NAME
exchange.getIn().setHeader("CamelHttpCharacterEncoding", "UTF-8"); //"CamelHttpCharacterEncoding" Exchange.HTTP_CHARACTER_ENCODING
exchange.getIn().setHeader("CamelAcceptContentType", "application/json"); //"CamelAcceptContentType" Exchange.ACCEPT_CONTENT_TYPE
exchange.getIn().setHeader("CamelHttpUri", uploadUrl); //"CamelHttpUri" Exchange.HTTP_URI
exchange.getIn().setHeader("CamelHttpMethod", "POST"); //"CamelHttpMethod" Exchange.HTTP_METHOD
exchange.getIn().setHeader("x-ge-csvformat", "ODB");
exchange.getIn().setHeader("Tenant", tenant);
exchange.getIn().setHeader("Content-Type", "application/json"); // for JSON ONLY comment for CSV
exchange.getIn().setHeader("Authorization", authHeader.toString());
Я полагаю, что вопрос должен быть: ПОЧЕМУ я получаю заголовок ответа с Accept = multipart / form-data? когда я не устанавливаю или не использую multipart / form-data?
ЗДЕСЬ ЗАПИСЬ HTTP Post.
setHeader[CamelHttpMethod, POST] -->
http4://apm-ts-query-svc-prod.app-api.aws-usw02-pr.px.io:443/v2/ts/upload?throwExceptionOnFailure=false <<< Pattern:InOnly,
Headers:{Authorization=Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImxlZ2FjeS10b2tlbi1rZXkiLCJ0eXAiOiJKV1QifQ.eyJqdGkiOiI0Zrzfo6VKOA,
breadcrumbId=ID-alfuse2i-35498-1557318510555-3-598, CamelAcceptContentType=application/json, CamelFileAbsolute=false,
CamelFileAbsolutePath=/app/PassThruMT1/jboss-fuse-6.3.0.redhat-310/g-dig/upload/Industries/J402_Motor_2019-05-02-11-00-00_0.csv, CamelFileLastModified=1557319009000, CamelFileLength=1538,
CamelFileName=Industries/J_Motor_2019-05-02-11-00-00_0.csv,
CamelFileNameConsumed=Industries/J_Motor_2019-05-02-11-00-00_0.csv,
CamelFileNameOnly=J_Motor_2019-05-02-11-00-00_0.csv, CamelFileNameProduced=g-dig/json/Industries/J_Motor_2019-05-02-11-00-00_0.csv, CamelFileParent=g-d/upload/Industries, CamelFilePath=g-dal/upload/Industries/J_Motor_2019-05-02-11-00-00_0.csv, CamelFileRelativePath=Industries/J_Motor_2019-05-02-11-00-00_0.csv, CamelHttpCharacterEncoding=UTF-8,
CamelHttpMethod=POST,
CamelHttpUri=https://apm-ts-ingestion-svc-prod.app-api.aws-usw02-pr.px.io/v2/ts/upload?throwExceptionOnFailure=false,
Content-Type=application/json, CUSTKEY=Industries, EXPIRY=2019-05-09 06:36:36.101, TENANT=676f31-752-40d-81-c80c5be, TOKEN=eyJhbGciOiJSUzI1NiIsImtpZeQ2eflqE5C3j44MvhPIR0bSEZgznonA503vrzfo6VKOA, UPLOADURL=https://apm-ts-ingestion-svc-prod.app-api.aws-usw02-pr.px.io/v2/ts/upload, x-ge-csvformat=ODB}, BodyType:String, Body:{
"tags" : [ {
"tagId" : "TI5925.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "8.903611",
"q" : "3"
} ]
}, {
"tagId" : "TIA4562.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "56.47153",
"q" : "3"
} ]
}, {
"tagId" : "XIA4596A.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "3.335917",
"q" : "3"
} ]
}, {
"tagId" : "XIA4596B.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "1.670584",
"q" : "3"
} ]
}, {
"tagId" : "TIA4561.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "49.85203",
"q" : "3"
} ]
}, {
"tagId" : "XIA4595A.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "2.098929",
"q" : "3"
} ]
}, {
"tagId" : "XIA4595B.PV",
"data" : [ {
"ts" : "2019-05-02T16:00:00",
"v" : "2.647079",
"q" : "3"
} ]
}, {
"tagId" : "TIA4565.PV",
... [Body clipped after 1000 chars, total length is 16321]
И ЗДЕСЬ ОТВЕТ СЕРВЕРА - УВЕДОМЛЕНИЕ В начале ответного сообщения Accept = multipart / form = data.
log[HTTP4 Upload Response: ${body}] <<< Pattern:InOnly, Headers:{Accept=multipart/form-data, Authorization=Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6ImxlZ2FjeS10b2tlbi1rZXkiLCJ0eXAiOiJKV1QifQ.eyJqdGkiOiI0ZmYwY2UxZGFhN2E0N2U4ODIwA503vrzfo6VKOA, breadcrumbId=ID-alphprdfuse2i-35498-1557318510555-3-598, Cache-Control=no-cache, no-store, max-age=0, must-revalidate,
CamelAcceptContentType=application/json,
CamelFileAbsolute=false, CamelFileAbsolutePath=/app/PassMT1/jboss-fuse-6.3.0.redhat-310/tal/upload/Industries/J_Motor_2019-05-02-11-00-00_0.csv,
CamelFileLastModified=1557319009000, CamelFileLength=1538,
CamelFileName=Industries/J_Motor_2019-05-02-11-00-00_0.csv, CamelFileNameConsumed=Industries/J_Motor_2019-05-02-11-00-00_0.csv,
CamelFileNameOnly=J_Motor_2019-05-02-11-00-00_0.csv,
CamelFileNameProduced=g-dal/json/Industries/J_Motor_2019-05-02-11-00-00_0.csv, CamelFileParent=g-dal/upload/Industries,
CamelFilePath=g-dal/upload/Industries/J_Motor_2019-05-02-11-00-00_0.csv,
CamelFileRelativePath=Industries/J_Motor_2019-05-02-11-00-00_0.csv,
CamelHttpCharacterEncoding=UTF-8, CamelHttpMethod=POST,
CamelHttpResponseCode=415, CamelHttpResponseText=Unsupported Media Type,
CamelHttpUri=https://apm-ts-ingestion-svc-prod.app-api.aws-usw02-pr.px.io/v2/ts/upload?throwExceptionOnFailure=false, Connection=keep-alive,
Content-Length=0, Corr=4c4ffcb10fa7ef1c, CUSTKEY=Industries,
Date=Wed, 08 May 2019 12:38:27 GMT, Expires=0, EXPIRY=2019-05-09 06:36:36.101, Pragma=no-cache, Server=none, Strict-Transport-Security=max-age=31536000 ; includeSubDomains, TENANT=67626f31-75-43-81b-cc5bdbce, TOKEN=eyJhbGciOiJSUzI1NiIsI6GlLIGp8-HPeQ2eflqE5C3j44MvhPIR0bSEZgznonA503vrzfo6VKOA, UPLOADURL=https://apm-ts-ingestion-svc-prod.app-api.aws-usw02-pr.px.io/v2/ts/upload, X-Application-Context=APMTS:cloud:0, X-Content-Type-Options=nosniff, X-Frame-Options=DENY, x-ge-csvformat=ODB, X-Vcap-Request-Id=01d04cf7-47ae-4cf9-7d4c-357afe207769, X-Xss-Protection=1; mode=block}, BodyType:org.apache.camel.converter.stream.InputStreamCache, Body:[Body is instance of org.apache.camel.StreamCache]