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

Yas*_*lik 2 java rest

我有一个返回"Map"的web服务,我试图从Response(javax.ws.rs.core)中读取这个对象.像这样:ex: Map<String, Object> temp = response.readEntity(Map.class) 但这似乎不起作用.

我的问题是如何从响应对象中读取Map实体?

Yas*_*lik 10

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

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