You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by jo...@apache.org on 2015/07/10 17:37:15 UTC

[28/30] struts git commit: WW-4522 Support latest stable AngularJS version in maven angularjs archetype

WW-4522 Support latest stable AngularJS version in maven angularjs archetype

- Follow angular style guide and use one file for each controller and service


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/19a55a88
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/19a55a88
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/19a55a88

Branch: refs/heads/master
Commit: 19a55a8857560ddad86cfd9f6060613d00febcd0
Parents: 8312ed1
Author: Johannes Geppert <jo...@apache.org>
Authored: Fri Jul 10 17:09:58 2015 +0200
Committer: Johannes Geppert <jo...@apache.org>
Committed: Fri Jul 10 17:09:58 2015 +0200

----------------------------------------------------------------------
 .../main/resources/archetype-resources/pom.xml  |  9 +++
 .../main/webapp/WEB-INF/content/application.jsp | 15 +++--
 .../src/main/webapp/js/app.js                   | 26 ++++++++
 .../src/main/webapp/js/bootstrap.js             | 37 -----------
 .../src/main/webapp/js/config.js                | 40 ++++++++++++
 .../src/main/webapp/js/controllers.js           | 37 -----------
 .../js/controllers/ApacheProjectsController.js  | 39 ++++++++++++
 .../main/webapp/js/controllers/AppController.js | 31 +++++++++
 .../webapp/js/controllers/HomeController.js     | 31 +++++++++
 .../src/main/webapp/js/directives.js            | 20 ------
 .../src/main/webapp/js/services.js              | 58 -----------------
 .../src/main/webapp/js/services/DataService.js  | 67 ++++++++++++++++++++
 .../src/test/java/actions/IndexTest.java        |  2 +-
 13 files changed, 252 insertions(+), 160 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml
index ff31ad8..4f1eb84 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/pom.xml
@@ -75,6 +75,15 @@
             <scope>provided</scope>
         </dependency>
 
+        <!-- The Servlet API mocks in Spring Framework 4.x only supports Servlet 3.0 and higher.
+           This is only necessary in tests-->
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.1.0</version>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 
     <build>

http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp
index d66b06a..8d13a8d 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp
@@ -1,13 +1,12 @@
 <!DOCTYPE html>
 <%@ page contentType="text/html; charset=UTF-8" %>
 <%@ taglib prefix="s" uri="/struts-tags" %>
-<html lang="en" ng-app="angularStrutsApp">
+<html lang="en" ng-app="app">
 <head>
     <meta charset="utf-8">
     <title>My AngularJS Struts2 App</title>
 
-    <s:url var="ctxUrl" forceAddSchemeHostAndPort="true" includeContext="true" value="/" namespace="/" ></s:url>
-    <base href="<s:property value="ctxUrl"/>">
+    <base href="<s:url forceAddSchemeHostAndPort="true" includeContext="true" value="/" namespace="/" />">
 </head>
 <body>
 
@@ -23,9 +22,11 @@
 
 <script src="<s:url value="js/lib/angular/angular.min.js" />"></script>
 <script src="<s:url value="js/lib/angular/angular-route.min.js" />"></script>
-<script src="<s:url value="js/bootstrap.js" />"></script>
-<script src="<s:url value="js/directives.js" />"></script>
-<script src="<s:url value="js/services.js" />"></script>
-<script src="<s:url value="js/controllers.js" />"></script>
+<script src="<s:url value="js/app.js" />"></script>
+<script src="<s:url value="js/config.js" />"></script>
+<script src="<s:url value="js/services/DataService.js" />"></script>
+<script src="<s:url value="js/controllers/AppController.js" />"></script>
+<script src="<s:url value="js/controllers/HomeController.js" />"></script>
+<script src="<s:url value="js/controllers/ApacheProjectsController.js" />"></script>
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js
new file mode 100644
index 0000000..6d2da17
--- /dev/null
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/app.js
@@ -0,0 +1,26 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+(function() {
+    'use strict';
+
+    angular
+        .module('app', ['ngRoute']);
+})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/bootstrap.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/bootstrap.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/bootstrap.js
deleted file mode 100644
index beefd53..0000000
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/bootstrap.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-var angularStrutsApp = angular.module('angularStrutsApp', ['ngRoute']);
-
-angularStrutsApp.config(['$routeProvider', '$locationProvider',
-    function($routeProvider, $locationProvider) {
-
-        $locationProvider.html5Mode(true).hashPrefix('!');
-
-        $routeProvider.when('/projects', {
-            templateUrl: 'partials/projects.html',
-            controller: 'ApacheProjectsController'
-        }).when('/home', {
-            templateUrl: 'partials/home.html',
-            controller: 'HomeController'
-        }).otherwise({ redirectTo: '/home' });
-    }
-]);

