Skip to content
Ryan Heaton edited this page Sep 17, 2015 · 1 revision

GWT Module

The GWT deployment module generates the server-side and client-side libraries used to support a GWT RPC API. There is also support for invoking the GWTCompiler to compile a set a GWT applications that can be included in the generated Enunciate web application.

Configuration

The GWT module is configured by the gwt element under the modules element of the enunciate configuration file. The gwt element supports the following attributes:

attribute description
rpcModuleName The "rpcModuleName" attribute must be supplied. The RPC module name will also be used to determine the layout of the created module. The module name must be of the form "com.mycompany.MyModuleName". In this example, "com.mycompany" will be the module namespace and all client code will be generated into a package named of the form [module namespace].client (e.g. "com.mycompany.client"). By default, in order to provide a sensible mapping from service code to GWT client-side code, all service endpoints, faults, and JAXB beans must exist in a package that matches the module namespace, or a subpackage thereof. Use the "enforceNamespaceConformance" attribute to loosen this requirement.
enforceNamespaceConformance The "enforceNamespaceConformance" attribute allows you to lift the requirement that all classes must exist in a package that matches the module namespace. If this is set to "false", the classes that do not match the module namespace will be subpackaged by the client namespace. NOTE: You may not like this because the package mapping might be ugly. For example, if your module namespace is "com.mycompany" and you have a class "org.othercompany.OtherClass", it will be mapped to a client-side GWT class named "com.mycompany.client.org.othercompany.OtherClass".
label The "label" attribute is used to determine the name of the client-side artifact files. The default is the Enunciate project label.
clientJarName The "clientJarName" attribute specifies the name of the client-side jar file that is to be created. If no jar name is specified, the name will be calculated from the enunciate label, or a default will be supplied.
clientJarDownloadable The "clientJarDownloadable" attribute specifies whether the GWT client-side jar should be included as a download. Default: false.
gwtHome The "gwtHome" attribute specifies the filesystem path to the Google Web Toolkit home directory.
gwtCompilerClass The "gwtCompilerClass" attribute specifies the FQN of the GWTCompiler. Default: "com.google.gwt.dev.GWTCompiler".
enforceNoFieldAccessors The "enforceNoFieldAccessors" attribute specifies whether to enforce that a field accessor cannot be used for GWT mapping. Note: whether this option is enabled or disabled, there currently MUST be a getter and setter for each accessor. This option only disables the compile-time validation check.
useWrappedServices The "useWrappedServices" attribute specifies whether to use wrapped GWT client services. This is an artifact from when GWT 1.4 was supported and the generic types were unavailable. Default: false
disableCompile The "disableCompile" attribute prevents Enunciate from compiling its generated client source files.

Elements

war

The "war" element under the "gwt" element is used to configure the webapp that will host the GWT endpoints and GWT applications. It supports the following attributes:

  • The "gwtSubcontext" attribute is the subcontext at which the gwt endpoints will be mounted. Default: "/gwt/".
  • The "gwtAppDir" attribute is the directory in the war to which the gwt applications will be put. The default is the root of the war.

facets

Facet configuration for the module. See Facets.

app

The GWT module supports the development of GWT AJAX apps. Each app is comprised of a set of GWT modules that will be compiled into JavaScript. The "app" element supports the folowing attributes:

  • The "name" attribute is the name of the GWT app. Each app will be deployed into a subdirectory that matches its name. By default, the name of the application is the empty string (""). This means that the application will be deployed into the root directory.
  • The "srcDir" attribute specifies the source directory for the application. This attribute is required.
  • The "javascriptStyle" attribute specified the JavaScript style that is to be applied by the GWTCompiler. Valid values are "OBF", "PRETTY", and "DETAILED". The default value is "OBF".

Each "app" element may contain an arbitrary number of "module" child elements that specify the modules that are included in the app. The "module" element supports the following attributes:

  • The "name" attribute specifies the name of the module. This is usually of the form "com.mycompany.MyModule" and it always has a corresponding ".gwt.xml" module file.
  • The "shellPage" attribute specifies the (usually HTML) page to open when invoking the shell for this module (used to generate the shell script). By default, the shell page is the [moduleId].html, where [moduleId] is the (short, unqualified) name of the module.

gwtCompileJVMArg

The "gwtCompileJVMArg" element is used to specify additional JVM parameters that will be used when invoking GWTCompile. It supports a single "value" attribute.

gwtCompilerArg

The "gwtCompilerArg" element is used to specify additional arguments that will be psssed to the GWT compiler. It supports a single "value" attribute.

Example Configuraiton

As an example, consider the following configuration:

<enunciate>
  <modules>
    <gwt disabled="false" rpcModuleName="com.mycompany.MyGWTRPCModule"
       gwtHome="/home/myusername/tools/gwt-linux-1.5.2">
       <app srcDir="src/main/mainapp">
         <module name="com.mycompany.apps.main.MyRootModule"/>
         <module name="com.mycompany.apps.main.MyModuleTwo"/>
       </app>
     </gwt>
   </modules>
 </enunciate>
Clone this wiki locally