Pretty config – from DB

Splash Forums PrettyFaces Users Pretty config – from DB

Tagged: 

This topic contains 5 replies, has 2 voices, and was last updated by  s33d 6 years, 11 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #17811

    s33d
    Participant

    Hello,

    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.

    Regards

    #20382

    s33d
    Participant

    Did it something like this:

    PrettyConfigBuilder builder = new PrettyConfigBuilder();

    UrlMapping mapping = new UrlMapping();

    // CREATE MAPPING

    builder.addMapping(mapping);

    PrettyConfig build = builder.build();

    ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();

    servletContext.setAttribute(PrettyContext.CONFIG_FILES_ATTR, build);

    #20383

    @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?

    #20384

    s33d
    Participant

    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.

    Thanks

    #20385

    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?

    Thanks,

    Lincoln

    #20386

    s33d
    Participant

    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:

    servletContext.setAttribute(PrettyContext.CONFIG_FILES_ATTR, prettyConfig);

    I was looking for methods like:

    PrettyContext.addUrlMappingToCurrentConfig(UrlMapping);

    PrettyContext.removeUrlMappingFromCurrentConfig(UrlMapping);

    Or just:

    PrettyContext.replaceCurrentPrettyConfig(prettyConfig);

    that could set servlet attribute for me.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Comments are closed.