[Seaside] Url's

Avi Bryant avi.bryant at gmail.com
Wed Oct 26 23:13:47 UTC 2005

On Oct 26, 2005, at 3:47 PM, Avi Bryant wrote:
> This should work:
> WADispatcher default basePath: '/'

Though, of course, that exhibits the problem Ramon pointed out.  So I  
think the better solution is to use this patch:

handlerForRequest: aRequest relativeTo: base
       | path name |
        path := aRequest url.
        (base isEmpty or: [path beginsWith: base])
                ifTrue: [| relativePath |
                        relativePath := path allButFirst: base size.
                        (relativePath notEmpty
                                        and: [relativePath first = $/])
                                ifTrue: [name := (relativePath  
findTokens: '/')
                                                                at: 1
ifAbsent: []].
                                at: name
                                ifPresent: [:n | ^ n]].
        ^ WANotFoundHandler new

And then

WADispatcher default basePath: ''

The root problem here, I think, is that

'foo' beginsWith: ''

returns false, which is not the semantics I would expect.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://liststest.squeakfoundation.org/pipermail/seaside/attachments/20051026/aa1976db/attachment-0001.html

More information about the Seaside mailing list