I’m developing an HTML app that integrates Facebook Graph API using Javascript SDK. Facebook recommended to use the channel file with the help of PHP, but I’m using Google App Engine and therefore have no idea how to achieve this with JSP instead.
Yes, I’m looking for JSP code snippet for doing just this.
And is it possible to do this entirely with HTML only as I want to rely on client-side programming as much as possible?
“It is important for the channel file to be cached for as long as possible. When serving this file, you must send valid Expires headers with a long expiration period. This will ensure the channel file is cached by the browser which is important for a smooth user experience. Without proper caching, cross domain communication will become very slow and users will suffer a severely degraded experience. A simple way to do this in PHP is:
“
<?php
$cache_expire = 60*60*24*365;
header("Pragma: public");
header("Cache-Control: max-age=".$cache_expire);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$cache_expire) . ' GMT');
?>
<script src="//connect.facebook.net/en_US/all.js"></script>
You can set your own HTTP response headers in JSP via
response.setHeader(name, value).If it’s possible without any actual programming depends on if Google App Engine let’s you configure that kind of stuff in their server configuration for certain files. I don’t know which type of web server they’re using, so you’d have to look that up in their docs.