Package com.google.gwt.http.client

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


     */
    @Override
    protected <T> RequestBuilder doPrepareRequestBuilder(ResponseReader responseReader, String methodName,
        RpcStatsContext statsContext, String requestData, AsyncCallback<T> callback) {

        RequestBuilder rb = super.doPrepareRequestBuilder(responseReader, methodName, statsContext, requestData,
            callback);

        String sessionId = UserSessionManager.getSessionId();
        if (sessionId != null) {
            if (Log.isDebugEnabled()) {
                Log.debug("SessionRpcRequestBuilder is adding sessionId to request for (" + methodName + ")");
            }
            rb.setHeader(UserSessionManager.SESSION_NAME, sessionId);
        } else {
            Log.error("SessionRpcRequestBuilder missing sessionId for request (" + methodName + ")");
        }

        return rb;
View Full Code Here


            }
        }

        @Override
        protected RequestBuilder doCreate(String serviceEntryPoint) {
            RequestBuilder rb = super.doCreate(serviceEntryPoint);
            rb.setTimeoutMillis(this.timeout);

            String sessionId = UserSessionManager.getSessionId();
            if (sessionId != null) {
                if (Log.isDebugEnabled()) {
                    Log.debug("SessionRpcRequestBuilder is adding sessionId(" + sessionId + ") to request("
                        + serviceEntryPoint + ")");
                }
                rb.setHeader(UserSessionManager.SESSION_NAME, sessionId);
            } else {
                Log.error("SessionRpcRequestBuilder missing sessionId for request(" + serviceEntryPoint + ") ");
            }

            return rb;
View Full Code Here

    private static final String SETTINGS_KEY = "settings";

    private String endpointURL;

    public void saveSettings(@Nonnull final RequestCallback callback) {
        RequestBuilder builder = buildRequest(RequestBuilder.GET, buildEndpointURL());
        execute(null, builder, callback);
    }
View Full Code Here

        RequestBuilder builder = buildRequest(RequestBuilder.GET, buildEndpointURL());
        execute(null, builder, callback);
    }

    public void retrieveSettings(@Nonnull final Settings settings, @Nonnull final RequestCallback callback) {
        RequestBuilder builder = buildRequest(RequestBuilder.PUT, buildEndpointURL());
        execute(Converter.convertToRemoteSettings(settings), builder, callback);
    }
View Full Code Here

    @Nonnull
    private RequestBuilder buildRequest(@Nonnull final RequestBuilder.Method method,
                                        @Nonnull final String url) {
        assert !"".equals(url);
       
        RequestBuilder builder = new RequestBuilder(method, url);
        builder.setHeader(CONTENT_TYPE_HEADER, JSON_TYPE);
        builder.setHeader(ACCEPT_HEADER, JSON_TYPE);

        return builder;
    }
View Full Code Here

    private static final String CONTENT_TYPE_HEADER = "Content-Type";
    private static final String ACCEPT_HEADER = "Accept";
    private static final String ATOM_TYPE = "application/atom+xml";

    public void getFeed(@Nonnull final String url, @Nonnull final RequestCallback callback) {
        RequestBuilder builder = buildRequest(GET, url);

        try {
            builder.sendRequest(null, callback);
        } catch (RequestException ex) {

            // TODO add custom exception
            throw new RuntimeException(ex);
        }
View Full Code Here

    @Nonnull
    private RequestBuilder buildRequest(@Nonnull final Method method, @Nonnull final String url) {
        assert !"".equals(url);
       
        RequestBuilder builder = new RequestBuilder(method, url);
        builder.setHeader(CONTENT_TYPE_HEADER, ATOM_TYPE);
        builder.setHeader(ACCEPT_HEADER, ATOM_TYPE);

        return builder;
    }
View Full Code Here

     * @throws RequestException
     *             if the request could not be sent
     */
    protected void doAsyncUIDLRequest(String uri, String payload,
            RequestCallback requestCallback) throws RequestException {
        RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, uri);
        // TODO enable timeout
        // rb.setTimeoutMillis(timeoutMillis);
        rb.setHeader("Content-Type", "text/plain;charset=utf-8");
        rb.setRequestData(payload);
        rb.setCallback(requestCallback);

        rb.send();
    }
View Full Code Here

    }

    @Override
    public RequestControl get(String mimeType, String url,
        final AsyncCallback<String> callback) {
        RequestBuilder b = new RequestBuilder(RequestBuilder.GET,
                this.originProxyPath);
        b.setHeader(ACCEPT_HEADER, mimeType);
        b.setHeader(CONTENT_TYPE_HEADER, mimeType);
        b.setHeader(X_PROXY_LOCATION_HEADER, url);
        return super.doRequest(b, new GenericRequestCallback(HTTPTransport.DELETE_RESPONSE_CODES, false, callback));
    }
View Full Code Here

    }

    @Override
    public RequestControl delete(String mimeType, String url,
        final AsyncCallback callback) {
        RequestBuilder b = new RequestBuilder(RequestBuilder.GET,
                this.originProxyPath);
        b.setHeader(X_REST_METHOD_HEADER, "DELETE");
        b.setHeader(X_PROXY_LOCATION_HEADER, url);
        b.setHeader(ACCEPT_HEADER, mimeType);
        b.setHeader(CONTENT_TYPE_HEADER, mimeType);
        return super.doRequest(b, new GenericRequestCallback(HTTPTransport.GET_RESPONSE_CODES, true, callback));
    }
View Full Code Here

TOP

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

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.