forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Unico Hommes" <Un...@hippo.nl>
Subject RE: LocationMapModule
Date Fri, 17 Oct 2003 14:49:49 GMT


Nicola Ken Barozzi wrote:
> 
> 
> Unico Hommes wrote:
> > Pass it where? #lm:name is just the key to a Parameter that 
> holds the input module argument /my/path . The Matcher 
> interface does not allow the passing of a src attribute for instance:
> 
> Of course, a matcher /usually/ needs _two_ things, a pattern and 
> something to match it against.
> 
> But if we add somehow the inputmodule argument to the request URI...
> 

It's possible. We could wrap the original Request and supplement the URI (because the the
request URI is read-only); But maybe its not the most convenient solution. I see your point
though that having to specify a special parameter is not very clear. I had already been considering
a seperate matcher that hides that detail (would be no more than a few lines of code). I would
prefer that over modifying the request uri.

> >>Can't we simply concatenate the two strings?
> >>
> >>For example, if I have:
> >>
> >>    path/to/page.html
> >>
> >>and I called:
> >>
> >>    {lm:gogogo}
> >>
> >>then I can give the locator:
> >>
> >>   "lm:gogogo|path/to/page.html"
> >>
> >>In this way I can use standard matchers that can decide to 
> >>match on the 
> >>part before |, on the part after, or both.
> > 
> > I'm not sure if I understand this correctly. 
> 
> Basically it's about adding the inputmodule part to the request URI.
> 

But in the case of semantic linking where the input module argument is the only thing to look
at that would be very inconvenient. 


> > 
> > IIUC we could do this with the current implementation:
> > 
> > <match pattern="**.html">
> >   <match pattern"style" type="parameter">
> >     <location src="somewhere/styles/{1}" />
> >   </match>
> >   <match pattern="source" type="parameter">
> >     <location src="somewhereelse/content/{1}" />
> >   </match>
> > </match>
> 
> Correct, but we need a special matcher, while in my proposal 
> we use only 
> standard matchers, and can also use regexp and wildcard 
> matching in the 
> locator hint part.
> 

B.t.w. there's also a regexp parameter matcher.


OK, what about creating a special purpose matcher:

class WildcardLocationMapMatcher extends AbstractWildcardMatcher {
  
    /**
     * Return the LocationMapModule hint concatenated with the request URI.
     */
    protected String getMatchString(Map objectModel, Parameters parameters) {
        
        String hint = parameters.getParameter(LocationMapModule.HINT_PARAM);
        String uri = ObjectModelHelper.getRequest(objectModel).getSitemapURI();

        return hint + uri;
    }

}

And have an equivalent one for regular expression matching. Actually, I think this is exactly
what you meant isn't it?

> ...


Mime
View raw message