com.woorea.openstack.connector.JaxRs20Response Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jersey2-connector Show documentation
Show all versions of jersey2-connector Show documentation
OpenStack Jersey2 Connector
package com.woorea.openstack.connector;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.core.Response;
import com.woorea.openstack.base.client.OpenStackResponse;
public class JaxRs20Response implements OpenStackResponse {
private Response response;
public JaxRs20Response(Response response) {
this.response = response;
}
@Override
public T getEntity(Class returnType) {
return response.readEntity(returnType);
}
@Override
public InputStream getInputStream() {
return (InputStream) response.getEntity();
}
@Override
public String header(String name) {
return response.getHeaderString(name);
}
@Override
public Map headers() {
Map headers = new HashMap();
for(String k : response.getHeaders().keySet()) {
headers.put(k, response.getHeaderString(k));
}
return headers;
}
}