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

burban at opopop.net burban at opopop.net
Wed May 26 23:41:51 UTC 2010


Anton Rizov <anton.rizov at gmail.com> writes:

> Hi,
> 
> serve-file method doesn't expose content-disposition parameter. Is
> that intentional?.
> 
> I was looking at how to serve static content with ucw and found
> serve-file.  Unfortunately it assumes that content disposition is
> "attachment" and doesn't provide a way for one to specify an
> alternative.
> 
> It was easy to change it, so that it could be used as:
> 
> (serve-file (make-pathname ...)
>             :content-disposition "inline"
>             :content-type "text/html; charset=\"...\"")
> 
> but I'm wondering whether there is a reason or it's only a matter of
> unintentional omission.
> 
> Is "attachment" really the preferred way to serve static content,
> especially for html files? I tried using
> static-roots-application-mixin and was surprised to see download
> dialog opening.

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?

Regards.

-- 

B. Urban




More information about the bese-devel mailing list