Browse code
feat: basic framework in place
Ed Langley authored on 29/10/2020 20:34:26
Showing 3 changed files
Showing 3 changed files
... | ... |
@@ -5,10 +5,12 @@ |
5 | 5 |
:description "" |
6 | 6 |
:author "Ed L <edward@elangley.org>" |
7 | 7 |
:license "MIT" |
8 |
- :depends-on (#:alexandria |
|
9 |
- #:uiop |
|
10 |
- #:serapeum |
|
11 |
- #:hunchentoot) |
|
8 |
+ :depends-on (:alexandria |
|
9 |
+ :uiop |
|
10 |
+ :serapeum |
|
11 |
+ :hunchentoot |
|
12 |
+ :myway |
|
13 |
+ :fwoar-lisputils) |
|
12 | 14 |
:serial t |
13 | 15 |
:components ((:file "package") |
14 | 16 |
(:file "araneus-2"))) |
... | ... |
@@ -1 +1,25 @@ |
1 | 1 |
(in-package :araneus-2) |
2 |
+ |
|
3 |
+(defgeneric mapper (acceptor) |
|
4 |
+ (:documentation "")) |
|
5 |
+ |
|
6 |
+(defclass acceptor (hunchentoot:acceptor) |
|
7 |
+ ((%mapper :initform (myway:make-mapper) :reader mapper))) |
|
8 |
+ |
|
9 |
+(defvar *current-route*) |
|
10 |
+ |
|
11 |
+(defgeneric resolve-request (acceptor request) |
|
12 |
+ (:method-combination or :most-specific-first) |
|
13 |
+ (:method or ((acceptor acceptor) request) |
|
14 |
+ (let ((router (mapper acceptor))) |
|
15 |
+ (myway:dispatch router (hunchentoot:script-name*) |
|
16 |
+ :method (hunchentoot:request-method*))))) |
|
17 |
+ |
|
18 |
+(defmethod hunchentoot:acceptor-dispatch-request ((acceptor acceptor) request) |
|
19 |
+ (multiple-value-bind (result matched) |
|
20 |
+ (resolve-request acceptor request) |
|
21 |
+ (if matched |
|
22 |
+ result |
|
23 |
+ (call-next-method)))) |
|
24 |
+ |
|
25 |
+ |