Package com.google.step2.discovery

Examples of com.google.step2.discovery.Discovery2


      HTTPRequest httpRequest = new HTTPRequest(request.getUri().toURL(), method);
      HTTPResponse httpResponse = fetchService.fetch(httpRequest);
      return new AppEngineFetchResponse(httpResponse);

    } catch (MalformedURLException e) {
      throw new FetchException(e);
    } catch (IOException e) {
      throw new FetchException(e);
    }
  }
View Full Code Here


        public String getFirstHeader(String name) {
          return null;
        }
      };
    }
    throw new FetchException("Unexpected request for " + url + ", should have been " +
        signatureLocation);
  }
View Full Code Here

  public void testGet_fetchException() throws Exception {
    String host = "host.com";
    FetchRequest request =
        FetchRequest.createGetRequest(new URI("http://host.com/host-meta"));

    expect(http.fetch(request)).andThrow(new FetchException());

    control.replay();
    try {
      HostMeta hostMeta = fetcher.getHostMeta(host);
      fail("expected exception, but didn't get it");
View Full Code Here

      HTTPRequest httpRequest = new HTTPRequest(request.getUri().toURL(), method);
      HTTPResponse httpResponse = fetchService.fetch(httpRequest);
      return new AppEngineFetchResponse(httpResponse);

    } catch (MalformedURLException e) {
      throw new FetchException(e);
    } catch (IOException e) {
      throw new FetchException(e);
    }
  }
View Full Code Here

          XmlUtil.getDocument(new ByteArrayInputStream(documentBytes));

      xrds = new XRDS(document.getDocumentElement(), false);

    } catch (ParserConfigurationException e) {
      throw new FetchException(e);
    } catch (SAXException e) {
      throw new FetchException(e);
    } catch (IOException e) {
      throw new FetchException(e);
    } catch (URISyntaxException e) {
      throw new FetchException(e);
    } catch (ParseException e) {
      throw new FetchException(e);
    }

    return new XrdRepresentations(xrds.getFinalXRD(), uri.toASCIIString(),
        documentBytes, signature);
  }
View Full Code Here

   *
   * @throws FetchException
   */
  private XrdRepresentations fetchXrd(URI uri) throws FetchException {

    FetchRequest request = FetchRequest.createGetRequest(uri);

    XRDS xrds;
    byte[] documentBytes;
    String signature;

View Full Code Here

    InputStream responseStream = null;

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

      FetchResponse response = fetcher.fetch(request);

      int status = response.getStatusCode();
View Full Code Here

    String signatureHref = signatureLocation.getTextTrim();
    if (signatureHref == null) {
      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 " +
View Full Code Here

    }

    public HttpResponseMessage execute(HttpMessage request,
        Map<String, Object> clientParams) throws IOException {
      try {
        FetchRequest fetchRequest;
        if ("post".equals(request.method.toLowerCase())) {
          fetchRequest = FetchRequest.createPostRequest(request.url.toURI());
        } else if ("head".equals(request.method.toLowerCase())) {
          fetchRequest = FetchRequest.createHeadRequest(request.url.toURI());
        } else {
View Full Code Here

  public void testFindOpEndpointsForSite() throws Exception {
    IdpIdentifier host = new IdpIdentifier("balfanz.net");
    URI siteXrdsUri = URI.create("http://example.com/xrds");

    FetchRequest httpRequest = FetchRequest.createGetRequest(siteXrdsUri);

    expect(verifier.verify(isA(byte[].class), (String) isNull()))
        .andStubThrow(new XmlSimpleSignException("no signature"));
    expect(fetcher.fetch(httpRequest)).andReturn(new FakeResponse(SITE_XRD));
View Full Code Here

TOP

Related Classes of com.google.step2.discovery.Discovery2

Copyright © 2018 www.massapicom. 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.