public
Description: A cross-platform web server that's scripted with Nu.
Homepage: http://programming.nu
Clone URL: git://github.com/timburks/nunja.git
Added an support for an optional nunja-site-prefix macro.

If defined, this is called at the beginning of each get and post handler.
timburks (author)
Thu May 01 16:34:52 -0700 2008
commit  bad61b54fda4c8ecc39241eded16453a61f0426c
tree    3c4cc9c17988f6d97e39c5813848a2fc29e9c9b3
parent  d5c9b6b4bc2090aef92acbde637be89b13db5357
...
220
221
222
 
 
223
224
225
...
230
231
232
233
 
234
235
236
...
243
244
245
246
 
247
248
249
...
220
221
222
223
224
225
226
227
...
232
233
234
 
235
236
237
238
...
245
246
247
 
248
249
250
251
0
@@ -220,6 +220,8 @@
0
                            (puts ((NSString alloc) initWithData:(request body) encoding:NSUTF8StringEncoding))
0
                            (request respondWithCode:404 message:"Not Found" string:"Not Found. You said: #{command} #{path}")))))))
0
 
0
+(global nunja-site-prefix nil) ;; default
0
+
0
 ;; Declare a get action.
0
 (global get
0
         (macro _
0
@@ -230,7 +232,7 @@
0
                       (($nunja handlers) << (NunjaRequestHandler handlerWithAction:"GET" pattern:__pattern statements:__statements)))
0
                  (else
0
                       (set __pattern (eval (car margs)))
0
- (set __function (eval (append '(do (MATCH REQUEST RESPONSE)) (cdr margs))))
0
+ (set __function (eval (append '(do (MATCH REQUEST RESPONSE) (nunja-site-prefix)) (cdr margs))))
0
                       (($nunja handlers) << (NunjaRequestHandler handlerWithAction:"GET" pattern:__pattern statements:__function))))))
0
 
0
 ;; Declare a post action.
0
@@ -243,7 +245,7 @@
0
                       (($nunja handlers) << (NunjaRequestHandler handlerWithAction:"POST" pattern:__pattern statements:__statements)))
0
                  (else
0
                       (set __pattern (eval (car margs)))
0
- (set __function (eval (append '(do (MATCH REQUEST RESPONSE)) (cdr margs))))
0
+ (set __function (eval (append '(do (MATCH REQUEST RESPONSE) (nunja-site-prefix)) (cdr margs))))
0
                       (($nunja handlers) << (NunjaRequestHandler handlerWithAction:"POST" pattern:__pattern statements:__function))))))
0
 
0
 ;; Set the top-level directory for a site

Comments

    No one has commented yet.