GWT in Practice

Free Download

Authors:

ISBN: 9781933988290, 1933988290

Size: 11 MB (11322568 bytes)

Pages: 377/377

File format:

Language:

Publishing Year:

Category:

Robert Cooper, Charles Collins9781933988290, 1933988290

If you’re a web developer, you know that you can use Ajax to add rich, user-friendly, dynamic features to your applications. With the Google Web Toolkit (GWT), a new Ajax tool from Google that automatically converts Java to JavaScript, you can build Ajax applications using the Java language.
GWT in Practice is an example-driven, code-rich book designed for web developers already familiar with the basics of GWT who now want hands-on experience. After a quick review of GWT fundamentals, GWT in Practice presents scores of handy, reusable solutions to the problems you face when you need to move beyond “Hello World” and “proof of concept” applications. This book skips the theory and looks at the way things really work when you’re building. I also shows you where GWT fits into the Enterprise Java Developer’s toolset. Written by expert authors Robert Cooper and Charlie Collins, this book combines sharp insight with hard-won experience. Readers will find thorough coverage of all aspects of GWT development from the basic GWT concepts to in depth real world example applications.
The first part of the book is a rapid introduction to the GWT methodology The second part of the book then delves into several practical examples which further demonstrate core aspects of the toolkit The book concludes by presenting several larger GWT applications including drag and drop support for UI elements, data binding, processing streaming data, handling application state, automated builds, and continuous integration.
Along the way GWT in Practice covers many additional facets of working with the toolkit. Various development tools are used throughout the book, including Eclipse, NetBeans, IDEA, Ant, Maven, and, of course, the old fashioned command line. The book also addresses integrating GWT with existing applications and services along with enterprise and team development.

