On Mon, 20 Mar 2000, Mark Guzdial wrote:

> Powered by <img src="uploads/comancheLogo.gif">
> http://localhost/OSG
> I assume this is because the file server module simply appends the url
> to the text of the image tag and it ends up looking like this:
> 
> OSGuploads/comancheLogo.gif

[I'd say it ends up like http://localhost/uploads/comancheLogo.gif - if
you choose "View image" in Netscape you'll get the actual url]

It's not the file server module's fault (that url is constructed by the
browser). Per definition, a relative path is converted into a full path by
concatenation with the base path (current document url) only. So what you
see is actually correct.

However, if a server receives a request for a directory without trailing
slash, it usually answers with a redirect to the same directory including
the slash. This is so fast nobody notices it (try it!).

Now, Comanche cannot know that the path /OSG points to a directory. Not
even the Swiki module can know, because it is designed to accept pages
referenced like /OSG.11 - all references are absolute.

But we both want /swiki to behave like a directory, right? So we have to
implement the redirect by ourselves. I'll attach my default.book address.
It uses a "redirectBase" setting that is the Comanche url without the
path: <s name="redirectBase">'http://swiki.gsug.org:8888'</s>

Thus, if you point your browser to http://swiki.gsug.org:8888/gsug it will
immediately be redirected to http://swiki.gsug.org:8888/gsug/ . Look at
the source code and you'll see that the button bar is created by relative
image urls :-)

  -Bert-
(request url occurrencesOf: $/) = 1
    ifTrue: [request redirectTo: (book settings 
at: 'redirectBase' ifAbsent: ['']), request urlPrefix. 'Redirected']
       ifFalse: 
[(request address = 'default')
                ifTrue: [book formatPageTemplate: 
'default' request: request page: (book pages at: 1)]
         ifFalse: [book 
pageAlmostNamed: (request address)
                      ifThere: [:page | book 
formatPageTemplate: 'default' request: request page: page]
                      
ifNot: [request headerStatus: #notFound.
                               book 
formatBookTemplate: 'addnotfound' request: request]]]

Reply via email to