Search in sources :

Example 1 with PhonegapRPCService

use of com.googlecode.gwtphonegap.client.rpc.PhonegapRPCService in project gwtphonegap by dankurka.

the class PhonegapUtilImplDevice method prepareService.

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

        @Override
        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);
}
Also used : PhonegapRPCService(com.googlecode.gwtphonegap.client.rpc.PhonegapRPCService) RequestBuilder(com.google.gwt.http.client.RequestBuilder) RpcRequestBuilder(com.google.gwt.user.client.rpc.RpcRequestBuilder) RpcRequestBuilder(com.google.gwt.user.client.rpc.RpcRequestBuilder)

Aggregations

RequestBuilder (com.google.gwt.http.client.RequestBuilder)1 RpcRequestBuilder (com.google.gwt.user.client.rpc.RpcRequestBuilder)1 PhonegapRPCService (com.googlecode.gwtphonegap.client.rpc.PhonegapRPCService)1