[Bese-devel] entry points other than index.ucw

Marco Baringer mb at bese.it
Wed Dec 22 12:07:55 UTC 2004


"Marco Baringer" <mb at bese.it> writes:

> this means that you could, by definig the right entry-points and the
> "right" compute-url and update-url, methods create either wiki style
> links, REST style links, the with backtracking urls you mentioned
> above (excellent idea), or anything else you wanted. that's the idea
> at least, i'm working on this now and we'll see if in practice it
> turns out as nice as it sounds.

i just commited it (turned out to be a pretty small change
too). here's the code which will allow the example app's counter
component's links to work across sessions:

(defentry-point "counter.ucw" (:application example-app) ((value "0"))
  (let* ((example (make-instance 'example-app))
         (body (example-app.body example))
         (counter (ucw::find-component body 'counter)))
    (setf (container.current-component-name (example-app.body example)) 'counter
          (value counter) (or (parse-integer value :junk-allowed t) 0))
    (call-component self example)))

(defmethod update-url ((counter counter) url)
  (setf (ucw::uri.path url) "counter.ucw")
  (push (cons "value" (princ-to-string (value counter))) (ucw::uri.query url)))

the counter.ucw entry-point is complicated only because it has to
recreate the rest of the example app as well. i started implemnetating
a generic "save all backtrack'd slots to url" function, but this would
require marshalling/unmarshilling issues i don't want to get into
right now.

there is one issue though: in the counter app the urls are generated
with the current (when the link is created) value of the counter. this
means that: if you're looking at a counter page and the value on the
screen is 2 and then you decrement you'll bee looking at 1. if you let
the session expire and reload the page you'll be looking at 2 again,
and not 1, since the value in the url of the page is 2 which was the
value when the link generated. it may be neccessary to calculate urls
_before_ the action is called, we'll see. (if nothing else it's a good
start.)

-- 
-Marco
Ring the bells that still can ring.
Forget your 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