Example usage for com.google.gwt.user.client.rpc ServiceDefTarget setServiceEntryPoint

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

Introduction

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

Prototype

void setServiceEntryPoint(String address);

Source Link

Document

Sets the URL of a service implementation.

Usage

From source file:ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractPluginViewContext.java

License:Apache License

public AbstractPluginViewContext(final IViewContext<ICommonClientServiceAsync> commonViewContext) {
    this.commonViewContext = commonViewContext;
    addMessageSource(getTechnology());/*from www  . j av a  2s .  c  o m*/
    service = createClientServiceAsync();
    final ServiceDefTarget endpoint = (ServiceDefTarget) service;
    endpoint.setServiceEntryPoint(GenericConstants.createServicePath(getTechnology()));
}

From source file:ch.systemsx.cisd.openbis.generic.client.web.client.application.Client.java

License:Apache License

private final IViewContext<ICommonClientServiceAsync> createViewContext(final Controller openUrlController) {
    final ICommonClientServiceAsync service = GWT.create(ICommonClientService.class);
    final ServiceDefTarget endpoint = (ServiceDefTarget) service;
    endpoint.setServiceEntryPoint(GenericConstants.COMMON_SERVER_NAME);
    final IGenericImageBundle imageBundle = GWT.<IGenericImageBundle>create(IGenericImageBundle.class);
    final IMessageProvider messageProvider = new DictonaryBasedMessageProvider("common");
    final IPageController pageController = new IPageController() {
        ///*from   w w  w.  ja v a 2  s . c  o m*/
        // IPageController
        //

        public final void reload(final boolean logout) {
            if (logout) {
                initializeControllers(openUrlController);
            }
            onModuleLoad();
        }
    };
    CommonViewContext commonContext = new CommonViewContext(service, messageProvider, imageBundle,
            pageController);
    commonContext.setClientPluginFactoryProvider(createPluginFactoryProvider(commonContext));
    return commonContext;
}

From source file:client.attic.CreateReservation.java

License:Open Source License

public CreateReservation() {
    final Button button = new Button();
    this.vert = new VerticalPanel();
    final ClickListener listener = new ClickListener() {
        public void onClick(final Widget sender) {

            final ArgonManagementServiceAsync emailService = (ArgonManagementServiceAsync) GWT
                    .create(ArgonManagementService.class);

            final ServiceDefTarget endpoint = (ServiceDefTarget) emailService;
            final String moduleRelativeURL = GWT.getModuleBaseURL() + "/gui/server/argon";
            endpoint.setServiceEntryPoint(moduleRelativeURL);

            // (3) Create an asynchronous callback to handle the result.
            ////from ww  w.  j a v  a2s  . c om
            final AsyncCallback callback = new AsyncCallback() {
                public void onSuccess(final Object result) {
                    final InfoDialog dialog = new InfoDialog("Result", (String) result);

                    dialog.show();
                    dialog.center();
                }

                public void onFailure(final Throwable caught) {
                    final InfoDialog dialog = new InfoDialog("Failure", new HTML(caught.toString()));

                    dialog.show();
                    dialog.center();

                }
            };

            emailService.getDomainName(callback);
        }

    };

    button.addClickListener(listener);
    button.setText("Click me");
    this.vert.add(button);
    this.vert.setWidth("100%");
    this.initWidget(this.vert);

}

From source file:client.helper.RpcRequest.java

License:Open Source License

/**
 * Create Argon RPC request class.//from   ww  w.ja va2s.c  o m
 */
private static final void createArgon() {
    System.out.println("before");
    RpcRequest.argonService = (ArgonManagementServiceAsync) GWT.create(ArgonManagementService.class);

    final ServiceDefTarget argonEndpoint = (ServiceDefTarget) RpcRequest.argonService;
    final String argonRelativeURL = GWT.getModuleBaseURL() + RpcRequest.ARGON_URL;
    argonEndpoint.setServiceEntryPoint(argonRelativeURL);
}

From source file:client.helper.RpcRequest.java

License:Open Source License

/**
 * Create NSP RPC request class.// ww  w. j  a v  a2s . c o  m
 */
private static final void createNsp() {
    RpcRequest.nspService = (NspClientProxyAsync) GWT.create(NspClientProxy.class);

    final ServiceDefTarget nspEndpoint = (ServiceDefTarget) RpcRequest.nspService;
    final String nspRelativeURL = GWT.getModuleBaseURL() + RpcRequest.NSP_URL;
    nspEndpoint.setServiceEntryPoint(nspRelativeURL);
}

From source file:client.helper.RpcRequest.java

License:Open Source License

/**
 * Create NSP RPC request class./*from w w w . j av a2  s  .  c om*/
 */
private static final void createCommon() {
    RpcRequest.commonService = (CommonServiceAsync) GWT.create(CommonService.class);

    final ServiceDefTarget commonEndpoint = (ServiceDefTarget) RpcRequest.commonService;
    final String commonRelativeURL = GWT.getModuleBaseURL() + RpcRequest.COMMON_URL;
    commonEndpoint.setServiceEntryPoint(commonRelativeURL);
}

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/*from   w w  w. j  ava2s  .  c  o  m*/
        protected void doFinish(RequestBuilder rb) {
            super.doFinish(rb);
            rb.setHeader(MODULE_BASE_HEADER, moduleUrl);
        }
    });
}

From source file:com.allen_sauer.gwt.log.client.RemoteLoggerImpl.java

License:Apache License

