My implementation of ConfigurationPostProcessor is not called

Splash Forums PrettyFaces Users My implementation of ConfigurationPostProcessor is not called

This topic contains 7 replies, has 3 voices, and was last updated by  balteo 6 years, 6 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #17823

    balteo
    Participant

    Hello,

    I followed instructions from http://ocpsoft.com/docs/prettyfaces/snapshot/en-US/html/Extensions.html#ConfigurationPostProcessor and yet I noticed that my processConfiguration method is not called.

    Can anyone please help?

    Regards,

    Julien.

    #20425

    Please make sure that you have added a file called:

    /WEB-INF/classes/META-INF/services/com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor

    It must contain a single line containing the full name of your implementation class.

    #20426

    balteo
    Participant

    Christian,

    I changed from “META-INF/services/com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor

    ” to “/WEB-INF/classes/META-INF/services/com.ocpsoft.pretty.faces.spi.ConfigurationPostProcessor”

    and yet it still does not work…

    J.

    #20427

    Do you use the most recent version of 3.1.1-SNAPSHOT (prettyfaces-jsf2-3.1.1-20101111.153645-50.jar) from the repository?

    #20428

    balteo
    Participant

    Christian,

    It seems to work fine now: the “processConfiguration” method is called.

    My only problem is that I don’t know how to instanciate the UrlAction properly. See my code:

    @Override

    public PrettyConfig processConfiguration(ServletContext sc, PrettyConfig pc) {

    log.debug(“processConfiguration”);

    UrlAction rootAction = new UrlAction(“???”);

    UrlMapping biographieMapping = (UrlMapping) pc.getMappingById(“biographieAction”);

    biographieMapping.addAction(rootAction);

    return pc;

    }

    Can you help?

    Here is the URLAction I am interested in:

    @URLAction

    public void changeLocale() {

    log.debug(“changeLocale”);

    UIViewRoot view = FacesContext.getCurrentInstance().getViewRoot();//todo locale en dur içi

    if (“fr”.equals(this.language)) {

    view.setLocale(Locale.FRENCH);

    } else if (“en”.equals(this.language)) {

    view.setLocale(Locale.ENGLISH);

    }

    getSuggestionOeuvreView().setSculptureSuggeree(getSuggestionOeuvreView().suggererSculpture());//refactor

    }

    Julien.

    #20429

    UrlAction("bean.actionMethod") is the signature you probably want to use. This uses an EL method-expression to reference any bean method.

    Then add the action to the mapping like you have done before.

    UrlAction("bean.changeLocale") <- but obviously you need to use the actual name of your bean :)

    #20430

    Lincoln is right! That should be the way to go. Although I think you have to use a full EL expression in the constructor. Something like:

    new UrlAction("#{bean.actionMethod}")

    But I might be wrong. Just try both variants! :-)

    #20431

    balteo
    Participant

    Success!!

    Thanks a lot to both of you!!

    FYI, I used this variant: new UrlAction(“#{bean.actionMethod}”)

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

You must be logged in to reply to this topic.

Comments are closed.