use of com.dexels.navajo.client.stream.jetty.JettyClient in project navajo by Dexels.
the class TestHttp method testHttpGet.
@Test
public void testHttpGet() throws Exception {
JettyClient jc = new JettyClient();
// jc.c
String weather = jc.callWithoutBodyToStream("http://api.openweathermap.org/data/2.5/weather?q=Amsterdam&APPID=c9a22840a45f9da6f235c718475c4f08&mode=xml", e -> e).lift(XML.parseFlowable(10)).flatMap(x -> x).filter(e -> e.getType() == XmlEventTypes.START_ELEMENT).filter(e -> e.getText().equals("weather")).firstElement().map(xml -> xml.getAttributes().get("value")).blockingGet();
logger.info("Weather: {}", weather);
// Not really a good unit test (... or is it?)
}
use of com.dexels.navajo.client.stream.jetty.JettyClient in project navajo by Dexels.
the class ResourceComponent method deactivate.
public void deactivate() throws Exception {
logger.debug("Deactivating HTTP connector");
if (client != null) {
JettyClient c = client;
client = null;
c.close();
}
this.authorization = null;
this.secret = Optional.empty();
this.url = null;
}
Aggregations