SlideShare une entreprise Scribd logo
1  sur  16
GWT - RPC
The Objects com.google.gwt.user.client.rpc.RemoteService com.google.gwt.user.client.rpc.AsyncCallback com.google.gwt.user.client.rpc.ServiceDefTarget com.google.gwt.user.server.rpc.RemoteServiceServlet
RPC plumbing diagram
RPC plumbing diagram package com.mycompany.client; import com.google.gwt.user.client.rpc.RemoteService; public interface MyAddService extends RemoteService { public int add(int a, int b); }
RPC plumbing diagram package com.mycompany.server; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.mycompany.client.MyAddService; public class MyAddServiceImpl  extends RemoteServiceServlet implements MyAddService{ public int add(int a, int b) { int z = a + b; return z; } }
RPC plumbing diagram package com.mycompany.client; import com.google.gwt.user.client.rpc.AsyncCallback; public interface MyAddServiceAsync { public void add(int a, int b, AsyncCallback callback); }
Deploy service ,[object Object],[object Object],<module> <inherits name='com.google.gwt.user.User'/> <entry-point class='com.mycompany.client.MyApplication'/> <servlet path=&quot;/addService&quot;    class=&quot;com.mycompany.server.MyAddServiceImpl“/> </module>
Actually making a call button.addClickListener( new ClickListener() { public void onClick(Widget sender) { AddServiceAsync addService = (AddServiceAsync) GWT.create(AddService.class);   ServiceDefTarget endpoint = (ServiceDefTarget) addService;   String moduleRelativeURL = GWT.getModuleBaseURL() + &quot;myAddService“;   endpoint.setServiceEntryPoint(moduleRelativeURL); instantiate service interface set service implementation url
Actually making a call button.addClickListener( new ClickListener() { public void onClick(Widget sender) { AddServiceAsync addService = (AddServiceAsync) GWT.create(AddService.class);   ServiceDefTarget endpoint = (ServiceDefTarget) addService;   String moduleRelativeURL = GWT.getModuleBaseURL() + &quot;myAddService“;   endpoint.setServiceEntryPoint(moduleRelativeURL); AsyncCallback callback = new AsyncCallback(){ public void onSuccess(Object result){ resultaatLabel.setText(result.toString()); } public void onFailure(Throwable caught) { resultaatLabel.setText(caught.getMessage()); } create an asynchronous callback to handle the result
Actually making a call button.addClickListener( new ClickListener() { public void onClick(Widget sender) { AddServiceAsync addService = (AddServiceAsync) GWT.create(AddService.class);   ServiceDefTarget endpoint = (ServiceDefTarget) addService;   String moduleRelativeURL = GWT.getModuleBaseURL() + &quot;myAddService“;   endpoint.setServiceEntryPoint(moduleRelativeURL); AsyncCallback callback = new AsyncCallback(){ public void onSuccess(Object result){ resultaatLabel.setText(result.toString()); } public void onFailure(Throwable caught) { resultaatLabel.setText(caught.getMessage()); } }; addService.add(Integer.parseInt(aBox.getText()),  Integer.parseInt(bBox.getText()),  callback); }    } ); actually make the call
Actually making a call button.addClickListener( new ClickListener() { public void onClick(Widget sender) { AddServiceAsync addService = (AddServiceAsync) GWT.create(AddService.class);   ServiceDefTarget endpoint = (ServiceDefTarget) addService;   String moduleRelativeURL = GWT.getModuleBaseURL() + &quot;myAddService“;   endpoint.setServiceEntryPoint(moduleRelativeURL); AsyncCallback callback = new AsyncCallback(){ public void onSuccess(Object result){ resultaatLabel.setText(result.toString()); } public void onFailure(Throwable caught) { resultaatLabel.setText(caught.getMessage()); } }; addService.add(Integer.parseInt(aBox.getText()),  Integer.parseInt(bBox.getText()),  callback); }    } );
code executed on client side code executed on server side
Service Implementation Path ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Servlet Mapping ,[object Object],[object Object],[object Object],[object Object]
More info ,[object Object]
[object Object],[object Object],[object Object]

Contenu connexe

Tendances

Tendances (20)

The Ring programming language version 1.10 book - Part 72 of 212
The Ring programming language version 1.10 book - Part 72 of 212The Ring programming language version 1.10 book - Part 72 of 212
The Ring programming language version 1.10 book - Part 72 of 212
 
Android getting started
Android getting startedAndroid getting started
Android getting started
 
Rxjs swetugg
Rxjs swetuggRxjs swetugg
Rxjs swetugg
 
What's new in Android O
What's new in Android OWhat's new in Android O
What's new in Android O
 
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
 
Powering code reuse with context and render props
Powering code reuse with context and render propsPowering code reuse with context and render props
Powering code reuse with context and render props
 
Retrofit Technology Overview by Cumulations Technologies
Retrofit Technology Overview by Cumulations TechnologiesRetrofit Technology Overview by Cumulations Technologies
Retrofit Technology Overview by Cumulations Technologies
 
Gradle plugins 101
Gradle plugins 101Gradle plugins 101
Gradle plugins 101
 
Тестирование на Android с Dagger 2
Тестирование на Android с Dagger 2Тестирование на Android с Dagger 2
Тестирование на Android с Dagger 2
 
Why Kotlin - Apalon Kotlin Sprint Part 1
Why Kotlin - Apalon Kotlin Sprint Part 1Why Kotlin - Apalon Kotlin Sprint Part 1
Why Kotlin - Apalon Kotlin Sprint Part 1
 
Dagger 2. The Right Way to Dependency Injections
Dagger 2. The Right Way to Dependency InjectionsDagger 2. The Right Way to Dependency Injections
Dagger 2. The Right Way to Dependency Injections
 
Dagger 2. Right way to do Dependency Injection
Dagger 2. Right way to do Dependency InjectionDagger 2. Right way to do Dependency Injection
Dagger 2. Right way to do Dependency Injection
 
My way to clean android v2 English DroidCon Spain
My way to clean android v2 English DroidCon SpainMy way to clean android v2 English DroidCon Spain
My way to clean android v2 English DroidCon Spain
 
Under the Hood: Using Spring in Grails
Under the Hood: Using Spring in GrailsUnder the Hood: Using Spring in Grails
Under the Hood: Using Spring in Grails
 
Under the Hood: Using Spring in Grails
Under the Hood: Using Spring in GrailsUnder the Hood: Using Spring in Grails
Under the Hood: Using Spring in Grails
 
Small pieces loosely joined
Small pieces loosely joinedSmall pieces loosely joined
Small pieces loosely joined
 
Advanced Dagger talk from 360andev
Advanced Dagger talk from 360andevAdvanced Dagger talk from 360andev
Advanced Dagger talk from 360andev
 
Pipeline interface
Pipeline interfacePipeline interface
Pipeline interface
 
Advanced Akka For Architects
Advanced Akka For ArchitectsAdvanced Akka For Architects
Advanced Akka For Architects
 
Angular mix chrisnoring
Angular mix chrisnoringAngular mix chrisnoring
Angular mix chrisnoring
 

En vedette (7)

SOA Facts&amp;Actions
SOA Facts&amp;ActionsSOA Facts&amp;Actions
SOA Facts&amp;Actions
 
Bit Oceans Brochure
Bit Oceans BrochureBit Oceans Brochure
Bit Oceans Brochure
 
Grimes, Jason Power Point Presentation Cfs294
Grimes, Jason Power Point Presentation Cfs294Grimes, Jason Power Point Presentation Cfs294
Grimes, Jason Power Point Presentation Cfs294
 
Heligonix roi
Heligonix roiHeligonix roi
Heligonix roi
 
The Greene County 100 Club V2
The Greene County 100 Club V2The Greene County 100 Club V2
The Greene County 100 Club V2
 
The State of DITA 2014
The State of DITA 2014The State of DITA 2014
The State of DITA 2014
 
Buildingleadswithlinkedin Kuno Creative
Buildingleadswithlinkedin Kuno CreativeBuildingleadswithlinkedin Kuno Creative
Buildingleadswithlinkedin Kuno Creative
 

Similaire à Gwt RPC

Google Developer Fest 2010
Google Developer Fest 2010Google Developer Fest 2010
Google Developer Fest 2010
Chris Ramsdale
 

Similaire à Gwt RPC (20)

Google Web Toolkits
Google Web ToolkitsGoogle Web Toolkits
Google Web Toolkits
 
Qt & Webkit
Qt & WebkitQt & Webkit
Qt & Webkit
 
Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02
 
GWT
GWTGWT
GWT
 
Gooogle Web Toolkit
Gooogle Web ToolkitGooogle Web Toolkit
Gooogle Web Toolkit
 
Vaadin 7 Today and Tomorrow
Vaadin 7 Today and TomorrowVaadin 7 Today and Tomorrow
Vaadin 7 Today and Tomorrow
 
Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010Building Web Apps Sanely - EclipseCon 2010
Building Web Apps Sanely - EclipseCon 2010
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Vaadin today and tomorrow
Vaadin today and tomorrowVaadin today and tomorrow
Vaadin today and tomorrow
 
GWT MVP Case Study
GWT MVP Case StudyGWT MVP Case Study
GWT MVP Case Study
 
GWT training session 3
GWT training session 3GWT training session 3
GWT training session 3
 
Google Web Toolkits
Google Web ToolkitsGoogle Web Toolkits
Google Web Toolkits
 
Google Developer Fest 2010
Google Developer Fest 2010Google Developer Fest 2010
Google Developer Fest 2010
 
GDG Devfest 2019 - Build go kit microservices at kubernetes with ease
GDG Devfest 2019 - Build go kit microservices at kubernetes with easeGDG Devfest 2019 - Build go kit microservices at kubernetes with ease
GDG Devfest 2019 - Build go kit microservices at kubernetes with ease
 
JBoss World 2010
JBoss World 2010JBoss World 2010
JBoss World 2010
 
"Migrate large gwt applications - Lessons Learned" By Harald Pehl
"Migrate large gwt applications - Lessons Learned" By Harald Pehl"Migrate large gwt applications - Lessons Learned" By Harald Pehl
"Migrate large gwt applications - Lessons Learned" By Harald Pehl
 
Reactive programming every day
Reactive programming every dayReactive programming every day
Reactive programming every day
 
SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!
 
ng-grid and a Simple REST API
ng-grid and a Simple REST APIng-grid and a Simple REST API
ng-grid and a Simple REST API
 
Part 1: ng-grid and a Simple REST API
Part 1: ng-grid and a Simple REST APIPart 1: ng-grid and a Simple REST API
Part 1: ng-grid and a Simple REST API
 

Gwt RPC

  • 2. The Objects com.google.gwt.user.client.rpc.RemoteService com.google.gwt.user.client.rpc.AsyncCallback com.google.gwt.user.client.rpc.ServiceDefTarget com.google.gwt.user.server.rpc.RemoteServiceServlet
  • 4. RPC plumbing diagram package com.mycompany.client; import com.google.gwt.user.client.rpc.RemoteService; public interface MyAddService extends RemoteService { public int add(int a, int b); }
  • 5. RPC plumbing diagram package com.mycompany.server; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.mycompany.client.MyAddService; public class MyAddServiceImpl extends RemoteServiceServlet implements MyAddService{ public int add(int a, int b) { int z = a + b; return z; } }
  • 6. RPC plumbing diagram package com.mycompany.client; import com.google.gwt.user.client.rpc.AsyncCallback; public interface MyAddServiceAsync { public void add(int a, int b, AsyncCallback callback); }
  • 7.
  • 8. Actually making a call button.addClickListener( new ClickListener() { public void onClick(Widget sender) { AddServiceAsync addService = (AddServiceAsync) GWT.create(AddService.class); ServiceDefTarget endpoint = (ServiceDefTarget) addService; String moduleRelativeURL = GWT.getModuleBaseURL() + &quot;myAddService“; endpoint.setServiceEntryPoint(moduleRelativeURL); instantiate service interface set service implementation url
  • 9. Actually making a call button.addClickListener( new ClickListener() { public void onClick(Widget sender) { AddServiceAsync addService = (AddServiceAsync) GWT.create(AddService.class); ServiceDefTarget endpoint = (ServiceDefTarget) addService; String moduleRelativeURL = GWT.getModuleBaseURL() + &quot;myAddService“; endpoint.setServiceEntryPoint(moduleRelativeURL); AsyncCallback callback = new AsyncCallback(){ public void onSuccess(Object result){ resultaatLabel.setText(result.toString()); } public void onFailure(Throwable caught) { resultaatLabel.setText(caught.getMessage()); } create an asynchronous callback to handle the result
  • 10. Actually making a call button.addClickListener( new ClickListener() { public void onClick(Widget sender) { AddServiceAsync addService = (AddServiceAsync) GWT.create(AddService.class); ServiceDefTarget endpoint = (ServiceDefTarget) addService; String moduleRelativeURL = GWT.getModuleBaseURL() + &quot;myAddService“; endpoint.setServiceEntryPoint(moduleRelativeURL); AsyncCallback callback = new AsyncCallback(){ public void onSuccess(Object result){ resultaatLabel.setText(result.toString()); } public void onFailure(Throwable caught) { resultaatLabel.setText(caught.getMessage()); } }; addService.add(Integer.parseInt(aBox.getText()), Integer.parseInt(bBox.getText()), callback); } } ); actually make the call
  • 11. Actually making a call button.addClickListener( new ClickListener() { public void onClick(Widget sender) { AddServiceAsync addService = (AddServiceAsync) GWT.create(AddService.class); ServiceDefTarget endpoint = (ServiceDefTarget) addService; String moduleRelativeURL = GWT.getModuleBaseURL() + &quot;myAddService“; endpoint.setServiceEntryPoint(moduleRelativeURL); AsyncCallback callback = new AsyncCallback(){ public void onSuccess(Object result){ resultaatLabel.setText(result.toString()); } public void onFailure(Throwable caught) { resultaatLabel.setText(caught.getMessage()); } }; addService.add(Integer.parseInt(aBox.getText()), Integer.parseInt(bBox.getText()), callback); } } );
  • 12. code executed on client side code executed on server side
  • 13.
  • 14.
  • 15.
  • 16.