[Bese-devel] accessing the url
Evrim ULU
evrim at core.gen.tr
Tue Feb 28 19:38:45 UTC 2006
Daniel Patru wrote:
> How can I access the URL of a request within a render method?
> I tried printing it out with:
> (<:p (ucw::query-path (ucw::context.request *context*))),
> but all I get are the paragraph tags.
Some time ago, like other people, i've asked the same question to me,
afterwards, i've realized that i also need to parse the url. below code
may help. its ugly though.
cya.
evrim.
(defentry-point "^(|[0-9]*.core)$" (:application core-app
:class 'regexp-entry-point) ()
(let* ((uri (ucw::raw-uri (ucw::context.request *context*)))
(seqs (split-sequence:split-sequence #\/ uri
:remove-empty-subseqs t))
(current-entry-point (car (last seqs)))
(endpos (search ".core" current-entry-point :from-end t))
(linkname (subseq current-entry-point 0 endpos))
(current-index (1- (parse-integer linkname :junk-allowed t)))
(content-length (length (coretal.contents
(core-application.coretal (ucw::context.application *context*))))))
(if (and (> current-index 0) (< current-index content-length))
(let* ((widgets (application-content-widgets))
(container (make-instance 'content-container-widget
:components widgets)))
(setf (container.current-component container) (nth current-index
widgets))
(jump 'main-window :body container))
(call 'main-window))))
More information about the bese-devel
mailing list