【发布时间】:2020-08-19 18:38:26
【问题描述】:
我将 HTTP 标头数据作为字符串,如下所示。
{Accept=[*/*], accept-encoding=[gzip, deflate, br], cache-control=[no-cache], connection=[keep-alive], Content-Length=[273], content-type=[application/xml], host=[localhost:8090], SOAPAction=["http://someurl"]}
基于',' 的拆分会导致不正确的拆分,因为这些值也由',' 分隔。我无法将其转换为 Map<String, List<String>> 或 MultivaluedMap<String, String>。
【问题讨论】:
-
您在哪里/在什么情况下获得这些标头?
-
扩展 Apache CXF LoggingInInterceptor 以这种格式返回标头。
-
那个已经被弃用一年多了?
-
另外,这似乎不正确; the interface says it's a
Map,您似乎只是在打印toString(),而不是调用get(ACCEPT_ENCODING) -
@chrylis-cautiouslyoptimistic- 是的,就是这样。我在 loggingMessage 上调用方法 getHeader 并得到该值。
标签: java http-headers