google-cloud-endpoints

generate java google endpoints server stub from swagger API

随声附和 提交于 2019-12-02 06:17:49
问题 I'm looking for a way to generate a server stub for a java google endpoints backend project from a swagger API (yaml/json file). Any suggestions? Cheers, Asaf 回答1: The easiest way is to import your Swagger/OpenAPI spec into https://editor.swagger.io and in the top menu bar click on "Generate Server" and then select Java-related server stub (e.g. JAX-RS, Spring and more) Or you can install Swagger Codegen locally. Here is a good starting point: https://github.com/swagger-api/swagger-codegen

Get the current user from BlobstoreUploadHandler

故事扮演 提交于 2019-12-02 05:27:26
I want to get the current user from BlobstoreUploadHandler. I'm using endpoints for my web application, but (outside of Endpoints) I built /uploadUrl to upload files to the Blobstore. The image uploads correctly. So, I need to link the image uploaded to the user, but users.get_current_user() returns None . On the frontend side the user is logged using OAuth2. Any idea for this issue? If I use endpoints.get_current_user() raise an error: No valid endpoints user in environment This is my code: class UploadHandler(blobstore_handlers.BlobstoreUploadHandler): def post(self): upload_files = self.get

How to call App Engine Endpoints with the JavaScript library in promises mode

为君一笑 提交于 2019-12-02 04:00:00
I have a web application which calls several App Engine Endpoints with the Google API JavaScript client library. I am currently changing this application from callback mode to promises mode, as recommended by Google ( https://developers.google.com/api-client-library/javascript/features/promises#using-promises ) and I am encountering a problem. Note that the app works well with the callback mode. My problem with the promises mode is to find what is the correct path argument to use when calling the request method: JavaScrit code: var params = {'webSafeKeyParent’:

Error running endpointscfg.py get_swagger_spec

匆匆过客 提交于 2019-12-02 02:53:53
I am trying to build a project using Google Cloud Endpoints, following this guide: Quickstart for Cloud Endpoints Frameworks on App Engine . I am stuck at the step of generating the OpenAPI configuration file, where I need to run this command: Attempt One $ lib/endpoints/endpointscfg.py get_swagger_spec main.EchoApi --hostname your-service.appspot.com I get this error: -bash: lib/endpoints/endpointscfg.py: Permission denied Attempt Two I have tried the same command with sudo , which returned this error: sudo: lib/endpoints/endpointscfg.py: command not found Attempt Three I have tried to cd lib

Cloud endpoints authentication failure in android app

﹥>﹥吖頭↗ 提交于 2019-12-01 18:33:57
I'm having trouble with my first attempt to use authentication in debug mode in a Google Cloud Endpoints android app. I set up credentials like this: credential = GoogleAccountCredential.usingAudience(this, "server:client_id:long-string-i-got-from-api-console"); credential.setSelectedAccountName(accountName); then try to use it like this: final String LOCAL_APP_ENGINE_SERVER_URL = "http://xxx.xxx.x.xxx:8888"; Testdbendpoint.Builder endpointBuilder = new Testdbendpoint.Builder( AndroidHttp.newCompatibleTransport(), new GsonFactory(), credential); endpointBuilder.setRootUrl(LOCAL_APP_ENGINE

convert servlet schema to app-engine endpoint schema

こ雲淡風輕ζ 提交于 2019-12-01 17:52:21
Would the following conversion hold for converting from Java servlet to google app-engine cloud endpoint? FROM public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { … } TO @ApiMethod(name = "save_blob_key", path = "save_blob_key" httpMethod = HttpMethod.POST) public void saveBlobKey(HttpServletRequest req) throws IOException { … } CONTEXT: I am trying to use endpoint to process blobstore callback. Ref: https://developers.google.com/appengine/docs/java/blobstore/overview#Complete_Sample_App PROBLEM: The big hickup here is that the following

convert servlet schema to app-engine endpoint schema

拈花ヽ惹草 提交于 2019-12-01 16:23:32
问题 Would the following conversion hold for converting from Java servlet to google app-engine cloud endpoint? FROM public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { … } TO @ApiMethod(name = "save_blob_key", path = "save_blob_key" httpMethod = HttpMethod.POST) public void saveBlobKey(HttpServletRequest req) throws IOException { … } CONTEXT: I am trying to use endpoint to process blobstore callback. Ref: https://developers.google.com

java.security.AccessControlException: File accessible thru browser but not within same server

有些话、适合烂在心里 提交于 2019-12-01 13:30:27
So to not repeat myself too much, please refer to serve static image along side java google-enpoint api . As you can see from the referenced link, I am able to view the image through the url. However, when I am trying to read filenames using similar code to public void listFilesForFolder(final File folder) { for (final File fileEntry : folder.listFiles()) { if (fileEntry.isDirectory()) { listFilesForFolder(fileEntry); } else { System.out.println(fileEntry.getName()); } } } final File folder = new File("/home/you/Desktop"); listFilesForFolder(folder); I get a security exception java.security

Objectify with Endpoints for android

二次信任 提交于 2019-12-01 12:53:48
I read that Objectify is a supported framework for use with Endpoints. How do I convert the sample from the GPE App Engine Connected Android Project wizard to deal with Objectify 4 data? I'm getting this: org.datanucleus.exceptions.ClassNotPersistableException: The class "com.example.MyObjectifyTestInfo" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found. I have searched a lot, but found nothing in stackoverflow or

How to return a file with Google Cloud Endpoints?

∥☆過路亽.° 提交于 2019-12-01 12:24:08
问题 I have a method that generate a CSV file with some db records public static void generateCsvForAttendees( List<Attendee> attendeeList ) throws FileNotFoundException { PrintWriter pw = new PrintWriter(new File("test.csv")); StringBuilder sb = new StringBuilder(); //Header sb.append( "Id" ); sb.append( ',' ); sb.append( "Name" ); sb.append( ',' ); sb.append( "Lastname" ); sb.append('\n'); //Content for( Attendee attendee: attendeeList ) { sb.append( attendee.getId() ); sb.append( ',' ); sb