diff --git a/appengine/endpoints-frameworks-v2/README.md b/appengine/endpoints-frameworks-v2/README.md index 5f2c49d0d4d..97f20f51bfc 100644 --- a/appengine/endpoints-frameworks-v2/README.md +++ b/appengine/endpoints-frameworks-v2/README.md @@ -3,10 +3,10 @@ This directory contains Google Cloud Endpoints Frameworks for App Engine for App Engine Standard samples. The [`backend/`](backend/) directory contains the sample code for the [quickstart][4] for Cloud Endpoints Frameworks on App Engine -using an OpenAPI development process. The [`discovery/`](discovery/) directory -contains the sample code for [migrated][2] prior version of [Cloud Endpoints -Frameworks][1] project to the new [Cloud Endpoints Frameworks for App Engine][8] -using a discovery document development process. +using an OpenAPI development process. The [`migration-example/`](migration-example/) directory +contains the sample code for a [migrated][2] version of the [Cloud Endpoints +Frameworks][1] sample project to the new [Cloud Endpoints Frameworks for App Engine][8] +development process. The new Google Cloud Endpoints Frameworks for App Engine provides [additional functionality][3] using OpenAPI which may require payment. diff --git a/appengine/endpoints-frameworks-v2/discovery/README.md b/appengine/endpoints-frameworks-v2/migration-example/README.md similarity index 59% rename from appengine/endpoints-frameworks-v2/discovery/README.md rename to appengine/endpoints-frameworks-v2/migration-example/README.md index 1f11fbb5c24..b9357a8af1c 100644 --- a/appengine/endpoints-frameworks-v2/discovery/README.md +++ b/appengine/endpoints-frameworks-v2/migration-example/README.md @@ -1,16 +1,15 @@ -# Hello World Google Cloud Endpoints for App Engine with a discovery document +# Hello World Google Cloud Endpoints for App Engine This sample provides an example of a [migration][7] from the prior version of -[Google Cloud Endpoints Frameworks][3] to new [Google Cloud Endpoints Frameworks for App Engine][8] -while still using a discovery document. This sample contains comments of how to -use the prior Endpoints Frameworks as well. For clarity, the prior Endpoints -Frameworks and the new Endpoints Frameworks are denoted as Endpoints Frameworks v1.0 -and Endpoints Frameworks v2.0 respectively. +[Google Cloud Endpoints Frameworks][3] to new [Google Cloud Endpoints Frameworks for App Engine][8]. +This sample contains comments of how to use the prior Endpoints Frameworks as +well. For clarity, the prior Endpoints Frameworks and the new Endpoints +Frameworks are denoted as Endpoints Frameworks v1.0 and Endpoints Frameworks +v2.0, respectively. Google Cloud Endpoints Frameworks v2.0 provides new functionality which may -require payment and uses an OpenAPI specification instead of the discovery document. -The OpenAPI development process is explained [here][8] and a quickstart is -provided [here][9]. +require payment and uses an OpenAPI specification. The OpenAPI development +process is explained [here][8] and a quickstart is provided [here][9]. ## Products - [Google App Engine Standard][1] @@ -30,23 +29,27 @@ provided [here][9]. 1. [Optional]: User Authenticating with Google Accounts in Web Clients 1. Update the `WEB_CLIENT_ID` in [Constants.java](src/main/java/com/example/helloendpoints/Constants.java) - to reflect the web client ID you have registered in the [Credentials on Developers Console for OAuth 2.0 client IDs][6]. + to reflect the web client ID you have registered in the + [Credentials on Developers Console for OAuth 2.0 client IDs][6]. - 1. Update the value of `google.devrel.samples.helloendpoints.CLIENT_ID` in [base.js](src/main/webapp/js/base.js) - to reflect the web client ID you have registered in the [Credentials on Developers Console for OAuth 2.0 client IDs][6]. + 1. Update the value of `google.devrel.samples.helloendpoints.CLIENT_ID` in + [base.js](src/main/webapp/js/base.js) to reflect the web client ID you + have registered in the + [Credentials on Developers Console for OAuth 2.0 client IDs][6]. 1. [Optional]: User Authenticating with Google Accounts in other Applications Types - Inside [Constants.java](src/main/java/com/example/helloendpoints/Constants.java) you will find placeholders for Android - and iOS applications using Google Accounts client IDs registered in the + applications using Google Accounts client IDs registered in the [Credentials on Developers Console for OAuth 2.0 client IDs][6]. - - These client IDs are used when defining annotation for this sample API found in [Greetings.java](src/main/java/com/example/helloendpoints/Greetings.java). + - These client IDs are used when defining annotation for this sample API + found in [Greetings.java](src/main/java/com/example/helloendpoints/Greetings.java). - You can read more about different user authentication supported [here][12]. -1. [Optional]: Use Cloud Endpoints Frameworks v2.0 Maven and Gradle discovery and +1. [Optional]: Use Cloud Endpoints Frameworks v2.0 Maven and Gradle client library generation plugins with Cloud Endpoints Frameworks v1.0. - Uncomment `Endpoints Frameworks v1.0` sections and comment @@ -62,52 +65,56 @@ provided [here][9]. ### Maven -1. Build a fresh binary with +1. Build a fresh binary by using: `mvn clean compile` -1. Run the application locally at [localhost:8080][5] with +1. Run the application locally at [http://localhost:8080][5] by using: `mvn appengine:run` -1. Generate the client library in a zip file named `helloworld-v1-java.zip` with +1. Explore local server's API explorer by browsing to: + + [http://localhost:8080/_ah/api/explorer][13] + +1. Generate the client library located at `target/client-libs/helloworld-v1-java.zip` + by using: `mvn endpoints-framework:clientLibs` -1. Deploy your application to Google App Engine with +1. Deploy your application to Google App Engine by using: `mvn appengine:deploy` ### Gradle -1. Build a fresh binary with +1. Build a fresh binary by using: `gradle clean compileJava` -1. Run the application locally at [localhost:8080][5] with +1. Run the application locally at [http://localhost:8080][5] by using: `gradle appengineRun` -1. Generate the client library in a zip file named `helloworld-v1-java.zip` with +1. Explore local server's API explorer by browsing to: - `gradle endpointsClientLibs` + [http://localhost:8080/_ah/api/explorer][13] -1. Deploy your application to Google App Engine with +1. Generate the client library located at `build/endpointsClientLibs/helloworld-v1-java.zip` + by using: - `gradle appengineDeploy` + `gradle endpointsClientLibs` -## Known issues +1. Deploy your application to Google App Engine by using: -There's a [bug][13] where `1` is required in the -[appengine-web.xml](src/main/webapp/WEB-INF/appengine-web.xml) to run -this sample locally. This will become optional in the near future. + `gradle appengineDeploy` [1]: https://cloud.google.com/appengine/docs/java/ [2]: http://java.com/en/ [3]: https://cloud.google.com/appengine/docs/java/endpoints/ [4]: https://cloud.google.com/appengine/docs/java/tools/maven -[5]: https://localhost:8080/ +[5]: http://localhost:8080/ [6]: https://console.developers.google.com/project/_/apiui/credential [7]: https://cloud.google.com/appengine/docs/java/endpoints/migrating [8]: https://cloud.google.com/endpoints/docs/frameworks/java/about-cloud-endpoints-frameworks @@ -115,4 +122,4 @@ this sample locally. This will become optional in the near future. [10]: https://github.com/GoogleCloudPlatform/endpoints-framework-maven-plugin [11]: https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin [12]: https://cloud.google.com/endpoints/docs/authenticating-users-frameworks -[13]: https://github.com/cloudendpoints/endpoints-java/issues/43 +[13]: http://localhost:8080/_ah/api/explorer diff --git a/appengine/endpoints-frameworks-v2/discovery/build.gradle b/appengine/endpoints-frameworks-v2/migration-example/build.gradle similarity index 73% rename from appengine/endpoints-frameworks-v2/discovery/build.gradle rename to appengine/endpoints-frameworks-v2/migration-example/build.gradle index 43aacd449fb..3f84099aa7d 100644 --- a/appengine/endpoints-frameworks-v2/discovery/build.gradle +++ b/appengine/endpoints-frameworks-v2/migration-example/build.gradle @@ -12,16 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +// [START buildscript] buildscript { // Configuration for building repositories { mavenCentral() jcenter() // Bintray's repository - a fast Maven Central mirror & more } dependencies { - classpath 'com.google.cloud.tools:appengine-gradle-plugin:+' // latest App Engine Gradle tasks - classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:+' + // App Engine Gradle plugin + classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.1.1' + + // Endpoints Frameworks Gradle plugin + classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.0-beta6' } } +// [END buildscript] repositories { // repositories for Jar's you access in your code mavenCentral() @@ -30,8 +35,14 @@ repositories { // repositories for Jar's you access in your code apply plugin: 'java' // standard Java tasks apply plugin: 'war' // standard Web Archive plugin + +// [START apply_appengine] apply plugin: 'com.google.cloud.tools.appengine' // App Engine tasks +// [END apply_appengine] + +// [START apply_endpoints-framework-server] apply plugin: 'com.google.cloud.tools.endpoints-framework-server' +// [END apply_endpoints-framework-server] dependencies { providedCompile group: 'javax.servlet', name: 'servlet-api', version:'2.5' @@ -43,7 +54,9 @@ dependencies { // End of Endpoints Frameworks v1.0 // Endpoints Frameworks v2.0 - compile "com.google.endpoints:endpoints-framework:+" + // [START endpoints-tools] + compile group: 'com.google.endpoints', name: 'endpoints-framework-tools', version: '2.0.4' + // [END endpoints-tools] // End of Endpoints Frameworks v2.0 } @@ -58,8 +71,14 @@ appengine { // App Engine tasks configuration } } -group = "com.example.helloendpoints" // Generated output GroupId -version = "1" // Version in generated output +/* [START endpoints-server] +endpointsServer { + // Endpoints Framework Plugin server-side configuration +} +[END endpoints-server] */ + +group = 'com.example.helloendpoints' // Generated output GroupId +version = '1' // Version in generated output sourceCompatibility = 1.7 // App Engine Standard uses Java 7 targetCompatibility = 1.7 // App Engine Standard uses Java 7 diff --git a/appengine/endpoints-frameworks-v2/discovery/gradle/wrapper/gradle-wrapper.properties b/appengine/endpoints-frameworks-v2/migration-example/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from appengine/endpoints-frameworks-v2/discovery/gradle/wrapper/gradle-wrapper.properties rename to appengine/endpoints-frameworks-v2/migration-example/gradle/wrapper/gradle-wrapper.properties diff --git a/appengine/endpoints-frameworks-v2/discovery/gradlew b/appengine/endpoints-frameworks-v2/migration-example/gradlew similarity index 100% rename from appengine/endpoints-frameworks-v2/discovery/gradlew rename to appengine/endpoints-frameworks-v2/migration-example/gradlew diff --git a/appengine/endpoints-frameworks-v2/discovery/gradlew.bat b/appengine/endpoints-frameworks-v2/migration-example/gradlew.bat similarity index 100% rename from appengine/endpoints-frameworks-v2/discovery/gradlew.bat rename to appengine/endpoints-frameworks-v2/migration-example/gradlew.bat diff --git a/appengine/endpoints-frameworks-v2/discovery/jenkins.sh b/appengine/endpoints-frameworks-v2/migration-example/jenkins.sh similarity index 100% rename from appengine/endpoints-frameworks-v2/discovery/jenkins.sh rename to appengine/endpoints-frameworks-v2/migration-example/jenkins.sh diff --git a/appengine/endpoints-frameworks-v2/discovery/pom.xml b/appengine/endpoints-frameworks-v2/migration-example/pom.xml similarity index 76% rename from appengine/endpoints-frameworks-v2/discovery/pom.xml rename to appengine/endpoints-frameworks-v2/migration-example/pom.xml index d62e5d0d164..6112d4fd48e 100644 --- a/appengine/endpoints-frameworks-v2/discovery/pom.xml +++ b/appengine/endpoints-frameworks-v2/migration-example/pom.xml @@ -30,14 +30,6 @@ limitations under the License. - - - - 1.0.0 - 1.0.0-beta2 - 2.0.0-beta.12 1 1.7 1.7 @@ -53,18 +45,24 @@ limitations under the License. - + 1.9.48 + + [END appengine-endpoints] + --> + com.google.endpoints endpoints-framework - ${endpoints.framework.version} + 2.0.4 + javax.servlet @@ -83,31 +81,26 @@ limitations under the License. ${project.build.directory}/${project.build.finalName}/WEB-INF/classes + com.google.cloud.tools appengine-maven-plugin - ${appengine.maven.version} + 1.2.1 + + com.google.cloud.tools endpoints-framework-maven-plugin - ${endpoints.maven.plugin.version} + 1.0.0-beta3 - src/main/webapp - ${project.build.directory}/generated-sources/appengine-endpoints/WEB-INF + - - - generate-sources - - discoveryDocs - - - + org.codehaus.mojo versions-maven-plugin diff --git a/appengine/endpoints-frameworks-v2/discovery/src/main/java/com/example/helloendpoints/Constants.java b/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Constants.java similarity index 92% rename from appengine/endpoints-frameworks-v2/discovery/src/main/java/com/example/helloendpoints/Constants.java rename to appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Constants.java index 255a3dd9e25..327b7e290ac 100644 --- a/appengine/endpoints-frameworks-v2/discovery/src/main/java/com/example/helloendpoints/Constants.java +++ b/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Constants.java @@ -22,7 +22,6 @@ public class Constants { public static final String WEB_CLIENT_ID = "replace this with your web client ID"; public static final String ANDROID_CLIENT_ID = "replace this with your Android client ID"; - public static final String IOS_CLIENT_ID = "replace this with your iOS client ID"; public static final String ANDROID_AUDIENCE = WEB_CLIENT_ID; public static final String EMAIL_SCOPE = "https://www.googleapis.com/auth/userinfo.email"; diff --git a/appengine/endpoints-frameworks-v2/discovery/src/main/java/com/example/helloendpoints/Greetings.java b/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Greetings.java similarity index 98% rename from appengine/endpoints-frameworks-v2/discovery/src/main/java/com/example/helloendpoints/Greetings.java rename to appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Greetings.java index 11f533f622d..4bda5c883b4 100644 --- a/appengine/endpoints-frameworks-v2/discovery/src/main/java/com/example/helloendpoints/Greetings.java +++ b/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Greetings.java @@ -35,7 +35,7 @@ @Api(name = "helloworld", version = "v1", scopes = {Constants.EMAIL_SCOPE}, - clientIds = {Constants.WEB_CLIENT_ID, Constants.ANDROID_CLIENT_ID, Constants.IOS_CLIENT_ID}, + clientIds = {Constants.WEB_CLIENT_ID, Constants.ANDROID_CLIENT_ID}, audiences = {Constants.ANDROID_AUDIENCE} ) public class Greetings { diff --git a/appengine/endpoints-frameworks-v2/discovery/src/main/java/com/example/helloendpoints/HelloGreeting.java b/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/HelloGreeting.java similarity index 100% rename from appengine/endpoints-frameworks-v2/discovery/src/main/java/com/example/helloendpoints/HelloGreeting.java rename to appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/HelloGreeting.java diff --git a/appengine/endpoints-frameworks-v2/discovery/src/main/webapp/WEB-INF/appengine-web.xml b/appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/WEB-INF/appengine-web.xml similarity index 97% rename from appengine/endpoints-frameworks-v2/discovery/src/main/webapp/WEB-INF/appengine-web.xml rename to appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/WEB-INF/appengine-web.xml index d0f24ab64f5..1d2a8f63b5b 100644 --- a/appengine/endpoints-frameworks-v2/discovery/src/main/webapp/WEB-INF/appengine-web.xml +++ b/appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/WEB-INF/appengine-web.xml @@ -16,7 +16,6 @@ See the License for the specific language governing permissions and limitations under the License. --> true - 1 diff --git a/appengine/endpoints-frameworks-v2/discovery/src/main/webapp/WEB-INF/logging.properties b/appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/WEB-INF/logging.properties similarity index 100% rename from appengine/endpoints-frameworks-v2/discovery/src/main/webapp/WEB-INF/logging.properties rename to appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/WEB-INF/logging.properties diff --git a/appengine/endpoints-frameworks-v2/discovery/src/main/webapp/WEB-INF/web.xml b/appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/WEB-INF/web.xml similarity index 72% rename from appengine/endpoints-frameworks-v2/discovery/src/main/webapp/WEB-INF/web.xml rename to appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/WEB-INF/web.xml index 4c0204393dd..be7073d2745 100644 --- a/appengine/endpoints-frameworks-v2/discovery/src/main/webapp/WEB-INF/web.xml +++ b/appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/WEB-INF/web.xml @@ -14,17 +14,12 @@ 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. --> + + - - - - EndpointsServlet - com.google.api.server.spi.EndpointsServlet - services com.example.helloendpoints.Greetings @@ -35,17 +30,34 @@ limitations under the License. - - - - + + [END appengine-endpoints] + --> + + + + + + EndpointsServlet + com.google.api.server.spi.EndpointsServlet + + services + com.example.helloendpoints.Greetings + + + restricted + false + + + EndpointsServlet /_ah/api/* - + + + index.html diff --git a/appengine/endpoints-frameworks-v2/discovery/src/main/webapp/bootstrap/css/bootstrap-responsive.css b/appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/bootstrap/css/bootstrap-responsive.css similarity index 100% rename from appengine/endpoints-frameworks-v2/discovery/src/main/webapp/bootstrap/css/bootstrap-responsive.css rename to appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/bootstrap/css/bootstrap-responsive.css diff --git a/appengine/endpoints-frameworks-v2/discovery/src/main/webapp/bootstrap/css/bootstrap.css b/appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/bootstrap/css/bootstrap.css similarity index 100% rename from appengine/endpoints-frameworks-v2/discovery/src/main/webapp/bootstrap/css/bootstrap.css rename to appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/bootstrap/css/bootstrap.css diff --git a/appengine/endpoints-frameworks-v2/discovery/src/main/webapp/css/style.css b/appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/css/style.css similarity index 100% rename from appengine/endpoints-frameworks-v2/discovery/src/main/webapp/css/style.css rename to appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/css/style.css diff --git a/appengine/endpoints-frameworks-v2/discovery/src/main/webapp/index.html b/appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/index.html similarity index 100% rename from appengine/endpoints-frameworks-v2/discovery/src/main/webapp/index.html rename to appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/index.html diff --git a/appengine/endpoints-frameworks-v2/discovery/src/main/webapp/js/base.js b/appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/js/base.js similarity index 100% rename from appengine/endpoints-frameworks-v2/discovery/src/main/webapp/js/base.js rename to appengine/endpoints-frameworks-v2/migration-example/src/main/webapp/js/base.js