You are correct, in version 2.3.0-RC1 adding an AccessController to
every menu item fixed the issue. I preferred the old way where the
access controller wasn't needed, but that's just my own preference,
and i probably just don't see the bigger picture.
You might want to update the javadocs on Menu.java to something like this:
...
private Menu createMenu(String label, String path) {
Menu menu = new Menu();
menu.setLabel(label);
menu.setPath(path);
menu.setTitle(label);
menu.setAccessController(new MyAccessController());
return menu;
}
class MyAccessController implements AccessController {
@Override
public boolean hasAccess(HttpServletRequest request, String
resource) {
return true;
}
}
...
Thanks again for the help.
On Thu, Feb 17, 2011 at 8:16 AM, Bob Schellink <[email protected]> wrote:
> Hi Curt,
>
> Transient only comes into play if the menu is serialized ie you use stateful
> pages.
>
> Also you have to set the accessController for each menu item, but I don't
> think this has changed
> between releases. How are you rendering the menus?
>
> Kind regards
>
> Bob
>
> On 2011/02/17 05:28 AM, Curt Larson wrote:
>> Hi,
>>
>> I just upgraded to click-2.3.0-RC1 from 2.2.0 and I am having an issue
>> with the org.apache.click.extras.control.Menu class. For some reason
>> getAccessController() on line 876 is always null even if i explicitly
>> set an AccessController after creating my menu like this:
>>
>> Menu rootMenu.setAccessController(new MyAccessControler());
>>
>> I even tried overriding the getAccessController() method to always
>> return a new object, but that failed as well.
>>
>> This always worked in version 2.2.0.
>>
>> Here is a little bit about my setup:
>>
>> 1) im not using menu.xml, im building my menu programatically
>> 2) i dont have a macro.vm anywhere in my project
>> 3) im using guice (no spring, no acegi)
>> 4) im deploying to jetty and tomcat (no container based security)
>>
>> Does anyone have any ideas about why this is happening? I suspect it
>> has something to do with the fact that the AccessController in
>> Menu.java is transient.
>>
>> Any thoughts would be appreciated.
>>
>> Thanks,
>> Curt
>>
>
>