Examples of FetchResponse


Examples of com.basho.riak.client.http.response.FetchResponse

     */
    public FetchResponse fetch(RequestMeta meta) {
        if (riak == null)
            throw new IllegalStateException("Cannot fetch an object without a RiakClient");

        FetchResponse r = riak.fetch(bucket, key, meta);
        if (r.getObject() != null) {
            RiakObject other = r.getObject();
            shallowCopy(other);
            r.setObject(this);
        }
        return r;
    }
View Full Code Here

Examples of com.basho.riak.client.response.FetchResponse

     */
    public FetchResponse fetchMeta(String bucket, String key, RequestMeta meta) {
        try {
            return getFetchResponse(helper.fetchMeta(bucket, key, meta));
        } catch (RiakResponseRuntimeException e) {
            return new FetchResponse(helper.toss(e), this);
        }
    }
View Full Code Here

Examples of com.basho.riak.client.response.FetchResponse

        HttpResponse r = helper.fetch(bucket, key, meta, streamResponse);

        try {
            return getFetchResponse(r);
        } catch (RiakResponseRuntimeException e) {
            return new FetchResponse(helper.toss(e), this);
        }

    }
View Full Code Here

Examples of com.basho.riak.pbc.FetchResponse

        if (key == null || key.trim().equals("")) {
            throw new IllegalArgumentException("Key cannot be null or empty or just whitespace");
        }

        FetchResponse fr = client.fetch(bucket, key, convert(fetchMeta));

        if (fr.hasSiblings()) {
            // do a full fetch to get the sibling values
            FetchMeta fm = FetchMeta.Builder.from(fetchMeta).headOnly(false).build();
            fr = client.fetch(bucket, key, convert(fm));
        }
View Full Code Here

Examples of com.google.step2.http.FetchResponse

    XRDS xrds;
    byte[] documentBytes;
    String signature;

    try {
      FetchResponse response = httpFetcher.fetch(request);

      documentBytes = response.getContentAsBytes();
      signature = response.getFirstHeader("Signature"); // could be null

      Document document =
          XmlUtil.getDocument(new ByteArrayInputStream(documentBytes));

      xrds = new XRDS(document.getDocumentElement(), false);
View Full Code Here

Examples of com.google.step2.http.FetchResponse

    try {
      URI uri = getHostMetaUriForHost(host);
      FetchRequest request = FetchRequest.createGetRequest(uri);

      FetchResponse response = fetcher.fetch(request);

      int status = response.getStatusCode();

      responseStream = response.getContentAsStream();

      if (status != HttpStatus.SC_OK) {
        throw new HttpResponseException(status, "fetching host-meta from " +
            host + " return status " + status);
      }
View Full Code Here

Examples of com.google.step2.http.FetchResponse

      throw new XmlSimpleSignException("No SignatureLocation text found");
    }

    FetchRequest request = FetchRequest.createGetRequest(URI.create(signatureHref));
    try {
      FetchResponse r = fetcher.fetch(request);
      return EncodingUtil.decodeBase64(r.getContentAsBytes());
    } catch (FetchException e) {
      throw new XmlSimpleSignException("couldn't fetch signature from " +
          signatureHref, e);
    }
  }
View Full Code Here

Examples of com.google.step2.http.FetchResponse

        } else if ("head".equals(request.method.toLowerCase())) {
          fetchRequest = FetchRequest.createHeadRequest(request.url.toURI());
        } else {
          fetchRequest = FetchRequest.createGetRequest(request.url.toURI());
        }
        FetchResponse response = httpFetcher.fetch(fetchRequest);
        return new Step2HttpResponseMessage(response, request);
      } catch (URISyntaxException e) {
        throw new IOException("couldn't convert " + request.url.toString() +
            " into a URI: " + e.getMessage());
      } catch (FetchException e) {
View Full Code Here

Examples of com.google.step2.http.FetchResponse


  public FetchResponse fetch(FetchRequest request) throws FetchException {
    String url = request.getUri().toString();
    if (url.equals(signatureLocation)) {
      return new FetchResponse() {

        public byte[] getContentAsBytes() {
          return EncodingUtil.getUtf8Bytes(signature);
        }
View Full Code Here

Examples of com.google.step2.http.FetchResponse

  public void testGet() throws Exception {
    String host = "host.com";
    FetchRequest request =
        FetchRequest.createGetRequest(new URI("http://host.com/host-meta"));
    FetchResponse response = new FakeFetchResponse(200,
        "Link: <http://foo.com/bar>; rel=foobar; type=foo\n");

    expect(http.fetch(request)).andReturn(response);

    control.replay();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.