Skip to content

Commit 820d3b2

Browse files
committed
Modify with "Part 2 - Adding GWT"
1 parent 513db80 commit 820d3b2

File tree

7 files changed

+171
-31
lines changed

7 files changed

+171
-31
lines changed

ReadMe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
This project is a step-by-step Spring-GWT tutorial.
2-
It is inspired from the article written by Alex Tretyakov on 2011-10-23
3-
[Spring and GWT tutorial. Part 1 - Spring Configuration](http://alextretyakov.blogspot.fr/2011/10/spring-gwt-part-1-setting-spring.html).
2+
It is inspired from the article written by Alex Tretyakov on 2011-10-24
3+
[Spring and GWT tutorial. Part 2 - Adding GWT ](http://alextretyakov.blogspot.fr/2011/10/recently-ive-started-working-in-gwt.html).
44

55
The project was created as a "Maven Project" in Eclipse.
66
Then files from hellogwt were added.

pom.xml

Lines changed: 98 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,123 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
pom.xml contains description of all artifacts that our application requires.
4-
Now we need only spring-web artifact, which contains all necessary Spring libraries.
4+
We need spring-web artifact, which contains all necessary Spring libraries.
5+
Now, we add GWT (gwt-servlet and gwt-user artifacts) and Log4J to our project.
56
-->
67
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
78
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
89
<modelVersion>4.0.0</modelVersion>
10+
911
<groupId>hellogwt</groupId>
1012
<artifactId>hellogwt</artifactId>
11-
<version>0.0.1-SNAPSHOT</version>
1213
<packaging>war</packaging>
14+
<version>0.0.1-SNAPSHOT</version>
1315
<name>HelloGWT</name>
1416
<description>Spring-GWT example</description>
1517
<properties>
1618
<spring.version>4.0.3.RELEASE</spring.version>
19+
<spring4gwt.version>0.0.1</spring4gwt.version>
20+
<spring4gwt.md5>640e1e3fc08f2e175cb52e7f922d47ad</spring4gwt.md5>
21+
<!-- Convenience property to set the GWT version -->
22+
<gwt.version>2.7.0</gwt.version>
23+
<!-- Note: GWT needs at least java 1.6 -->
24+
<maven.compiler.source>1.7</maven.compiler.source>
25+
<maven.compiler.target>1.7</maven.compiler.target>
26+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1727
</properties>
28+
1829
<dependencies>
1930
<!-- Spring -->
2031
<dependency>
21-
<version>${spring.version}</version>
2232
<groupId>org.springframework</groupId>
2333
<artifactId>spring-web</artifactId>
34+
<version>${spring.version}</version>
35+
</dependency>
36+
<!-- GWT -->
37+
<dependency>
38+
<groupId>com.google.gwt</groupId>
39+
<artifactId>gwt-servlet</artifactId>
40+
<version>${gwt.version}</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>com.google.gwt</groupId>
44+
<artifactId>gwt-user</artifactId>
45+
<version>${gwt.version}</version>
46+
<type>jar</type>
2447
</dependency>
2548
</dependencies>
49+
2650
<build>
2751
<finalName>hellogwt</finalName>
52+
<plugins>
53+
<!-- GWT Maven Plugin-->
54+
<plugin>
55+
<!-- http://mojo.codehaus.org/gwt-maven-plugin/run-mojo.html -->
56+
<groupId>org.codehaus.mojo</groupId>
57+
<artifactId>gwt-maven-plugin</artifactId>
58+
<version>${gwt.version}</version>
59+
<executions>
60+
<execution>
61+
<goals>
62+
<goal>compile</goal>
63+
<goal>test</goal>
64+
</goals>
65+
</execution>
66+
</executions>
67+
</plugin>
68+
<!-- $HOME/.m2/settings.xml
69+
<server>
70+
<id>Tomcat6</id>
71+
<username>tomcat</username>
72+
<password>tomcat</password>
73+
</server>
74+
-->
75+
<plugin>
76+
<!-- http://tomcat.apache.org/maven-plugin-2.2/context-goals.html -->
77+
<groupId>org.apache.tomcat.maven</groupId>
78+
<artifactId>tomcat6-maven-plugin</artifactId>
79+
<version>2.2</version>
80+
<configuration>
81+
<url>http://localhost:8080/manager/</url>
82+
<server>Tomcat6</server>
83+
<path>/hellogwt</path>
84+
</configuration>
85+
</plugin>
86+
<!--
87+
download-maven-plugin is used to download and cache other files
88+
-->
89+
<plugin>
90+
<groupId>com.googlecode.maven-download-plugin</groupId>
91+
<artifactId>download-maven-plugin</artifactId>
92+
<version>1.2.1</version>
93+
<executions>
94+
<execution>
95+
<id>install-spring4gwt</id>
96+
<phase>process-resources</phase>
97+
<goals>
98+
<goal>wget</goal>
99+
</goals>
100+
<configuration>
101+
<url>https://spring4gwt.googlecode.com/files/spring4gwt-${spring4gwt.version}.jar</url>
102+
<unpack>false</unpack>
103+
<outputDirectory>target/hellogwt/WEB-INF/lib/</outputDirectory>
104+
<md5>${spring4gwt.md5}</md5>
105+
</configuration>
106+
</execution>
107+
</executions>
108+
</plugin>
109+
</plugins>
28110
</build>
29-
</project>
111+
<reporting>
112+
<plugins>
113+
<plugin>
114+
<groupId>org.apache.maven.plugins</groupId>
115+
<artifactId>maven-checkstyle-plugin</artifactId>
116+
<version>2.13</version>
117+
<configuration>
118+
<configLocation>config/sun_checks.xml</configLocation>
119+
</configuration>
120+
</plugin>
121+
</plugins>
122+
</reporting>
123+
</project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
XML module file for the com.hellogwt package.
4+
When updating your version of GWT, you should also update this DTD reference,
5+
so that your app can take advantage of the latest GWT module capabilities.
6+
-->
7+
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN"
8+
"http://gwtproject.org/doctype/2.7.0/gwt-module.dtd">
9+
10+
<module rename-to='hellogwt'>
11+
<inherits name='com.google.gwt.user.User'/>
12+
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
13+
<entry-point class='com.hellogwt.client.HelloGWT'/>
14+
</module>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* GWT entry point.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.hellogwt.client;
17+
18+
import com.google.gwt.core.client.EntryPoint;
19+
import com.google.gwt.user.client.ui.Label;
20+
import com.google.gwt.user.client.ui.RootPanel;
21+
22+
/**
23+
* @author Alex Tretyakov
24+
*/
25+
public class HelloGWT implements EntryPoint {
26+
27+
@Override
28+
public void onModuleLoad() {
29+
Label greetingLabel = new Label("Hello, GWT!");
30+
RootPanel.get().add(greetingLabel);
31+
}
32+
}

src/main/webapp/HelloGWT.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2+
<html>
3+
<head>
4+
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
5+
<title>HelloGWT</title>
6+
<script type="text/javascript" language="javascript" src="hellogwt/hellogwt.nocache.js"></script>
7+
</head>
8+
<body>
9+
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
10+
style="position:absolute;width:0;height:0;border:0">
11+
</iframe>
12+
</body>
13+
</html>

src/main/webapp/WEB-INF/web.xml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
Deployment descriptor web.xml contains configuration of Spring application context, Dispatcher servlet and welcome page.
3+
Deployment descriptor web.xml contains:
4+
- configuration of Spring application context,
5+
- Dispatcher servlet SpringGwtRemoteServiceServlet from spring4gwt,
6+
- and welcome page.
47
-->
58
<web-app version="2.5"
69
xmlns="http://java.sun.com/xml/ns/javaee"
710
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
811
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
12+
<display-name>hellogwt</display-name>
913
<listener>
1014
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
1115
</listener>
1216

1317
<servlet>
14-
<servlet-name>hellogwt</servlet-name>
15-
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
16-
<load-on-startup>1</load-on-startup>
18+
<servlet-name>springGwtRemoteServiceServlet</servlet-name>
19+
<servlet-class>org.spring4gwt.server.SpringGwtRemoteServiceServlet</servlet-class>
1720
</servlet>
1821

1922
<servlet-mapping>
20-
<servlet-name>hellogwt</servlet-name>
21-
<url-pattern>/</url-pattern>
23+
<servlet-name>springGwtRemoteServiceServlet</servlet-name>
24+
<url-pattern>/hellogwt/springGwtServices/*</url-pattern>
2225
</servlet-mapping>
2326

2427
<welcome-file-list>
25-
<welcome-file>index.jsp</welcome-file>
26-
</welcome-file-list>
27-
</web-app>
28+
<welcome-file>HelloGWT.html</welcome-file>
29+
</welcome-file-list>
30+
</web-app>

src/main/webapp/index.jsp

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)