Re: Filter question
Murray Altheim <[email protected]>
| Newsgroups | gmane.comp.java.jspwiki.user |
|---|---|
| Message-ID | <[email protected]> |
Terry Steichen wrote:
> If it only took a few minutes, you should pat yourself on the back.
> (Maybe that's pretty potent cold medicine?) The idea of reaching through
> the cache to the underlying 'real' page is something that a number of
> folks (self included) have tripped up on. (And, in my case at least, it
> took me quite a bit more than minutes to noodle it out.)
Hi Terry,
Well, I spoke too soon. I've managed to get access to the real page
but it turns out that this fixes only about half of the problems
with the various page components (i.e., content coming from other
pages such as LeftMenu). This might be exposing a bug in page content
processing, dunno.
I now have the filter correctly passing the content through on
LeftMenu, LeftMenuFooter, CopyrightNotice (may be my own custom
page, can't remember), and TitleBlock (a custom page used inside
Header.jsp to provide header content).
It seems to matter *how* the page is accessed within the JSPs, but
I've not figured that part out yet. For example, LeftMenuFooter
is included in Favorites.jsp via:
<wiki:InsertPage page="LeftMenuFooter" />
without any problem, but the content following "G'day," is getting
caught by the filter on
<wiki:CheckRequestContext context='!login'>
<wiki:UserCheck status="known">
<wiki:Translate>[{TEST page='{$username}Favorites'
%%collapsebox-closed
! [My Favorites|{$username}Favorites]
[{InsertPage page='{$username}Favorites' }]
%% }]
</wiki:Translate>
</wiki:UserCheck>
In the above case I'm actually getting two copies of my error page,
with getRealPage() returning the name of the currently-requested
page which causes the filter to refuse and return the error message.
This means I end up with the error message intended for the content
area also showing up where that InsertPage plugin is instantiated.
If this is unclear I'll try to put up something on the wiki since
this all needs documentation anyway and it's mostly already written
in the javadocs.
... okay. I've just posted an initial (non-functioning) distribution,
a sample filters.xml and some docs at
http://www.jspwiki.org/wiki/PermittedPageFilter
Any help appreciated...
Murray
> Murray Altheim wrote:
>> Well, after banging my head against a wall for a few minutes the
>> answer came clear. I just need to use
>>
>> String name = context.getRealPage();
>>
>> to get the name of the included page... *sigh* ...and the cold
>> medicine is not working either.
>>
>> Murray
>>
>> I wrote:
>>> Hi,
>>>
>>> I'm developing a new filter called a PermittedPageFilter that will
>>> use two wiki pages: one to provide a list of permitted pages and
>>> a second to serve as an error page. Any page on the permitted list
>>> is passed through the filter with no change; the contents of the
>>> error page are returned for any page not on the permitted list.
>> [...]
>>> How do I permit LeftMenu and its ilk to pass through the filter
>>> but halt access to a page? Maybe I shouldn't be using a filter?
...........................................................................
Murray Altheim <murray07 at altheim.com> === = =
http://www.altheim.com/murray/ = = ===
SGML Grease Monkey, Banjo Player, Wantanabe Zen Monk = = = =
Boundless wind and moon - the eye within eyes,
Inexhaustible heaven and earth - the light beyond light,
The willow dark, the flower bright - ten thousand houses,
Knock at any door - there's one who will respond.
-- The Blue Cliff Record