A bookmarkable page link is a bit different because that link shouldn't throw an exception
or redirect to something i think. That one should just base his visibility on the constructor params
And that is done by: boolean isActionAuthorized(Component component, Action action);
and then the RENDER action. The only problem is that you can't get the params back out
(there is no getParameters() and getPageClass())
But this is pretty solveable by making your own simple BookmarkablePageLink
The setResponsePage(Class [, PageParams] ) is different there you can't easily come between something
If you want to catch if you can construct that page after the redirect. I don't know what the best way would be
currently this is the code:
public void respond(RequestCycle requestCycle)
{
if (pageClass != null)
{
if (requestCycle.getRedirect())
{
IRequestCycleProcessor processor = requestCycle.getProcessor();
String redirectUrl = processor.getRequestCodingStrategy()
.encode(requestCycle, this).toString();
requestCycle.getResponse().redirect(redirectUrl);
}
else
{
// Let the page render itself
getPage(requestCycle).renderPage();
}
}
}
so in the if (requestCycle.getRedirect ()) we could call something. So that we fail early... instead of only after the redirect.
johan
On 8/12/06, Stefan Arentz <
[EMAIL PROTECTED]> wrote:
On 8/12/06, Johan Compagner < [EMAIL PROTECTED]> wrote:
> public final boolean isInstantiationAuthorized(final Class
> componentClass)
> {
> if (instanceOf(componentClass, MyPagePage.class))
> {
> Map params =
> RequestCycle.get().getRequest().getRequestParameters().getParameters();
> if(params.get("mykey").equals("cantbethis")) return false;
> }
> return true;
> }
>
> The only thing is that this may not work for mount urls. Because i think
> that getParameters() don't return encoded params like /param1/value
Please note that I am not pleading for doing authorization on pages
based on page parameters.
I am looking for a simple uniform wicket-provided way to protect pages
that have page parameters. Specifically for two use-cases:
setResponsePage(MyProtectedPage.class, parameters);
and
new BookmarkablePageLink("fooLink", MyProtectedPage.class, parameters);
Right now support for that is non existent or only possible with hacks
as workarounds.
S.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-develop mailing list
Wicket-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Wicket-develop mailing list Wicket-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-develop