Function: make-urlmap

Documentation

Stores normalized url-specs (according to type) within a urlmap object.

Source

(defun make-urlmap (map-name url-specs)
  "Stores normalized url-specs (according to type) within a urlmap object."
  (let (wethods class-wethods handlers packages maps)
    (dolist (url-spec url-specs)
      (let* ((type (first url-spec))
	     (plist (cdr url-spec))
	     (url (getf plist :url)))
	(ecase type
	  (:handler
	   (push (make-instance 'url-handler
				:url url
				:dispatch (getf plist :dispatch))
		 handlers))
	  (:wethod
	   (push (make-instance 'url-wethod
				:url url
				:dispatch (symbol-function (getf plist :wethod-name)) 
				:discriminators (getf plist :discriminators)
				:wethod-urls (getf plist :wethod-urls))
		 wethods))
	  (:class-wethod
	   (push (make-instance 'url-class-wethod
				:url url
				:dispatch (symbol-function (getf plist :wethod-name)) 
				:discriminators (getf plist :discriminators)
				:wethod-urls (getf plist :wethod-urls))
		 class-wethods))
	  (:package
	   (push (make-url-package plist) packages))
	  ;; TODO make the url path in url-spec more robust.
	  (:map (push (make-instance 'url-nested-map
				     :url url
				     :nested-map-name (getf plist :map-name))
		      maps)))))
    (make-instance 'urlmap
		   :name  map-name
		   :handlers (nreverse handlers)
		   :wethods (nreverse wethods)
		   :class-wethods (nreverse class-wethods)
		   :packages (nreverse packages)
		   :maps (nreverse maps))))
Source Context