Package org.agorava.api.rest

Examples of org.agorava.api.rest.Response


        request.addOAuthParameter(AgoravaConstants.CALLBACK, config.getCallback());
        addOAuthParams(request, AgoravaConstants.EMPTY_TOKEN);
        appendSignature(request);

        LOGGER.fine("sending request...");
        Response response = request.send(tuner);
        //todo:should check return code and launch ResponseException if it's not 200
        String body = response.getBody();

        LOGGER.fine("response status code: " + response.getCode());
        LOGGER.fine("response body: " + body);
        return api.getRequestTokenExtractor().extract(body);
    }
View Full Code Here


        request.addOAuthParameter(AgoravaConstants.VERIFIER, verifier.getValue());

        LOGGER.fine("setting token to: " + requestToken + " and verifier to: " + verifier);
        addOAuthParams(request, requestToken);
        appendSignature(request);
        Response response = request.send(tuner);
        //todo:should check return code and launch ResponseException if it's not 200
        return api.getAccessTokenExtractor().extract(response.getBody());
    }
View Full Code Here

        assertEquals(1, connection.getTimesCalledInpuStream());
    }

    @Test
    public void shouldHandleAConnectionWithErrors() throws Exception {
        Response errResponse = new ResponseImpl(new FaultyConnection());
        assertEquals(400, errResponse.getCode());
        assertEquals("errors", errResponse.getBody());
    }
View Full Code Here

        return getJsonMapper().mapToObject(sendSignedRequest(GET, uri), clazz);
    }

    @Override
    public <T> T get(String uri, Class<T> clazz, boolean signed) {
        Response resp;
        if (signed) resp = sendSignedRequest(GET, uri);
        else
            resp = requestFactory(GET, uri).send(); //todo:should check return code and launch
        // ResponseException if it's not 200
        return getJsonMapper().mapToObject(resp, clazz);
View Full Code Here

        uri = MessageFormat.format(uri, urlParams);
        OAuthRequest request = requestFactory(POST, uri);

        request.addPayload(getJsonMapper().objectToJsonString(toPost));
        Response response = sendSignedRequest(request);
        return response.getHeader("Location");
    }
View Full Code Here

        request.addBodyParameter(AgoravaConstants.CODE, verifier.getValue());
        request.addBodyParameter(AgoravaConstants.REDIRECT_URI, config.getCallback());
        request.addBodyParameter("grant_type", "authorization_code");
        if (config.hasScope())
            request.addBodyParameter(AgoravaConstants.SCOPE, config.getScope());
        Response response = request.send(); //todo:should check return code and launch ResponseException if it's not 200
        return api.getAccessTokenExtractor().extract(response.getBody());
    }
View Full Code Here

        request.addQuerystringParameter(AgoravaConstants.CLIENT_SECRET, config.getApiSecret());
        request.addQuerystringParameter(AgoravaConstants.CODE, verifier.getValue());
        request.addQuerystringParameter(AgoravaConstants.REDIRECT_URI, config.getCallback());
        if (config.hasScope())
            request.addQuerystringParameter(AgoravaConstants.SCOPE, config.getScope());
        Response response = request.send(); //todo:should check return code and launch ResponseException if it's not 200
        return api.getAccessTokenExtractor().extract(response.getBody());
    }
View Full Code Here

TOP

Related Classes of org.agorava.api.rest.Response

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.