Example usage for com.google.gwt.user.client.rpc RpcRequestBuilder RpcRequestBuilder

List of usage examples for com.google.gwt.user.client.rpc RpcRequestBuilder RpcRequestBuilder

Introduction

In this page you can find the example usage for com.google.gwt.user.client.rpc RpcRequestBuilder RpcRequestBuilder.

Prototype

RpcRequestBuilder

Source Link

Usage

From source file:com.ait.toolkit.core.client.RpcUtil.java

License:Open Source License

public static void prepareRpcService(ServiceDefTarget service, final String moduleUrl,
        final String relativeServiceUrl) {
    service.setServiceEntryPoint(moduleUrl + relativeServiceUrl);
    service.setRpcRequestBuilder(new RpcRequestBuilder() {
        @Override/*w  w w  .  ja  va  2 s. c om*/
        protected void doFinish(RequestBuilder rb) {
            super.doFinish(rb);
            rb.setHeader(MODULE_BASE_HEADER, moduleUrl);
        }
    });
}

From source file:com.googlecode.gwtphonegap.client.util.PhonegapUtilImplDevice.java

License:Apache License

@Override
public void prepareService(ServiceDefTarget service, final String moduleUrl, String relativeServiceUrl) {
    service.setServiceEntryPoint(moduleUrl + relativeServiceUrl);

    service.setRpcRequestBuilder(new RpcRequestBuilder() {

        @Override//from   w w  w.jav  a 2 s . c o  m
        protected void doFinish(RequestBuilder rb) {
            super.doFinish(rb);

            rb.setHeader(MODULE_BASE_HEADER, moduleUrl);
        }

    });

    if (!(service instanceof PhonegapRPCService)) {
        throw new IllegalStateException(
                "the rpc service you are trying to use was not generated by Phonegap RPC Serivce Generator");
    }
    PhonegapRPCService phonegapRPCService = (PhonegapRPCService) service;
    phonegapRPCService.setModuleBaseUrl(moduleUrl);

}

From source file:com.gwtplatform.dispatch.client.PhoneGapDispatchAsync.java

License:Apache License

@Override
protected void prepareService(ServiceDefTarget service, final String moduleUrl, String relativeServiceUrl) {
    service.setServiceEntryPoint(remoteServerUrl + relativeServiceUrl);
    service.setRpcRequestBuilder(new RpcRequestBuilder() {
        @Override//from  w  w w  .  ja  v a  2s  . c  o  m
        protected void doFinish(RequestBuilder requestBuilder) {
            super.doFinish(requestBuilder);

            requestBuilder.setHeader(MODULE_BASE_HEADER, remoteServerUrl);
        }
    });
}

From source file:gwtx.event.remote.client.RemoteEventBus.java

License:Apache License

private <T> T wrapRPCService(T service) {
    if (service == null)
        throw new NullPointerException("An initialized service object is required!");
    ServiceDefTarget target = (ServiceDefTarget) service;
    RpcRequestBuilder rpcRequestBuilder = new RpcRequestBuilder() {
        @Override//  ww  w. j a  va  2 s . c  o  m
        protected RequestBuilder doCreate(String serviceEntryPoint) {
            RequestBuilder requestBuilder = super.doCreate(serviceEntryPoint);
            if (sourceId != null) {
                requestBuilder.setHeader("X-GWT-RemoteEventSource", sourceId.asString());
            }
            requestBuilder.setTimeoutMillis(getTimeoutInMillis);
            return requestBuilder;
        }
    };
    target.setRpcRequestBuilder(rpcRequestBuilder);
    return service;
}

From source file:org.talend.mdm.webapp.base.client.ServiceEnhancer.java

License:Open Source License

public static void customizeService(ServiceDefTarget service) {

    service.setRpcRequestBuilder(new RpcRequestBuilder() {

        @Override/*  ww  w  .  j ava  2  s. c  o  m*/
        protected void doFinish(RequestBuilder rb) {
            super.doFinish(rb);
            Log.info(UrlUtil.getLanguage());
            rb.setHeader(LANGUAGE_HEADER, UrlUtil.getLanguage());
        }
    });
}