From 6e37ffb6743a8ae4cedb3407c97c661462bb2d42 Mon Sep 17 00:00:00 2001 From: ligi Date: Fri, 6 May 2016 00:26:40 +0200 Subject: [PATCH] Add servlet to either open a pass or the market this is work to get good UX for use case #61 --- backend/build.gradle | 4 +- .../backend/OpenOrInstallServlet.java | 15 ++ .../src/main/webapp/WEB-INF/appengine-web.xml | 2 +- backend/src/main/webapp/WEB-INF/web.xml | 10 ++ backend/src/main/webapp/index.html | 133 +---------------- backend/src/main/webapp/test.html | 135 ++++++++++++++++++ 6 files changed, 168 insertions(+), 131 deletions(-) create mode 100644 backend/src/main/java/org/ligi/passandroid/backend/OpenOrInstallServlet.java create mode 100644 backend/src/main/webapp/test.html diff --git a/backend/build.gradle b/backend/build.gradle index afaab93c..f8b8ffe8 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -6,7 +6,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.google.appengine:gradle-appengine-plugin:1.9.19' + classpath 'com.google.appengine:gradle-appengine-plugin:1.9.34' } } @@ -22,7 +22,7 @@ sourceCompatibility = JavaVersion.VERSION_1_7 targetCompatibility = JavaVersion.VERSION_1_7 dependencies { - appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18' + appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.34' compile 'com.google.appengine:appengine-endpoints:1.9.18' compile 'com.google.appengine:appengine-endpoints-deps:1.9.18' compile 'javax.servlet:servlet-api:2.5' diff --git a/backend/src/main/java/org/ligi/passandroid/backend/OpenOrInstallServlet.java b/backend/src/main/java/org/ligi/passandroid/backend/OpenOrInstallServlet.java new file mode 100644 index 00000000..943ad826 --- /dev/null +++ b/backend/src/main/java/org/ligi/passandroid/backend/OpenOrInstallServlet.java @@ -0,0 +1,15 @@ +package org.ligi.passandroid.backend; + +import java.io.IOException; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class OpenOrInstallServlet extends HttpServlet { + + public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + response.sendRedirect("market://details?id=org.ligi.passandroid&refferer=" + request.getParameter("url")); + } + +} diff --git a/backend/src/main/webapp/WEB-INF/appengine-web.xml b/backend/src/main/webapp/WEB-INF/appengine-web.xml index dae7c79a..d2f309ef 100644 --- a/backend/src/main/webapp/WEB-INF/appengine-web.xml +++ b/backend/src/main/webapp/WEB-INF/appengine-web.xml @@ -1,6 +1,6 @@ - myApplicationId + pass-cloud 1 true diff --git a/backend/src/main/webapp/WEB-INF/web.xml b/backend/src/main/webapp/WEB-INF/web.xml index ab2611d3..810b67a7 100644 --- a/backend/src/main/webapp/WEB-INF/web.xml +++ b/backend/src/main/webapp/WEB-INF/web.xml @@ -16,11 +16,21 @@ org.ligi.passandroid.backend.RegistrationEndpoint, org.ligi.passandroid.backend.MessagingEndpoint + + + OpenOrInstall + org.ligi.passandroid.backend.OpenOrInstallServlet + SystemServiceServlet /_ah/spi/* + + OpenOrInstall + /open_or_install + + index.html diff --git a/backend/src/main/webapp/index.html b/backend/src/main/webapp/index.html index 7a0ecb6e..0ddc5c9a 100644 --- a/backend/src/main/webapp/index.html +++ b/backend/src/main/webapp/index.html @@ -1,135 +1,12 @@ - PassAndroid Backend! - - - - + PassAndroid Backend - - -
- -
- - -
-
-
-

Hello, Google Cloud Messaging!

- -

Enter your message below and press "Send Message" button to send it over Google Cloud Messaging to all registered devices.

- -
-
- - - - -
-
-
- -

If you need step-by-step instructions for connecting your Android application to this backend module, see "App Engine Backend with Google Cloud - Messaging" template documentation.

- -

- - For more information about Google App Engine for Java, check out the App - Engine documentation.
- To learn more about Google Cloud Endpoints, see Cloud Endpoints - documentation.
- Similarly, for more information about Google Cloud Messaging, see Cloud Messaging - documentation.
- If you'd like to access your generated Google Cloud Endpoints APIs directly, see the Cloud Endpoints API - Explorer. -
-

-
-
-
-
- - - - +This is not what you are looking for! These are valid entry-points for this service: +
+espass.it
+PassAndroid diff --git a/backend/src/main/webapp/test.html b/backend/src/main/webapp/test.html new file mode 100644 index 00000000..7a0ecb6e --- /dev/null +++ b/backend/src/main/webapp/test.html @@ -0,0 +1,135 @@ + + + + PassAndroid Backend! + + + + + + + + +
+ +
+ + +
+
+
+

Hello, Google Cloud Messaging!

+ +

Enter your message below and press "Send Message" button to send it over Google Cloud Messaging to all registered devices.

+ +
+
+ + + + +
+
+
+ +

If you need step-by-step instructions for connecting your Android application to this backend module, see "App Engine Backend with Google Cloud + Messaging" template documentation.

+ +

+ + For more information about Google App Engine for Java, check out the App + Engine documentation.
+ To learn more about Google Cloud Endpoints, see Cloud Endpoints + documentation.
+ Similarly, for more information about Google Cloud Messaging, see Cloud Messaging + documentation.
+ If you'd like to access your generated Google Cloud Endpoints APIs directly, see the Cloud Endpoints API + Explorer. +
+

+
+
+
+
+ + + + + +