[Bese-devel] serve-file and content-disposition

burban at opopop.net burban at opopop.net
Thu May 27 21:07:01 UTC 2010


Clinton Ebadi <clinton at unknownlamer.org> writes:

> burban at opopop.net writes:
> 
> > Well, can't really answer about your content-type question. But I
> > never used static-roots-application-mixin before, relying on apache to
> > direct the request to static file or UCW handling. You triggered my
> > curiosity.
> >
> > So static-roots-application-mixin works (I tried downloading non-html
> > files). Except that you have to run the :after method
> > startup-application by hand; registering the application in a running
> > server won't do it. You are normally not hit by that as other types of
> > applications don't need an initializer. I see no reason that
> > initialization step couldn't be put in make-instance, or am I missing
> > something?
> 
> IIRC You are not permitted to extend make-instance directly, and that

OOPS, I was meaning an :after initialize-instance. This works:

(in-package :ucw-standard)

(defmethod initialize-instance :after ((app static-roots-application-mixin)
                                       &rest initargs &key &allow-other-keys)
  (when-bind static-roots (application.static-roots app)
    (mapc (lambda (root)
            (defentry-point (car root) (:application app
                                        :class starts-with-dispatcher
                                        :with-call/cc nil
                                        :action-options (:class 'action))
                ()
              (serve-file (merge-pathnames *dispatcher-url-suffix*
                                           (cdr root)))))
          static-roots)))

It's not so different from what defcomponent macro is doing.

> would be the wrong time to register the entry points anyway (given that
> there may very well be no server associated with the application).

defentry-point doesn't need the :application argument to be registered
to a server to work, if its body doesn't refer to that server.

> AFAICT with the server protocol registering an application should *not*
> make it start anyway; there are separate `register-FOO' and `start-FOO'
> methods for a reason. I am thinking it should be an error to register an
> application with a server that is already running, but I'll defer to
> drewc's opinion on this.

I register applications with a server that is already running
(starting with no registered apps), without harm so far...

>From the code, startup-application and shutdown-application bother
with session clearing, so you are right. In practice, only
shutdown-application does real work, which explain I am currently fine.

Good point to keep in mind though...

Regards.

-- 

B. Urban





More information about the bese-devel mailing list