Examples of AsyncCompletionHandler


Examples of com.ning.http.client.AsyncCompletionHandler

    @Autowired
    private MessageService messageService;

    private void doGet(final Nabaztag nabaztag, String url) throws IOException {
        asyncHttpClient.prepareGet(url).execute(new AsyncCompletionHandler() {
            @Override
            public Object onCompleted(Response response) throws Exception {
                String responseBody = response.getResponseBody();
                logger.debug("responseBody {}",  responseBody);
                if(!responseBody.isEmpty())
View Full Code Here

Examples of com.ning.http.client.AsyncCompletionHandler

            doPost( nabaztag, urlToCall, parameters);
        }
    }

    private void doPost(final Nabaztag nabaztag, String urlToCall, String parameters) throws IOException {
        asyncHttpClient.preparePost(urlToCall).setBody(parameters).execute(new AsyncCompletionHandler() {
            @Override
            public Object onCompleted(Response response) throws Exception {
                String responseBody = response.getResponseBody();
                logger.debug("responseBody {}",  responseBody);
                if(!responseBody.isEmpty())
View Full Code Here

Examples of com.ning.http.client.AsyncCompletionHandler

        messageService.sendMessage(nabaztag.getMacAddress(), command.toString());
    }

    private void initHoroscopeOfDay(final Nabaztag nabaztag, final int dayOfYear, final String tzID, final String sign) throws IOException {
        asyncHttpClient.prepareGet(BASE_URL_FR).execute(new AsyncCompletionHandler() {
            @Override
            public Object onCompleted(Response response) throws Exception {
                DocumentBuilder builder = builderLocal.get();
                String responseBody = response.getResponseBody("ISO-8859-1");
                StringReader reader = new StringReader(responseBody);
View Full Code Here

Examples of org.asynchttpclient.AsyncCompletionHandler

            RequestBuilder builder = new RequestBuilder();
            builder.setMethod(Method.CONNECT.getMethodString());
            builder.setUrl("http://" + getAuthority(requestUri));
            Request request = builder.build();

            AsyncHandler handler = new AsyncCompletionHandler() {
                @Override
                public Object onCompleted(Response response) throws Exception {
                    if (response.getStatusCode() != 200) {
                        PROXY_AUTH_FAILURE.set(ctx.getConnection(), Boolean.TRUE);
                    }
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.