开发者

Create dynamic files in Google App Engine

开发者 https://www.devze.com 2023-03-22 18:09 出处:网络
I am developing a website using GWT deployed in Google App Engine. With the data introduced by the user I would like to generate a .JS file.

I am developing a website using GWT deployed in Google App Engine. With the data introduced by the user I would like to generate a .JS file.

Are we allowed to create and store these files in Google App Engine? I cannot find anything in the documentation.

Which func开发者_如何学JAVAtion would you use for the .JS file creation, taking into account that data includes special characters (some non-printable characters in ASCII)?

Thanks!


You cannot generate files per se but as of recently, you are allowed to programmatically create blobs in the Blobstore using an API named - incidentally - Files API. If you specifiy the blob's MIME type as text/javascript, you can then serve it via Blobstore download handler in a way that mimics a static JS file.


Unfortunately this is not allowed...

An App Engine application cannot:

write to the filesystem. Applications must use the App Engine datastore for storing persistent data. Reading from the filesystem is allowed, and all application files uploaded with the application are available.

open a socket or access another host directly. An application can use the App Engine URL fetch service to make HTTP and HTTPS requests to other hosts on ports 80 and 443, respectively.

spawn a sub-process or thread. A web request to an application must be handled in a single process within a few seconds. Processes that take a very long time to respond are terminated to avoid overloading the web server. make other kinds of system calls.

http://code.google.com/appengine/docs/java/runtime.html#The_Sandbox


It's not possible; but as long as the JS files you need to generate are smaller than 1MB, you can store them into the datastore; I'd be happy to give you an basic application you can host files up to 10MB on GAE with, that only uses the Datastore API. (Python)

0

精彩评论

暂无评论...
验证码 换一张
取 消