One Small Serving of WebApp Tips #
Maybe you remember Tanaka-san’s WebApp from a few weeks back. I’ve been using it here on the site to power our posting CGIs. It acts as a very simple wrapper for Hobix, which does the work of refreshing this site’s static HTML efficiently.
Time for a few undocumented tips I’ve picked up while sifting through the source.
- Set
ENV['WEBAPP_DEVELOP_HOST']
to your IP before yourequire 'webapp'
. When exceptions are thrown, you’ll see the exception. Other users will get an error page.
- Customize the debug and error pages by overriding
WebApp::Manager#generate_debug_page
andWebApp::Manager#generate_error_page
.
- WebApp works best when paths are addressed after the CGI’s path. Here’s a set of rewrite rules:
RewriteEngine On RewriteCond %{REQUEST_URI} !webapp.cgi RewriteRule ^(.*)$ /posts/webapp.cgi/$1
- If using the above, you can generate links relative to the CGI path by using
web.reluri( :path_info => '/posts/list' )
.
- You might want to alias the verbose accessors for GET and POST variables.
class WebApp alias _get query_html_get_application_x_www_form_urlencoded alias _post query_html_post_application_x_www_form_urlencoded end
gavri
The Webapp link doesn’t work
why
I can’t do anything right.
Comments are closed for this entry.