http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js
new file mode 100644
index 0000000..513760c
--- /dev/null
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/config.js
@@ -0,0 +1,40 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+(function() {
+    'use strict';
+
+    angular
+    .module('app')
+        .config(['$routeProvider', '$locationProvider',
+            function($routeProvider, $locationProvider) {
+
+                $locationProvider.html5Mode(true).hashPrefix('!');
+
+                $routeProvider.when('/projects', {
+                    templateUrl: 'partials/projects.html',
+                    controller: 'ApacheProjectsController'
+                }).when('/home', {
+                    templateUrl: 'partials/home.html',
+                    controller: 'HomeController'
+                }).otherwise({ redirectTo: '/home' });
+            }
+        ]);
+})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
deleted file mode 100644
index 07f12d7..0000000
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-angularStrutsApp.controller('AppController', function ($scope) {  });
-
-angularStrutsApp.controller('HomeController', function ($scope) {
-    $scope.name = "Sunshine";
-});
-
-angularStrutsApp.controller('ApacheProjectsController', function ($scope, $log, DataService) {
-    this.init = function() {
-        DataService.getProjects().then(function(data) {
-            $scope.projects = data.projectNames;
-        }, function() {
-            $log.error('Could not receive project names.')
-        });
-    };
-
-    this.init();
-});

http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/ApacheProjectsController.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/ApacheProjectsController.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/ApacheProjectsController.js
new file mode 100644
index 0000000..0d05615
--- /dev/null
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/ApacheProjectsController.js
@@ -0,0 +1,39 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+(function() {
+    'use strict';
+
+    angular
+        .module('app')
+        .controller('ApacheProjectsController', ApacheProjectsController);
+
+    function ApacheProjectsController($scope, $log, DataService) {
+        this.init = function() {
+            DataService.getProjects().then(function(data) {
+                $scope.projects = data.projectNames;
+            }, function() {
+                $log.error('Could not receive project names.')
+            });
+        };
+
+        this.init();
+    }
+})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/AppController.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/AppController.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/AppController.js
new file mode 100644
index 0000000..0f1bc2d
--- /dev/null
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/AppController.js
@@ -0,0 +1,31 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+(function() {
+    'use strict';
+
+    angular
+    .module('app')
+    .controller('AppController', AppController);
+
+    function AppController() {
+
+    }
+})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/HomeController.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/HomeController.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/HomeController.js
new file mode 100644
index 0000000..d0f23e3
--- /dev/null
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers/HomeController.js
@@ -0,0 +1,31 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+(function() {
+    'use strict';
+
+    angular
+        .module('app')
+        .controller('HomeController', HomeController);
+
+    function HomeController($scope) {
+        $scope.name = "Sunshine";
+    }
+})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/directives.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/directives.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/directives.js
deleted file mode 100644
index 228cc9f..0000000
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/directives.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */

http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services.js
deleted file mode 100644
index 10ec867..0000000
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-angularStrutsApp.factory('DataService', ['$http', '$log', '$q', function($http, $log, $q) {
-
-    var DataService = {
-        urls : {
-            projects : "data/projects"
-        }
-    };
-
-    DataService._request = function(url, method, model){
-        if(!method) {
-            method = 'GET';
-        }
-        var def = $q.defer();
-        if(method === 'GET') {
-            $http.get(url).success(function(data) {
-                def.resolve(data);
-            }).error(function(data, code) {
-                def.reject(data);
-                $log.error(data, code);
-            });
-        } else if(method === 'POST'){
-            $http.post(url, model).success(function(data) {
-                DataService.data = data;
-                def.resolve(data);
-            }).error(function(data, code) {
-                def.reject(data);
-                $log.error(data, code);
-            });
-        }
-        return def.promise;
-    };
-
-    DataService.getProjects = function () {
-        return this._request(this.urls.projects);
-    };
-
-    return DataService;
-}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js
new file mode 100644
index 0000000..d2612a4
--- /dev/null
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/services/DataService.js
@@ -0,0 +1,67 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+(function() {
+    'use strict';
+
+    angular
+        .module('app')
+        .factory('DataService', DataService);
+
+    function DataService($http, $log, $q) {
+
+        var DataService = {
+            urls : {
+                projects : "data/projects"
+            }
+        };
+
+        DataService._request = function(url, method, model){
+            if(!method) {
+                method = 'GET';
+            }
+            var def = $q.defer();
+            if(method === 'GET') {
+                $http.get(url).success(function(data) {
+                    def.resolve(data);
+                }).error(function(data, code) {
+                    def.reject(data);
+                    $log.error(data, code);
+                });
+            } else if(method === 'POST'){
+                $http.post(url, model).success(function(data) {
+                    DataService.data = data;
+                    def.resolve(data);
+                }).error(function(data, code) {
+                    def.reject(data);
+                    $log.error(data, code);
+                });
+            }
+            return def.promise;
+        };
+
+        DataService.getProjects = function () {
+            return this._request(this.urls.projects);
+        };
+
+        return DataService;
+    }
+
+})();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/struts/blob/19a55a88/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java
----------------------------------------------------------------------
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java
index 22c0766..1c3fc20 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/IndexTest.java
@@ -29,6 +29,6 @@ public class IndexTest extends StrutsTestCase {
         Index index = new Index();
         String result = index.execute();
         assertTrue("Expected a success result!", ActionSupport.SUCCESS.equals(result));
-        assertTrue("Expected the 'hello' action name!!", "hello".equals(index.getRedirectName()));
+        assertTrue("Expected the 'hello' action name!!", "application".equals(index.getRedirectName()));
     }
 }