Академический Документы
Профессиональный Документы
Культура Документы
GWT Architecture
There are four major components with which the GWT is built. They are
• a Java-to-JavaScript compiler
• a "hosted" web browser
• two Java class libraries (one the JAVA API and another GWT API)
You use the GWT compiler to compile your GWT applications to JavaScript. The
application can then be deployed to a web container. This is referred to as running in web
mode. When you click on the Compile/Browse button, the Java code for the project is
compiled by the Java-to-JavaScript compiler into pure HTML and JavaScript. The
resulting artifacts are copied automatically to the Project/www folder.
This enables you to run and execute your GWT applications as Java in the Java Virtual
Machine (JVM) without compiling to JavaScript first. This is referred to as running in
hosted mode. GWT accomplishes this by embedding a special SWT browser control that
contains hooks into the JVM. This special browser utilizes an Internet Explorer control
on Windows or a Mozilla control on Linux. When you run the Project, the embedded
SWT browser is what you see displaying the application.
This contains JavaScript implementations of most of the widely used classes of the
java.lang and java.util packages from the Java standard class library. Only some of the
commonly used classes from these two packages are supported. None of the other Java
packages in the JDK are currently part of this emulation library. These are the only
classes that can be used by you for the client side of the AJAX application. You are of
course free to use the entire Java class library for the server-side implementation. The
Java code in the project is compiled into JavaScript using this emulation library
This provides a set of custom interfaces and classes that enable you to create various
widgets such as buttons, text boxes, images, and text. GWT ships with most of the
widgets commonly used in web applications. This is the class library that provides the
Java widgets.
• Home
• SCJP Books
• New to SCJP?
• SCJP 1.4 or SCJP 1.5
• Objectives
• Articles
• Mock Exams
• Tutorials
SCJP 1.6
• Home
• What is New in SCJP 1.6?
• SCJP Books
• New to SCJP?
• Objectives
• Articles
• Mock Exams
• Tutorials
• NavigableSet
• NavigableMap
• GarbageCollection
• Console
• Finalize Method
• scjp 1.4 mock - 1
• scjp 1.4 mock - 2
• scjp 1.4 mock - 3
• scjp 1.4 mock - 4
• scjp 1.4 mock - 5
• scjp 1.4 mock - 6
• scjp 1.4 mock - 7
• scjp 1.4 mock - 8
• scjp 1.4 mock - 9
• scjp 1.4 mock - 10
• scjp 1.4 mock - 11
• scjp 1.4 mock - 12
• scjp 1.4 mock - 13
• scjp 1.4 mock - 14
• scjp 1.4 mock - 15
• scjp 1.4 mock - 16
• scjp 1.4 mock - 17
• scjp 1.4 mock - 18
• scjp 1.4 mock - 19
• scjp 1.4 mock - 20
• scjp 1.4 mock - 21
SCWCD 5.0
SCBCD 5.0
• Home
• Objectives
• Mock Exams
• Objective - 1
• Mock Exam - 1
• Mock Exam - 2
• Mock Exam - 3
• Mock Exam - 4
SCEA
• Home
• SCEA Books
• Objectives
• Mock Exams
• Mock Exam - 1
• Mock Exam - 2
• Mock Exam - 3
• Mock Exam - 4
• Mock Exam - 5
• Mock Exam - 6
• Mock Exam - 7
• Mock Exam - 8
• Mock Exam - 9
• Mock Exam - 10
• Mock Exam - 11
SCJA
• Home
• Objectives
• Mock Exams
• Mock Exams - 1
• Mock Exams - 2
• Mock Exams - 3
• Mock Exams - 4
• Mock Exams - 5
• Mock Exams - 6
• Mock Exams - 7
• Mock Exams - 8
Feeds
• Articles
• Tips
GWT provides the users with a rich content to develop UI, widgets are the basic
components provided which includes buttons, text boxes, etc. In addition to this
we have Panels, Tabs, HTMl elements.
GWT is built in such a way that all the classes are serializable and the framework
is structured to support RPCs with Servers
• Ultra debugging:
As the code is compiled by JVM before the run time, it ease the work of
debugging and error fixing. High end IDEs like Eclipse can assist in this.
• Browser compatible:
Your GWT applications automatically support IE, Firefox, Mozilla, Safari, and
Opera with no browser detection or special-casing within your code in most cases.
• Internationalization:
The set of APIs available for Internationalization is very well synchronized with
the user class structure which makes the implementation easier.
• Interoperability
We can add our own JavaScript in the Java source code using our JavaScript
Native Interface (JSNI), which gives a broad area for implementing the business.
• Web mode - In this mode, the application is run as Javascript and HTML, there
will be one boot strap js called gwt.js, which kick starts the thread.
GWT Interview Questions
What is Google Web Toolkit?
Google Web Toolkit (GWT) is an open source Java development framework that lets you
escape the matrix of technologies that make writing AJAX applications so difficult and
error prone. With GWT, you can develop and debug AJAX applications in the Java
language using the Java development tools of your choice. When you deploy your
application to production, the GWT compiler translates your Java application to browser-
compliant JavaScript and HTML.
Use your favorite Java IDE to write and debug an application in the Java language, using
as many (or as few) GWT libraries as you find useful.
Use GWT's Java-to-JavaScript compiler to distill your application into a set of JavaScript
and HTML files that you can serve with any web server.
Confirm that your application works in each browser that you want to support, which
usually takes no additional work.
GWT's network operations are all asynchronous, or non-blocking. That is, they return
immediately as soon as called, and require the user to use a callback method to handle the
results when they are eventually returned from the server. Though in some cases
asynchronous operators are less convenient to use than synchronous operators, GWT
does not provide synchronous operators.
The reason is that most browsers' JavaScript engines are single-threaded. As a result,
blocking on a call to XMLHTTPRequest also blocks the UI thread, making the browser
appears to freeze for the duration of the connection to the server. Some browsers provide
a way around this, but there is no universal solution. GWT does not implement a
synchronous network connection because to do so would be to introduce a feature that
does not work on all browsers, violating GWT's commitment to no-compromise, cross-
browser AJAX. It would also introduce complexity for developers, who would have to
maintain two different versions of their communications code in order to handle all
browsers.
What are the language differences between web mode and hosted mode?
Typically, if your code runs as intended in hosted mode and compiles to JavaScript
without error, web mode behavior will be equivalent. Occasional different problems can
cause subtle bugs to appear in web mode that don't appear in hosted mode. Fortunately
those cases are rare.
The heart of AJAX is making data read/write calls to a server from the JavaScript
application running in the browser. GWT is "RPC agnostic" and has no particular
requirements about what protocol is used to issue RPC requests, or even what language
the server code is written in. Although GWT provides a library of classes that makes the
RPC communications with a J2EE server extremely easy, you are not required to use
them. Instead you can build custom HTTP requests to retrieve, for example, JSON or
XML-formatted data.
To communicate with your server from the browser without using GWT RPC:
Yes, you are free to use GWT with any server-side templating tool.
With GWT development, your Java client code gets compiled into equivalent JavaScript
that is loaded into your host pages. The generated product is totally independent from the
server-side technology that you choose to use in your web application.
You can go ahead and use your favorite server-side templating tool and include your
template directives into your host pages along with your GWT-generated JavaScript files.
The server-side technology you're using to realize the templates is invisible to the
browser and works just as it does without your GWT modules.
The servlet base class for your RPC service implementations that automatically
deserializes incoming requests from the client and serializes outgoing responses for
client/server RPCs.
General Questions:
What are some advantages for the Model-View-Presenter pattern?
• Describe how one module can inherit or use members from another GWT
module.