Splash › Forums › PrettyFaces Users › Pretty config – from DB
This topic contains 5 replies, has 2 voices, and was last updated by s33d 6 years, 11 months ago.
is it possible to read pretty configuration form database ?
We want to allow users to create new link entries directly from portal (for example: adding element in menu). We need those menu elements to be added as pretty links.
Did it something like this:
PrettyConfigBuilder builder = new PrettyConfigBuilder();
UrlMapping mapping = new UrlMapping();
// CREATE MAPPING
PrettyConfig build = builder.build();
ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
@s33d: As of version 3.1.1-SNAPSHOT (which is available, but not final yet) you can now register custom ConfigurationProviders ( See snapshot reference guide: http://ocpsoft.com/docs/prettyfaces/snapshot/en-US/html/Extensions.html#ConfigurationProvider )
This will allow you to plug in to the boot-up configuration step in PrettyFaces. Does this address your needs?
It’s very close to what I am looking for. I need to rebuild mappings WITHOUT restarting application.
I have invoked my code from action and… it worked Mappings were added and links were properly shown.
Ok. I’ll keep this need in mind and see if we can make this easier to accomplish in future versions. If you could choose a new way to interact with prettyfaces APIs in order to accomplish this, what would it be?
The API is really clear. It was easy for me to find how to create new mapping and add it to config. The hardest thing was how to register new config so that PrettyFaces engine can use it.
I figured out that I need to use:
I was looking for methods like:
that could set servlet attribute for me.
You must be logged in to reply to this topic.
Comments are closed.
If you find our tools useful, please consider making a donation to help us stay online and building software!