Package io.fathom.http

Examples of io.fathom.http.HttpClient


    @Inject
    ImageService imageService;

    @Override
    public Metadata getImageMetadata(String imageUrl) throws Exception {
        HttpClient httpClient = JreHttpClient.create();
        URI imageUri = URI.create(imageUrl);
        ImportImageClient imageClient = new ImportImageClient(httpClient, imageUri);

        final ImageImportMetadata imageMetadata = imageClient.getMetadata(imageUri);
View Full Code Here


        };
    }

    @Override
    public Image importImage(long projectId, String imageUrl) throws IOException, CloudException, RestClientException {
        HttpClient httpClient = JreHttpClient.create();
        URI imageUri = URI.create(imageUrl);
        ImportImageClient imageClient = new ImportImageClient(httpClient, imageUri);

        log.info("Downloading metadata {}", imageUri);
View Full Code Here

            return false;
        }

        // Fetch the root page; this warms-up the app
        try {
            HttpClient httpClient = JreHttpClient.create();
            URI uri = URI.create("http://127.0.0.1:8080/");
            HttpRequest httpRequest = httpClient.buildRequest(HttpMethod.GET, uri);
            try (HttpResponse response = httpRequest.doRequest()) {
                if (response.getHttpResponseCode() != 200) {
                    throw new IllegalStateException("Bad response code from page: " + response.getHttpResponseCode());
                }
            }
View Full Code Here

    public V2AuthResponse doLogin(V2AuthRequest authRequest, CertificateAndKey certificateAndKey)
            throws RestClientException {
        URI uri = resolve("v2.0/tokens");

        HttpClient httpClient = getHttpClient(certificateAndKey);
        HttpRequest httpRequest = httpClient.buildRequest(HttpMethod.POST, uri);
        addHeaders(httpRequest);

        addHeaders(httpRequest, certificateAndKey);

        setEntityJson(httpRequest, authRequest);
View Full Code Here

    public RegisterResponse register(RegisterRequest request, CertificateAndKey certificateAndKey)
            throws RestClientException {
        URI uri = resolve("extensions/register");

        HttpClient httpClient = getHttpClient(certificateAndKey);
        HttpRequest httpRequest = httpClient.buildRequest(HttpMethod.POST, uri);
        addHeaders(httpRequest);

        addHeaders(httpRequest, certificateAndKey);

        setEntityJson(httpRequest, request);
View Full Code Here

    private HttpClient getHttpClient(CertificateAndKey certificateAndKey) {
        SimpleClientCertificateKeyManager keyManager = new SimpleClientCertificateKeyManager(certificateAndKey);

        SslConfiguration sslConfiguration = getHttpClient().getSslConfiguration().copyWithNewKeyManager(keyManager);
        HttpClient httpClient = getHttpClient().withSsl(sslConfiguration);
        return httpClient;
    }
View Full Code Here

    OpenstackClient getOpenstackClient() {
        KeyPair keypair = getKeyPair();

        URI uri = URI.create(backendData.getUrl());

        HttpClient httpClient = JreHttpClient.create();
        OpenstackIdentityClient identityClient = new OpenstackIdentityClient(httpClient, uri, null);

        X500Principal subject = new X500Principal("CN=" + "unknown");
        CertificateAndKey certificateAndKey = ChallengeResponses.createSelfSigned(subject, keypair);
View Full Code Here

            serviceToken = serviceToken.trim();
            Metadata metadata = getMetadata();

            URI identityEndpoint = URI.create(metadata.getTopLevel("identity_uri"));

            HttpClient httpClient = metadataClient.getHttpClient();
            OpenstackIdentityClient identityClient = new OpenstackIdentityClient(httpClient, identityEndpoint, null);

            StaticTokenProvider tokenProvider = new StaticTokenProvider(identityClient, serviceToken);

            this.client = OpenstackClient.build(tokenProvider);
View Full Code Here

TOP

Related Classes of io.fathom.http.HttpClient

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.