Преглед изворни кода

Added controllers with dumby functions and mapped API calls to them.

Thomas Flucke пре 9 година
родитељ
комит
3be5965bbc

+ 33 - 0
server/app/controllers/EventsController.java

@@ -0,0 +1,33 @@
+package controllers;
+
+import play.mvc.*;
+
+import views.html.*;
+
+/**
+ * This controller contains an action to handle HTTP requests
+ * to the application's home page.
+ */
+public class EventsController extends Controller {
+
+    public Result get()
+    {
+	return notFound();
+    }
+
+    public Result create()
+    {
+	return notFound();
+    }
+
+    public Result update(long id)
+    {
+	return notFound();
+    }
+
+    public Result delete(long id)
+    {
+	return notFound();
+    }
+
+}

+ 28 - 0
server/app/controllers/FavoriteController.java

@@ -0,0 +1,28 @@
+package controllers;
+
+import play.mvc.*;
+
+import views.html.*;
+
+/**
+ * This controller contains an action to handle HTTP requests
+ * to the application's home page.
+ */
+public class FavoriteController extends Controller {
+
+    public Result get(long id)
+    {
+	return notFound();
+    }
+
+    public Result create(long userid, long eventid)
+    {
+	return notFound();
+    }
+
+    public Result delete(long userid, long eventid)
+    {
+	return notFound();
+    }
+
+}

+ 17 - 0
server/app/controllers/ReportController.java

@@ -0,0 +1,17 @@
+package controllers;
+
+import play.mvc.*;
+
+import views.html.*;
+
+/**
+ * This controller contains an action to handle HTTP requests
+ * to the application's home page.
+ */
+public class ReportController extends Controller {
+
+    public Result create(long eventid)
+    {
+	return notFound();
+    }
+}

+ 7 - 7
server/app/views/welcome.scala.html

@@ -78,11 +78,11 @@ GET     /               controllers.HomeController.index</code></pre>
             <h2>Async Controller</h2>
             <h2>Async Controller</h2>
 
 
             Now that you've seen how Play renders a page, take a look at <code>AsyncController.java</code>, which shows how to do asynchronous programming when handling a request.  The code is almost exactly the same as <code>HomeController.java</code>, but instead of returning <code>Result</code>, the action returns <code>CompletionStage&lt;Result&gt;</code> to Play.  When the execution completes, Play can use a thread to render the result without blocking the thread in the mean time.
             Now that you've seen how Play renders a page, take a look at <code>AsyncController.java</code>, which shows how to do asynchronous programming when handling a request.  The code is almost exactly the same as <code>HomeController.java</code>, but instead of returning <code>Result</code>, the action returns <code>CompletionStage&lt;Result&gt;</code> to Play.  When the execution completes, Play can use a thread to render the result without blocking the thread in the mean time.
-
+<!--
             <p>
             <p>
-                <a href="@routes.AsyncController.message">Click here for the AsyncController action!</a>
+                <a href="routes.AsyncController.message">Click here for the AsyncController action!</a>
             </p>
             </p>
-
+-->
             <p>
             <p>
                 You can read more about <a href="https://www.playframework.com/documentation/@version/JavaAsync">asynchronous actions</a> in the documentation.
                 You can read more about <a href="https://www.playframework.com/documentation/@version/JavaAsync">asynchronous actions</a> in the documentation.
             </p>
             </p>
@@ -92,11 +92,11 @@ GET     /               controllers.HomeController.index</code></pre>
             <p>
             <p>
                 Both the HomeController and AsyncController are very simple, and typically controllers present the results of the interaction of several services.  As an example, see the <code>CountController</code>, which shows how to inject a component into a controller and use the component when handling requests.  The count controller increments every time you click on it, so keep clicking to see the numbers go up.
                 Both the HomeController and AsyncController are very simple, and typically controllers present the results of the interaction of several services.  As an example, see the <code>CountController</code>, which shows how to inject a component into a controller and use the component when handling requests.  The count controller increments every time you click on it, so keep clicking to see the numbers go up.
             </p>
             </p>
-
+<!--
             <p>
             <p>
-                <a href="@routes.CountController.count">Click here for the CountController action!</a>
+                <a href="routes.CountController.count">Click here for the CountController action!</a>
             </p>
             </p>
-
+-->
             <p>
             <p>
                 You can read more about <a href="https://www.playframework.com/documentation/@version/JavaDependencyInjection">dependency injection</a> in the documentation.
                 You can read more about <a href="https://www.playframework.com/documentation/@version/JavaDependencyInjection">dependency injection</a> in the documentation.
             </p>
             </p>
@@ -170,4 +170,4 @@ GET     /               controllers.HomeController.index</code></pre>
         </aside>
         </aside>
 
 
     </div>
     </div>
-}
+}

+ 14 - 3
server/conf/routes

@@ -2,12 +2,23 @@
 # This file defines all application routes (Higher priority routes first)
 # This file defines all application routes (Higher priority routes first)
 # ~~~~
 # ~~~~
 
 
+GET	/events				controllers.EventsController.get
+PUT	/events				controllers.EventsController.create
+POST	/events/:id			controllers.EventsController.update(id: Long)
+DELETE	/events/:id			controllers.EventsController.delete(id: Long)
+
+GET	/favorite/:id			controllers.FavoriteController.get(id: Long)
+PUT	/favorite/:id/:event		controllers.FavoriteController.create(id: Long, event: Long)
+DELETE	/favorite/:id/:event		controllers.FavoriteController.delete(id: Long, event: Long)
+
+PUT	/report/:id			controllers.ReportController.create(id: Long)
+
 # An example controller showing a sample home page
 # An example controller showing a sample home page
-GET     /                           controllers.HomeController.index
+#GET     /                           controllers.HomeController.index
 # An example controller showing how to use dependency injection
 # An example controller showing how to use dependency injection
-GET     /count                      controllers.CountController.count
+#GET     /count                      controllers.CountController.count
 # An example controller showing how to write asynchronous code
 # An example controller showing how to write asynchronous code
-GET     /message                    controllers.AsyncController.message
+#GET     /message                    controllers.AsyncController.message
 
 
 # Map static resources from the /public folder to the /assets URL path
 # Map static resources from the /public folder to the /assets URL path
 GET     /assets/*file               controllers.Assets.versioned(path="/public", file: Asset)
 GET     /assets/*file               controllers.Assets.versioned(path="/public", file: Asset)