[Bese-devel] Re: Providing raw data (Service link)

Marco Baringer mb at bese.it
Mon Apr 24 11:43:21 UTC 2006


Marco Baringer <mb at bese.it> writes:

> Christian Haselbach <chriss at muon.de> writes:
>
>> Hello,
>>
>> what is the best way to create an url where raw data (i.e., not
>> wrapped / modified by ucw) is served, but where the current session is
>> available to create the data. I am looking for something that is called
>> Service Link in Tapestry.

wolud this make a good addition to ucw:


(defclass service-link (regexp-dispatcher)
  ()
  (:documentation "A very simple dispatcher which just calls the
  dispatcher's HANDLER. All normal UCW session/frame mechanisms
  are ignored. Usefull for dynamic images and binary content and,
  probably, ajax stuff."))

(defmethod dispatch ((dispatcher service-link)
                     (application standard-application)
                     (context standard-request-context))
  (multiple-value-bind (matchp *dispatcher-registers*)
      (cl-ppcre:scan-to-strings (url-string dispatcher)
                                (query-path-sans-prefix context)
                                :sharedp t)
    (when matchp
      (funcall (handler dispatcher) application context))))

(defclass service-link-with-session (service-link)
  ()
  (:documentation "Just like service-link but also ensures a
  session object is created."))

(defmethod dispatch ((dispatcher service-link-with-session)
                     (application standard-application)
                     (context standard-request-context))
  (multiple-value-bind (matchp *dispatcher-registers*)
      (cl-ppcre:scan-to-strings (url-string dispatcher)
                                (query-path-sans-prefix context)
                                :sharedp t)
    (when matchp
      (setf (context.session context) (or (find-session application context)
                                          (make-new-session application))
            (session.last-access (context.session context)) (get-universal-time))
      (funcall (handler dispatcher) application context))))

basically these are two regexp-dispatchers (one also adds a session
objcet) which don't do _any_ of the normal ucw stuff. basically what
you have here is no more (and no less) than a standard araneida
dispatcher wolud give you.

-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen




More information about the bese-devel mailing list