Luracast Restler not working on Google App Launcher
I want to create a website on Google Cloud (Google App Engine GAE based Joomla and Restler RESTful API Server) with sub domains:
http:// api.restlerongooglecloud .com for hybrid app (based on Restler API serving smart phones like Android, iOS, Windows Phone)
and
blog: http:// joomla.restlerongooglecloud .com (Joomla blog on GAE Launcher is working nicely, I followed the guide at this link: http:// forum.joomla .org/viewtopic.php?f=706&t=828565&p=3114492 )
and
http:// www.restlerongooglecloud .com for main page.
Before I upload live site to GAE Cloud I tried to test if Restler is working fine with Google App Launcher.
The directory structure is
GAEproject-root /api/... for Restler 3.0 RC3
GAEproject-root /joomla/ for blog
GAEproject-root / app.yaml
My app.yaml is as follows:
application: restlerongae
version: 1
runtime: php
api_version: 1
handlers:
## api images
- url: /api/(.*.(ico$|jpg$|png$|gif$))
static_files: api/1
upload: api/(.*.(ico$|jpg$|png$|gif$))
application_readable: true
## api html
- url: /api/(.*.(htm$|html$|css$|js$))
static_files: api/1
upload: api/(.*.(htm$|html$|css$|js$))
application_readable: true
## api test1
- url: /api/(.*)
script: api/public/examples/_001_helloworld/index.php
When I run the website and point to Restler 3.0 RC5 example:
http:// localhost /api/public/examples/_001_helloworld/say/hello I get following error:
{ "error": { "code": 404, "message": "Not Found" }, "debug": { "source": "Routes.php:359 at route stage", "stages": { "success": [ "get" ], "failure": [ "route", "negotiate", "message" ] } } }
I tried to figure out why this error, but unfortunately I am not successful and new to object oriented PHP and Restler.
Please help, how do I fix this error.
As GAE does not use ".htaccess " file or Apache, how to model "the Aapache mod_rewrite feature" using "mod_rewrite.php" Please see more details here: https:// developers.google .com/appengine/docs/php/config/mod_rewrite
Further:
Writing to local files is not supported in App Engine due to the distributed nature of your application. Instead, data which must be persisted should be stored in the distributed datastore. For more information see the documentation on the runtime sandbox
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.
GAE provides a stream wrapper for Google Cloud Storage which makes using the service very simple. Assuming you have completed the prerequisites files on GCS may be accessed using standard PHP file handling functions as shown in the documentation.
$contents = file_get_contents($file);
var_dump($contents); // prints: hello world
?>
I think the code in HumanReadableCache.php needs to be changed to use gs://bucket/file for cache implementation. (apiVersionMap AUTO GENERATED FILE ) I am not really a OOP_PHP programmer to replace/edit code in HumanReadableCache.php so could you please help and to come up with GAE version of Restler? Thanks a lot.
Could you try using RC6 which has modified version of HumanReadableCache which does not check for file writability
in your index.php do the following to map the saving of data gs path
use LuracastRestlerRestler;
use LuracastRestlerHumanReadableCache;
HumanReadableCache::$cacheDir = 'gs://bucket'; //replace bucket with your bucket name
$r = new Restler();
//...
链接地址: http://www.djcxy.com/p/66090.html