The Site is resolved in the MultiSite filter and cache filter is executed much
later.
So as long as you set the "site" parameter for the SiteURIPatternVoter, you can
set the pattern to "/".
if (StringUtils.equals(site, currentSite.getName())) {
return simpleUrlPattern.match(uri);
}
in the voter should ensure match only when the site name matches the current
site. You might have to increase the level in case you have also other voters
in your set.
HTH,
Jan
On Jul 21, 2010, at 3:22 PM, Bert Leunis wrote:
> Good idea, that SiteURIPatternVoter (and thanks Matteo!). But the problem I
> described with the URIStartsWithVoter is the same here. The
> resolveUriFromValue method returns
> "/nieuws/2009/oktober/financieel-abc.html". Therefore the match with the site
> will not work since the sitename is not in the URI. The uri returned must be
> "/tegenlicht/nieuws/2009/oktober/financieel-abc.html" which has the sitename
> in it.
>
> There should be a method resolveBrowserURIFromValue that is a copy of
> resolveUriFromValue except for this line:
>
> uri = MgnlContext.getAggregationState().getCurrentURI();
>
> which should be:
>
> uri = MgnlContext.getAggregationState().getOriginalBrowserURI();
>
> Am I right?
> Regards, Bert
>
> Van: [email protected] [[email protected]]
> namens Jan Haderka [[email protected]]
> Verzonden: woensdag 21 juli 2010 14:07
> Aan: Magnolia User-List
> Onderwerp: Re: [magnolia-user] cache filter configuration bypass does not work
>
>
> On Jul 21, 2010, at 1:33 PM, Bert Leunis wrote:
>
>> @Jan: In the article you write that you have to make separate filters. Every
>> filter has its voters, and every filter has a reference to its specific
>> cacheConfiguration. I will test the SiteURIPatternVoter. My own
>> BrowserURIStartsWithVoter creates different caches now for every site.
>
> Ah ok, i get it now, you need the voter for the filter bypass, not for the
> cache configuration. Yeah, it worked at the time of writing the article, but
> not anymore since the current URI is now updated properly. The site voter
> should be enough.
>
>>
>> @Gregory: Jans point in the article is that you don't need a specific
>> CachePolicy!
>
> Not only that. There are other advantages. You can easily switch off cache
> for different sites in the multisite setup and you can flush them very simply
> by flushing each cache instance completely w/o having to iterate through all
> the content of the cache and evaluating each and every item.
>
>>
>> Regards, Bert
>>
>>
>> Van: [email protected] [[email protected]]
>> namens Jan Haderka [[email protected]]
>> Verzonden: woensdag 21 juli 2010 13:05
>> Aan: Magnolia User-List
>> Onderwerp: Re: [magnolia-user] cache filter configuration bypass does not
>> work
>>
>> See http://jira.magnolia-cms.com/browse/MGNLSTK-667 and
>> http://svn.magnolia-cms.com/svn/community/modules/standard-templating-kit/trunk/magnolia-module-standard-templating-kit/src/main/java/info/magnolia/module/templatingkit/voters/SiteURIPatternVoter.java
>>
>> Voter allows you to restrict application of the pattern to given site/domain
>> only. In cache you would restrict the domain and apply to all the content in
>> given domain.
>>
>> just one extra question. If I still remember right what I wrote (can't get
>> to java.net right now) in that article, you are supposed to configure one
>> instance of the filter and one cache per site. Since you specify cache
>> configuration (and therefore instance of the cache to use) in the filter,
>> there is no need to limit the cache by the voter since it will be chosen by
>> the filter or did i miss something in your description of the problem?
>>
>> Cheers,
>> Jan
>>
>> On Jul 21, 2010, at 11:55 AM, Bert Leunis wrote:
>>
>>> Thanks Jan. Very interested in the SiteVoter of course. Will continue the
>>> experiment with my own voter.
>>>
>>> Ciao, Bert
>>> Van: [email protected] [[email protected]]
>>> namens Jan Haderka [[email protected]]
>>> Verzonden: woensdag 21 juli 2010 11:28
>>> Aan: Magnolia User-List
>>> Onderwerp: Re: [magnolia-user] cache filter configuration bypass does not
>>> work
>>>
>>>
>>> On Jul 20, 2010, at 5:25 PM, Bert Leunis wrote:
>>>
>>>> Hello Magnolians,
>>>>
>>>> Here at Vpro headquarters we try to configure caching for multisites.
>>>> Besides the documentation for the cache module and advance cache module,
>>>> this blog by Jan gave us a lot of useful and detailed information:
>>>>
>>>> http://weblogs.java.net/blog/rah003/archive/2010/03/24/flush-cache
>>>
>>> Glad you found it useful
>>>
>>>>
>>>> We configured two cache filters, like the blog describes (see attached
>>>> image for our config). Unfortunately the URIStartsWithVoter does not work
>>>> the way we expect. When the voter is used, it tries to see if the current
>>>> URI starts with the pattern (/hollanddoc in this case). The method
>>>> info.magnolia.voting.voters.BasePatternVoter.resolveURIFromValue(Object)
>>>> returns "/service.html" for the request on url:
>>>> "http://localhost:8081/magnolia-site/hollanddoc/service.html" but it
>>>> should return "/hollanddoc/service.html".
>>>>
>>>> The input parameter for the mentioned method is of type
>>>> org.apache.catalina.connector.RequestFacade, so this line produces the
>>>> return value:
>>>>
>>>> uri = MgnlContext.getAggregationState().getCurrentURI();
>>>>
>>>> This causes "/service.html" to be returned, instead of
>>>> "/hollanddoc/service.html".
>>>>
>>>> How to solve this problem? Do we need to use another voter, something like
>>>> a BrowserURIStartsWithVoter? I think this one does not exist yet.
>>>
>>> yes you need different voter. Either for BrowserURI or for Site itself.
>>> I've got one for Site (but not written by myself) ... will try to get it
>>> published soon.
>>>
>>> Cheers,
>>> Jan
>>>
>>>>
>>>> Advice much appreciated! Thanks,
>>>> Bert
>>>>
>>>>
>>>> ----------------------------------------------------------------
>>>> For list details see
>>>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>>>> To unsubscribe, E-mail to: <[email protected]>
>>>> ----------------------------------------------------------------
>>>> <cache_config.PNG><aggregationstate.PNG>
>>>
>>>
>>>
>>>
>>> ----------------------------------------------------------------
>>> For list details see
>>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>>> To unsubscribe, E-mail to: <[email protected]>
>>> ----------------------------------------------------------------
>>>
>>>
>>> ----------------------------------------------------------------
>>> For list details see
>>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>>> To unsubscribe, E-mail to: <[email protected]>
>>> ----------------------------------------------------------------
>>
>> -
>> Best regards,
>>
>> Jan Haderka, PhD.
>> Magnolia International Ltd.
>>
>> http://www.magnolia-cms.com
>>
>> You should join us at Magnolia Conference 2010:
>> http://www.magnolia-cms.com/conference
>>
>> http://twitter.com/magnolia_cms
>> http://facebook.com/Magnolia
>>
>> --------------------------------------
>>
>> Magnolia® - Simple Open-Source Content Management
>>
>>
>>
>>
>>
>>
>> ----------------------------------------------------------------
>> For list details see
>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>> To unsubscribe, E-mail to: <[email protected]>
>> ----------------------------------------------------------------
>>
>>
>> ----------------------------------------------------------------
>> For list details see
>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>> To unsubscribe, E-mail to: <[email protected]>
>> ----------------------------------------------------------------
>
>
>
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
>
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------