简体   繁体   English

在JAX-RS客户端中读取Map实体

[英]Read Map entity in JAX-RS client

I have a webservice which returns a "Map", I am trying to read this object from the Response(javax.ws.rs.core). 我有一个返回“Map”的web服务,我试图从Response(javax.ws.rs.core)中读取这个对象。 something like this: ex : Map<String, Object> temp = response.readEntity(Map.class) but this doesn't seem to work. 像这样:ex: Map<String, Object> temp = response.readEntity(Map.class)但这似乎不起作用。

My question is how do I read a Map entity from a response object? 我的问题是如何从响应对象中读取Map实体?

找到了一种从response中读取Map实体的方法。我想我需要为Map提供实现类。

response.readEntity(new GenericType<HashMap<String, Object>>() { });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM