Package com.google.gwt.http.client

Examples of com.google.gwt.http.client.RequestBuilder


   
    /** Provides URIs for the various REST operations */
    protected UriBuilder uriBuilder;
   
    public void find(int id, ResourceResponseHandler handler) {
        RequestBuilder builder = buildGet(id);
        ResourceResponseCallback requestCallback = new ResourceResponseCallback(factory, handler);
        
        try {
            Request response = builder.sendRequest(null, requestCallback);
        } catch (RequestException e) {
            handler.onError(null, e);
        }
    }
View Full Code Here


            handler.onError(null, e);
        }
    }
   
    public void findAll(CollectionResponseHandler handler) {
        RequestBuilder builder = buildGet();
        CollectionResponseCallback requestCallback = new CollectionResponseCallback(factory, handler, parser);
       
        try {
            Request response = builder.sendRequest(null, requestCallback);
        } catch (RequestException e) {
            handler.onError(null, e);
        }
    }
View Full Code Here

            handler.onError(null, e);
        }
    }
   
    public void create(Resource resource, ResourceResponseHandler handler) {
        RequestBuilder builder = buildPost();
        ResourceResponseCallback requestCallback = new ResourceCreationResponseCallback(factory, handler);
       
        try {
            Request response = builder.sendRequest(resource.toRepresentation(), requestCallback);
        } catch (RequestException e) {
            handler.onError(null, e);
        }
       
    }
View Full Code Here

        }
       
    }
   
    public void update(Resource resource, StatusResponseHandler handler) {
        RequestBuilder builder = buildPut(resource.getId());
        StatusResponseCallback requestCallback = new StatusResponseCallback(handler);
       
        try {
            Request response = builder.sendRequest(resource.toRepresentation(), requestCallback);
        } catch (RequestException e) {
            handler.onError(null, e);
        }
    }
View Full Code Here

            handler.onError(null, e);
        }
    }
   
    public void delete(int id, StatusResponseHandler handler) {
        RequestBuilder builder = buildDelete(id);
        StatusResponseCallback requestCallback = new StatusResponseCallback(handler);
       
        try {
            Request response = builder.sendRequest(null, requestCallback);
        } catch (RequestException e) {
            handler.onError(null, e);
        }
    }
View Full Code Here

        }
    }
   
    /** Builds GET request for a collection of resources */
    protected RequestBuilder buildGet() {
        RequestBuilder builder = new RequestBuilder(
                RequestBuilder.GET,
                uriBuilder.buildCollectionGetUri(url));
        declareAccept(builder);
        return builder;
    }
View Full Code Here

        return builder;
    }
   
    /** Builds a GET request for a single resource */
    protected RequestBuilder buildGet(int id) {
        RequestBuilder builder = new RequestBuilder(
                RequestBuilder.GET,
                uriBuilder.buildGetUri(url, id));
        declareAccept(builder);
        return builder;
    }
View Full Code Here

        return builder;
    }
   
    /** Builds a POST for resource creation */
    protected RequestBuilder buildPost() {
        RequestBuilder builder = new RequestBuilder(
                RequestBuilder.POST,
                uriBuilder.buildPostUri(url));
        declareAccept(builder);
        declareContentType(builder);
        return builder;
View Full Code Here

    /**
     * Fakes a PUT over POST to update a resource. This tunneling is
     * necessary due to browser constraints.
     */
    protected RequestBuilder buildPut(int id) {
        RequestBuilder builder = new RequestBuilder(
                RequestBuilder.POST, // WebKit
                uriBuilder.buildPutUri(url, id));
        declareAccept(builder);
        declareContentType(builder);
        return builder;
View Full Code Here

    /**
     * Fakes a DELETE request for a resource. As with PUT, this tunneling is
     * necessary due to browser constraints.
     */
    protected RequestBuilder buildDelete(int id) {
        RequestBuilder builder = new RequestBuilder(
                RequestBuilder.POST, // WebKit
                uriBuilder.buildDeleteUri(url, id));
        declareAccept(builder);
        declareContentType(builder);
        return builder;
View Full Code Here

TOP

Related Classes of com.google.gwt.http.client.RequestBuilder

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.