@Override public DesignDocInfo success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), DesignDocInfo.class); } });
private AttachmentInputStream getAttachment(String attachmentId, URI uri) { HttpResponse r = restTemplate.get(uri.toString()); return new AttachmentInputStream(attachmentId, r.getContent(), r.getContentType(), r.getContentLength()); }
@Override public ReplicationStatus success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), ReplicationStatus.class); } });
@Override public T success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), c); } });
@Override public String success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), String.class); } });
@Override public String success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), String.class); } });
@Override public T success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), c); } });
@Override public Security success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), Security.class); } }
@Override public String success(HttpResponse hr) throws JsonProcessingException, IOException { return IOUtils.toString(hr.getContent(), "UTF-8"); }
@Override public PurgeResult success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), PurgeResult.class); } });
@Override public List<String> success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), STRING_LIST_TYPE_DEF); } });
@Override public List<StdActiveTask> success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), new TypeReference<List<StdActiveTask>>() {}); } });
@Override public PurgeResult success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), PurgeResult.class); } });
@Override public DocumentOperationResult success(HttpResponse hr) throws Exception { return objectMapper.readValue(hr.getContent(), DocumentOperationResult.class); } }
@Override public Integer success(HttpResponse hr) throws Exception { JsonNode rlimit = objectMapper.readTree(hr.getContent()); return rlimit.asInt(); } });
@Override public Void success(HttpResponse hr) throws Exception { JsonNode n = objectMapper.readValue(hr.getContent(), JsonNode.class); Documents.setRevision(o, n.get("rev").textValue()); return null; }
@Override public Void success(HttpResponse hr) throws Exception { JsonNode n = objectMapper.readValue(hr.getContent(), JsonNode.class); Documents.setRevision(o, n.get("rev").textValue()); return null; }
public ContinuousChangesFeed(String dbName, HttpResponse httpResponse) { this.httpResponse = httpResponse; try { reader = new BufferedReader(new InputStreamReader(httpResponse.getContent(), "UTF-8")); thread.setName(String.format("ektorp-%s-changes-listening-thread-%s", dbName, THREAD_COUNT.getAndIncrement())); thread.start(); } catch (UnsupportedEncodingException e) { throw Exceptions.propagate(e); } }
@Override public List<Revision> success(HttpResponse hr) throws Exception { JsonNode root = objectMapper.readValue(hr.getContent(), JsonNode.class); List<Revision> revs = new ArrayList<Revision>(); for (Iterator<JsonNode> i = root.get("_revs_info") .elements(); i.hasNext();) { JsonNode rev = i.next(); revs.add(new Revision(rev.get("rev").textValue(), rev .get("status").textValue())); } return revs; }
public StreamingChangesResult(ObjectMapper objectMapper, HttpResponse response) { this.response = response; try{ jp = objectMapper.getFactory().createParser(response.getContent()); jp.nextValue(); jp.nextValue(); jp.nextToken(); }catch(Exception e) { throw new DbAccessException(e); } }