
net.anthavio.httl.transport.JettyResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hatatitla Show documentation
Show all versions of hatatitla Show documentation
Compact but tweakable REST client library you have been dreaming of
The newest version!
package net.anthavio.httl.transport;
import java.io.ByteArrayInputStream;
import net.anthavio.httl.HttlRequest;
import net.anthavio.httl.HttlResponse;
import net.anthavio.httl.HttlSender.Multival;
import net.anthavio.httl.transport.JettyTransport.JettyContentExchange;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.HttpFields.Field;
/**
*
* @author martin.vanek
*
*/
public class JettyResponse extends HttlResponse {
private static final long serialVersionUID = 1L;
public JettyResponse(HttlRequest request, JettyContentExchange exchange) {
super(request, exchange.getHttpStatus(), exchange.getMessage(), convert(exchange.getResponseHeaders()),
new ByteArrayInputStream(exchange.getResponseBody()));
}
private static Multival convert(HttpFields fields) {
Multival ret = new Multival();
for (int i = 0; i < fields.size(); ++i) {
Field field = fields.getField(i);
ret.add(field.getName(), field.getValue());
}
return ret;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy