Package io.fathom.http

Examples of io.fathom.http.HttpRequest


    }

    protected HttpRequest buildHead(String relativePath) throws RestClientException {
        URI uri = resolve(relativePath);

        HttpRequest request = httpConfiguration.buildRequest(HttpMethod.HEAD, uri);
        addHeaders(request);
        return request;
    }
View Full Code Here


    }

    protected HttpRequest buildPut(String relativePath) throws RestClientException {
        URI uri = resolve(relativePath);

        HttpRequest request = httpConfiguration.buildRequest(HttpMethod.PUT, uri);
        addHeaders(request);
        return request;
    }
View Full Code Here

    }

    protected HttpRequest buildDelete(String relativePath) throws RestClientException {
        URI uri = resolve(relativePath);

        HttpRequest request = httpConfiguration.buildRequest(HttpMethod.DELETE, uri);
        addHeaders(request);
        return request;
    }
View Full Code Here

        // 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());
                }
            }
        } catch (Exception e) {
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

        HttpClient httpClient = getHttpClient().withSsl(sslConfiguration);
        return httpClient;
    }

    public Token validateToken(String token) throws RestClientException {
        HttpRequest request = buildGet("v3/auth/tokens");

        request.setHeader("X-Auth-Token", token);
        request.setHeader("X-Subject-Token", token);

        return doRequest(request, Token.class);
    }
View Full Code Here

    public ClientApp getClientApp(ClientApp app) throws RestClientException {
        return doPost("extensions/client", app, ClientApp.class);
    }

    public byte[] getClientData(String secret, String token, String appId, String userId) throws RestClientException {
        HttpRequest request = buildGet("extensions/attachment/user/" + urlEscape(userId) + "/" + urlEscape(appId)
                + "?secret=" + urlEscape(secret));

        request.setHeader("X-Auth-Token", token);
        return doByteArrayRequest(request);
    }
View Full Code Here

        return doByteArrayRequest(request);
    }

    public void setClientData(String secret, String token, String appId, String userId, byte[] data)
            throws RestClientException {
        HttpRequest request = buildPut("extensions/attachment/user/" + urlEscape(userId) + "/" + urlEscape(appId)
                + "?secret=" + urlEscape(secret));

        request.setHeader("X-Auth-Token", token);
        try {
            request.setRequestContent(ByteSource.wrap(data));
        } catch (IOException e) {
            throw new RestClientException("Error setting request content", e);
        }

        doStringRequest(request);
View Full Code Here

    public static OpenstackIdentityClient build(URI uri) {
        return new OpenstackIdentityClient(JreHttpClient.create(), uri, null);
    }

    public V2ProjectList listProjects() throws RestClientException {
        HttpRequest request = buildGet("v2.0/tenants");

        return doRequest(request, V2ProjectList.class);
    }
View Full Code Here

TOP

Related Classes of io.fathom.http.HttpRequest

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.