Re: add new mapping during runtime

Splash Forums PrettyFaces Users add new mapping during runtime Re: add new mapping during runtime

#22692

dev123
Participant

Thanks for the quick response :).

I`m using PrettyFaces in Version 3.3.3 for JSF2. I want to add a new link to the current mapping. In the method I want to create a new UrlMapping like this:

UrlMapping urlMapping = new UrlMapping();
urlMapping.setId("my_unique_id");
urlMapping.setViewId("/MyPage");
urlMapping.setPattern("/myPage.jsf");

and add this mapping to the current configuration like this:

PrettyContext.getCurrentInstance().getConfig().getMappings().add(urlMapping);

now this exception occurs:

Caused by: java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableCollection.add(Collections.java:1018)