Package org.restlet.resource

Examples of org.restlet.resource.Result


                            // Asynchronous mode where a callback
                            // object is to be called.
                            isSynchronous = false;

                            // Get the kind of result expected.
                            final Result rCallback = (Result) o;
                            Type[] genericParameterTypes = javaMethod
                                    .getGenericParameterTypes();
                            Type genericParameterType = genericParameterTypes[i];
                            ParameterizedType parameterizedType = (genericParameterType instanceof java.lang.reflect.ParameterizedType) ? (java.lang.reflect.ParameterizedType) genericParameterType
                                    : null;
                            final Class<?> actualType = (parameterizedType
                                    .getActualTypeArguments()[0] instanceof Class<?>) ? (Class<?>) parameterizedType
                                    .getActualTypeArguments()[0] : null;

                            // Define the callback
                            Uniform callback = new Uniform() {
                                @SuppressWarnings("unchecked")
                                public void handle(Request request,
                                        Response response) {
                                    if (response.getStatus().isError()) {
                                        rCallback
                                                .onFailure(new ResourceException(
                                                        response.getStatus()));
                                    } else {
                                        if (actualType != null) {
                                            rCallback
                                                    .onSuccess(getClientResource()
                                                            .toObject(
                                                                    response.getEntity(),
                                                                    actualType
                                                                            .getClass()));
                                        } else {
                                            rCallback.onSuccess(null);
                                        }
                                    }
                                }
                            };
View Full Code Here

TOP

Related Classes of org.restlet.resource.Result

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.