[hunchentoot-devel] static files in hunchtentoot 1.1.1

Edi Weitz edi at weitz.de
Wed May 25 09:37:31 UTC 2011


Hi Mark,

The URL needs to look like "/exp/...something", i.e. you need a slash
after "exp" so that the browser knows how to interpret your GIF URLs.
If you write src="foo.gif", the image is looked up relative to the
"current directory".  So, if the page you're looking at has "/exp/" in
it, "exp" is the current directory.  But if it only has "/exp" in it
(no slash at the end), the current directory is the root directory.

If you don't want to change your base URL, you can either use a
different relative URL for your images like src="exp/foo.gif" or you
can use an absolute URL like src "/exp/foo.gif".  This is the way HTML
works and it's obviously modeled after similar concepts like the Unix
file system.

If you don't get the image you're expecting to see, just look at what
the browser is actually trying to retrieve from the server.  In your
original example I bet it tried to retrieve
"http://127.0.0.1/leaf.gif" and not "http://127.0.0.1/exp/leaf.gif" as
you expected.

HTH,
Edi.



On Tue, May 24, 2011 at 4:23 PM, Mark H. David <mhd at yv.org> wrote:
> Sorry, Edi, I'm just really lost. Could I ask you to clarify:
>
> Is your sentence saying what should be done to fix things, or what is wrong currently?
>
> And, which URL does your sentence refer to, the url-prefix arg to create-folder-..., or the example URL I gave (http://127.0.0.1:1234/exp?default-categorizer*)?
>
> And, while we're at it, I'm not that sure which direction is "behind"?  Does "exp" have a slash behind it in the following string? "/exp"
>
> I've various things based on various interpretations, but I feel I'm thrashing. :(
>
> Thanks,
>
> Mark
>
>
> ----- Original message -----
> From: "Edi Weitz" <edi at weitz.de>
> To: "General interest list for Hunchentoot and CL-WEBDAV" <tbnl-devel at common-lisp.net>
> Date: Tue, 24 May 2011 08:29:09 +0200
> Subject: Re: [hunchentoot-devel] static files in hunchtentoot 1.1.1
>
> There's no slash behind "exp" in your URL.
>
> Edi.
>
> On Tue, May 24, 2011 at 7:49 AM, Mark H. David <mhd at yv.org> wrote:
>> I cannot figure out how to serve static files (e.g., blah.gif) in Hunchentoot 1.1.1.
>>
>> I do
>>
>>  (hunchentoot:create-folder-dispatcher-and-handler "/exp/" "c:\\hunchentoot\\")
>>
>> and then have a URL
>>
>>  http://127.0.0.1:1234/exp?default-categorizer*
>>
>> that generates lots of
>>
>>  <img src="leaf.gif">
>>
>> and the like.  The file "leaf.gif" is in the directory "c:\hunchentoot".
>>
>> However, the GIF file is not being served.  I get the standard substitution image.
>>
>> What's the solution?
>>
>> Thanks,
>>
>> Mark
>>
>> _______________________________________________
>> tbnl-devel site list
>> tbnl-devel at common-lisp.net
>> http://common-lisp.net/mailman/listinfo/tbnl-devel
>>
>>
>
> _______________________________________________
> tbnl-devel site list
> tbnl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
>
>




More information about the Tbnl-devel mailing list