public RemoteLoggerImpl() {
    if (!GWT.isClient()) {
        throw new UnsupportedOperationException();
    }//from  w  ww.j  ava 2  s . com
    service = (RemoteLoggerServiceAsync) GWT.create(RemoteLoggerService.class);
    final ServiceDefTarget target = (ServiceDefTarget) service;
    String serviceEntryPointUrl = config.serviceEntryPointUrl();
    if (serviceEntryPointUrl != null) {
        target.setServiceEntryPoint(serviceEntryPointUrl);
    }

    callback = new AsyncCallback<ArrayList<LogRecord>>() {

        @Override
        public void onFailure(Throwable ex) {
            String serviceEntryPoint = ((ServiceDefTarget) service).getServiceEntryPoint();
            GWT.log(REMOTE_LOGGER_NAME + " has failed to contact servlet at " + serviceEntryPoint, ex);
            GWT.log(REMOTE_LOGGER_NAME + " has suspended with " + logRecordList.size()
                    + " log message(s) not delivered", null);
            failure = ex;
            callInProgressOrScheduled = false;
        }

        @Override
        public void onSuccess(ArrayList<LogRecord> deobfuscatedLogRecords) {
            if (GWT.isProdMode() && deobfuscatedLogRecords != null) {
                for (LogRecord record : deobfuscatedLogRecords) {
                    if (record.getThrowable() != null) {
                        RemoteLoggerImpl.super.loggersLog(record);
                    }
                }
            }
            callInProgressOrScheduled = false;
            maybeTriggerRPC();
        }

    };
}

From source file:com.apress.progwt.client.GWTApp.java

License:Apache License

/**
 * call initServices if your GWTApp would like the asynchronous
 * services to be setup//from   w ww.j  av  a 2  s .c  o  m
 */
protected void initServices() {

    schoolService = (GWTSchoolServiceAsync) GWT.create(GWTSchoolService.class);
    ServiceDefTarget endpoint = (ServiceDefTarget) schoolService;

    String pre = Interactive.getRelativeURL("service/");

    endpoint.setServiceEntryPoint(pre + "schoolService");

    userService = (GWTUserServiceAsync) GWT.create(GWTUserService.class);
    ServiceDefTarget endpointUser = (ServiceDefTarget) userService;
    endpointUser.setServiceEntryPoint(pre + "userService");

    if (schoolService == null || userService == null) {
        Log.error("Service was null.");
    }

    serviceCache = new ServiceCache(this);
    loginService = new LoginService(serviceCache);

}

From source file:com.centimia.gxt.sample.widgetdashboard.client.WidgetDashboard.java

License:Open Source License

public void onModuleLoad() {
    String styleSheetName = "resources/css/gxt-all.css";
    if (LocaleInfo.getCurrentLocale().isRTL()) {
        styleSheetName = "resources/css/gxt-all-rtl.css";
    }//from w  w w .j a  v  a 2s . co m

    // Find existing style sheets that need to be removed
    boolean styleSheetsFound = false;
    final HeadElement headElem = StyleSheetLoader.getHeadElement();
    final List<Element> toRemove = new ArrayList<Element>();
    NodeList<Node> children = headElem.getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
        Node node = children.getItem(i);
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            Element elem = Element.as(node);
            if (elem.getTagName().equalsIgnoreCase("link")
                    && elem.getPropertyString("rel").equalsIgnoreCase("stylesheet")) {
                styleSheetsFound = true;
                String href = elem.getPropertyString("href");
                // If the correct style sheets are already loaded, then we should have
                // nothing to remove.
                if (!href.equals(styleSheetName) && href.indexOf("gxt") != -1) {
                    toRemove.add(elem);
                }
            }
        }
    }

    // Return if we already have the correct style sheets
    if (styleSheetsFound && toRemove.size() != 0) {
        // Remove the old style sheets
        for (Element elem : toRemove) {
            headElem.removeChild(elem);
        }
    }

    ExampleServiceAsync service = (ExampleServiceAsync) GWT.create(ExampleService.class);
    ServiceDefTarget endpoint = (ServiceDefTarget) service;
    String moduleRelativeURL = SERVICE;
    endpoint.setServiceEntryPoint(moduleRelativeURL);
    Registry.register(SERVICE, service);

    FileServiceAsync fileservice = (FileServiceAsync) GWT.create(FileService.class);
    endpoint = (ServiceDefTarget) fileservice;
    moduleRelativeURL = FILE_SERVICE;
    endpoint.setServiceEntryPoint(moduleRelativeURL);
    Registry.register(FILE_SERVICE, fileservice);

    ExamplesModel model = new ExamplesModel();
    for (int i = 0; i < model.getChildren().size(); i++) {
        Category cat = (Category) model.getChildren().get(i);
        for (int j = 0; j < cat.getChildren().size(); j++) {
            Entry entry = (Entry) cat.getChildren().get(j);
            examples.put(entry.getId(), entry);
        }
    }

    Registry.register(MODEL, model);
    viewport = new Viewport();

    BorderLayout layout = new BorderLayout();

    demoPanel = new ContentPanel();
    demoPanel.setLayout(new BorderLayout());

    viewport.setLayout(layout);

    createNorth();

    createTree();
    panel.setResizeTabs(true);
    panel.setMinTabWidth(115);
    panel.setAnimScroll(true);
    panel.setTabScroll(true);
    panel.setCloseContextMenu(true);

    replaceView("basicgrid");
    demoPanel.add(panel, new BorderLayoutData(LayoutRegion.CENTER));

    viewport.add(tree, new BorderLayoutData(LayoutRegion.WEST));
    viewport.add(demoPanel, new BorderLayoutData(LayoutRegion.CENTER));

    StyleSheetLoader.loadStyleSheet(styleSheetName, "ext-el-mask", this);
}