[ https://issues.apache.org/jira/browse/WICKET-5454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13853284#comment-13853284 ]
Carl-Eric Menzel commented on WICKET-5454: ------------------------------------------ This is an instantiation check so you can't pass an instance - it's not available yet! [\[1\]|#1] This is IIRC done in Component's constructor. So I don't see how one could change this without really breaking the semantics of the instantiation permission. I would solve your case by either using marker interfaces which you can check on the class, or skipping the instantiation check and doing a render check instead - there you get the instance. {anchor:1}1: Technically, you could pass along a this reference from the constructor. That's not at all safe though, since nothing is initialized yet. > IAuthorizationStrategy#isInstantiationAuthorized(Class<T> componentClass) > should be passed the instance, not only it's class > ---------------------------------------------------------------------------------------------------------------------------- > > Key: WICKET-5454 > URL: https://issues.apache.org/jira/browse/WICKET-5454 > Project: Wicket > Issue Type: Improvement > Components: wicket > Affects Versions: 6.12.0 > Reporter: Tom Götz > Priority: Minor > > It would be easier to decide if instantiation is authorized if one could > access some properties of the component being constructed. Usecase: we > restrict access to certain pages with an own IAuthorizationStrategy > implementation, but we'd like error pages to be instantiated. Now, this is > not easy to decide if you are only passed the page's class. A call to > isErrorPage() would be more elegant in that situation. > Is there a reason why the class, but not the instance is passed to > IAuthorizationStrategy#isInstantiationAuthorized (see constructor of > Application: > https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/Application.java#L261)? -- This message was sent by Atlassian JIRA (v6.1.4#6159)