is a content handler and/or a filter, meaning, for a specified file extension, mod_spin will read the file (or other input), parse it into an Abstract Syntax Tree (AST) and then replace the occurrences of references with values coming from the application (this is where mod_spin is similar to Velocity). There is no redefined file extension for mod_spin templates. I sometimes use “.sm” for “spin macro”, but you can use whatever you like, as long as you tell Apache what that is.
Mod_spin supports the following features
- * a simple template language with data replacement capabilities only
- * persistent application and session tracking
- * dynamic linking of applications into Apache 2 as shared libraries
- * parameters, cookies and multipart/form-data parsing via libapreq2
- * simple API for (kind of) MVC controller functionality
- * simple API for pooled (or not) access to SQL databases
Installing Mod_spin as DSO
Mod_spin rpm and source can be found here ftp://ftp.rexursive.com/pub/mod-spin/ I have tested the rpm but it only works for the fedora core 12 version, if you have other distributions, just download the tar and build using the apxs.
- cd /usr/src
wget ftp://ftp.rexursive.com/pub/mod-spin/mod_spin-1.2.0.tar.bz2
bunzip2 mod_spin-1.2.0.tar.bz2
tar xvf mod_spin-1.2.0.tar
cd mod_spin-1.2.0/
To Build as a DSO for apache
From the top directory of mod_spin source do:
- ./configure [–prefix=/top/dir] [–with-apxs=/path/to/apxs] \
- [–with-flex-reentrant=/path/to/flex/installation/directory]
- make
- make install
Installing mod_spin as Static linking from source (Not Recommended)
From the top directory of mod_spin source do:
- ./configure [–prefix=/top/dir] –with-apache=/path/to/apache2/source \
[–with-apxs=/path/to/apxs] \
[–with-flex-reentrant=/path/to/flex/installation/directory]
make
make install
If this is the first time you are installing mod_spin into this source tree of
Apache, you will have to build appropriate files in modules/spin directory:
- ./buildconf
IMPORTANT: If you compiled Apache from this source tree before, you should
run:
- make distclean
If you don’t, compile or link may fail.
Configure Apache, either by using an existing configuration (you can also
edit config.nice and place –enable-spin there):
- ./config.nice –enable-spin
or by using brand new set of options:
- ./configure –enable-spin [your options here]
Later, if you don’t want mod_spin (why would you ever want to do that ;-), then
specify –disable-spin in your configuration options. Now build Apache and
install it:
Useful Links :