Table of contents :
GWT in Practice……Page 1
preface……Page 12
Robert Cooper……Page 13
about this book……Page 14
Roadmap……Page 15
Author Online……Page 17
about the cover illustration……Page 18
Part 1 – Getting Started……Page 20
Introducing GWT……Page 22
1.1.1 History……Page 24
1.1.2 Why Ajax matters……Page 25
1.1.4 Tooling and testing……Page 26
1.1.6 Limitations……Page 27
1.2.1 GWT compiler……Page 28
1.2.3 Remote Procedure Calls……Page 29
1.2.4 Additional utilities……Page 30
1.2.5 GWT shell……Page 31
1.3.1 Modules and inheritance……Page 32
1.3.2 Host pages……Page 33
1.4 Working with the GWT shell……Page 35
1.4.1 The logging console……Page 36
1.4.2 The hosted mode browser……Page 37
1.5 Understanding the GWT compiler……Page 38
1.5.1 JavaScript output style……Page 39
1.5.2 Additional compiler nuances……Page 42
1.5.3 The compiler lifecycle……Page 43
1.6 Summary……Page 49
A New Kind of Client……Page 51
2.1 Basic project structure and components……Page 52
2.1.1 Generating a project……Page 53
2.1.2 The standard directory structure……Page 54
2.1.3 GWT starting point files……Page 55
2.1.4 Host pages……Page 56
2.1.5 Modules……Page 57
2.2 Design patterns and GWT……Page 59
2.2.1 MVC and GWT……Page 60
2.2.2 Creating a widget……Page 61
2.2.3 Communicating by observing events……Page 65
2.2.4 Operator strategy……Page 67
2.2.5 Controlling the action……Page 70
2.3.1 Providing a CSS file……Page 73
2.4 Running a completed project……Page 75
2.4.1 Hosted mode and the GWT shell……Page 76
2.4.2 Web mode and the GWT compiler……Page 77
2.5 Summary……Page 78
Communicating with the Server……Page 80
3.1.1 Starting the HelloServer project……Page 81
3.1.2 Defining GWT serializable data……Page 83
3.1.3 Creating RPC services……Page 85
3.1.4 Expanding on RemoteServiceServlet……Page 88
3.1.5 Calling the server from the client……Page 89
3.1.6 Troubleshooting server communication……Page 93
3.2.1 The web.xml file……Page 94
3.2.2 The context.xml file……Page 96
3.3 Using an external development server……Page 98
3.4 Summary……Page 99
Part 2 – Task-specific Issues……Page 102
Core Application Structure……Page 104
4.1 Building a model……Page 105
4.2.1 Extending widgets……Page 109
4.2.2 Extending composite……Page 112
4.2.3 Binding to the model with events……Page 114
4.3 The controller and service……Page 117
4.3.1 Creating a simple controller……Page 118
4.3.2 JPA-enabling the model……Page 119
4.3.3 Creating a JPA-enabled service……Page 123
4.4 Summary……Page 125
Other Techniques for Talking to Servers……Page 126
5.1.1 Dealing with browser security……Page 127
5.1.3 Coding asynchronously……Page 129
5.1.4 Developing GWT applications in NetBeans……Page 130
5.2.1 Making basic HTTP requests with GWT……Page 131
5.2.2 Making advanced HTTP requests with GWT……Page 133
5.2.3 Working with XML……Page 134
5.3.1 Using GWT JavaDoc annotations to serialize collections……Page 135
5.3.2 Using JSON……Page 138
5.4.1 Using Flash as a SOAP client……Page 140
5.4.2 Setting a Flash security context……Page 149
5.5.1 Using Java as a SOAP client……Page 150
5.5.2 Signing JARs for security bypass……Page 155
5.6 Streaming to the browser with Comet……Page 156
5.7 Summary……Page 166
Integrating Legacy and Third-Party Ajax Libraries……Page 167
6.1.1 JSNI basics revisited……Page 168
6.1.2 Potential JSNI pitfalls……Page 170
6.1.3 Configuring IntelliJ IDEA……Page 172
6.2 Wrapping JavaScript libraries……Page 174
6.2.2 Creating wrapper classes……Page 175
6.2.3 Using the wrapped packages……Page 178
6.3.1 Maintaining lookups……Page 181
6.3.2 Daisy-chaining Java listeners into JavaScript closures……Page 185
6.3.3 Maintaining listeners in Java……Page 187
6.3.4 Conversion between Java and JavaScript……Page 191
6.4 Wrapping JavaScript with GWT-API-Interop……Page 197
6.5 Summary……Page 200
Building, Packaging, and Deploying……Page 202
7.1.1 Building and packaging modules……Page 203
7.1.2 Sharing modules……Page 205
7.2 Building and deploying applications……Page 206
7.2.2 The server side……Page 207
7.2.3 Manually building a WAR file……Page 208
7.3.1 Extending the Ant build……Page 210
7.3.2 Using Maven……Page 214
7.4 Managing Tomcat Lite from the build……Page 224
7.5 Summary……Page 229
Testing and Continuous Integration……Page 230
8.1.1 Knowing what to test……Page 231
8.1.2 How GWT testing works……Page 232
8.1.3 Testing gotchas……Page 233
8.1.4 Basic GWT tests……Page 236
8.1.5 Testing outside of GWT……Page 243
8.2 Advanced testing concepts……Page 245
8.2.1 Benchmarking……Page 246
8.2.2 Remote testing……Page 248
8.2.3 Code coverage……Page 250
8.2.4 Coverage in an automated build……Page 253
8.3 Continuous integration……Page 258
8.3.1 Adding a GWT project to Hudson……Page 259
8.4 Summary……Page 263
Part 3 – Fully Formed Applications……Page 266
Java Enterprise Reinvented……Page 268
9.1 Constructing two models……Page 270
9.2 Mapping to DTOs……Page 276
9.3 Wiring applications with Spring……Page 279
9.4 Constructing the client application……Page 284
9.4.1 The controller and global model……Page 285
9.4.2 The basic CRUD wrapper……Page 288
9.4.3 The BookEdit widget……Page 291
9.5 Summary……Page 298
Building the Storefront……Page 300
10.1 Securing GWT applications……Page 301
10.2 Building a drag-and-drop system……Page 308
10.2.1 Enabling dragging……Page 309
10.2.2 Handling drops……Page 312
10.3 JSNI special effects……Page 315
10.4 Summary……Page 318
Managing Application State……Page 319
11.1 Overview of the sample application……Page 320
11.2 Creating a basic messaging service……Page 323
11.3.1 Messages and CometEvents……Page 329
11.3.2 Streaming messages to the client……Page 331
11.3.3 Receiving images……Page 334
11.4 Recording and playing back conversations……Page 336
11.4.1 Capturing changes to the model layer……Page 339
11.4.2 Handling deep links……Page 344
11.4.3 When to use hyperlinks rather than history……Page 345
11.5 Dealing with state on the server side……Page 346
11.6.1 Displaying events……Page 349
11.6.2 Sending events……Page 350
11.6.3 Cleaning up……Page 352
11.7 Summary……Page 353
GWTx……Page 354
GWT-Ext……Page 355
GWT Studio (IDEA)……Page 356
GWTShell……Page 357
GWTCompiler……Page 358
ProjectCreator……Page 359
Module descriptor elements……Page 360
Host page entries……Page 361
JRE library classes……Page 362
UI components and properties……Page 363
Listener and source interfaces……Page 368
C……Page 370
F……Page 371
H……Page 372
L……Page 373
P……Page 374
S……Page 375
Z……Page 376

Reviews

There are no reviews yet.

Be the first to review “GWT in Practice”
Shopping Cart
Scroll to Top