Mapping with parent executes the wrong URLAction in 3.3.1-SNAPSHOT

Splash Forums PrettyFaces Users Mapping with parent executes the wrong URLAction in 3.3.1-SNAPSHOT

This topic contains 6 replies, has 2 voices, and was last updated by  Christian Kaltepoth 5 years, 8 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #18002

    Frank Caputo
    Participant

    Hi,

    we have a problem with mappings with URLAction having a parent with URLAction. Our Code-Snippet:

    @Named(“socialauth”)

    @SessionScoped

    @URLMappings(mappings = {

    @URLMapping(id = “signupSocial”, pattern = “/reg/#{socialauth.providerName}”, viewId = “/home.faces”),

    @URLMapping(id = “signupSocialVerify”, parentId = “signupSocial”, pattern = “/verify”, viewId = “/home.faces”)

    })

    public class SocialAuthBean implements Serializable {

    private String providerName;

    @URLAction(mappingId = “signupSocial”)

    public void login() throws Exception {

    }

    @URLAction(mappingId = “signupSocialVerify”)

    public void verify() throws Exception {

    }

    }

    If we navigate to /reg/facebook/verify login() is executed instead of verify(). This worked with 3.3.0.

    Ciao Frank

    #21197

    Hey Frank,

    sorry for the delayed response. Much work for me to do at the moment so I don’t have much time to check the forum. :-/

    We recently enhanced the parenting code in 3.3.1-SNAPSHOT. Up to 3.3.0 a child mapping inherited only the pattern and the path validators from its parent. Now we have enhanced the code so that URL actions and query parameters are also inherited! I think this step is reasonable because this is what people would expect from the parenting process.

    Thus it is comprehensible that the login method gets executed in your example. Does the verify method also get executed? That is what I would expect.

    I’m sorry that this change breaks your code. You can quickly fix this issue by removing the parentId attribute from your second mapping and just manually prefix the pattern with the one from the first mapping.

    Would that work with your code?

    Christian

    #21198

    Frank Caputo
    Participant

    Hi Christian,

    the verify method doesn’t get executed.

    I found it really intuitive to inherit only the mapping. I guess, this is also a problem for other prettyfaces users.

    Anyway. I will change my code.

    Ciao Frank

    #21199

    Thanks for you feedback.

    I guess we should add something like an “inheritActions” attribute somewhere. We will have to discuss which value should be the default for this attribute. I’m currently not sure.

    Thanks for bringing this problem up!

    Christian

    #21200

    Frank Caputo
    Participant

    False would be a cool default for me :-) Can you let the users vote?

    Ciao Frank

    #21201

    Hi Frank!

    A user voting would be a great idea! :)

    I’ll try to find some time in the next days to implement this new attribute. And I’ll start a vote on the forum! Thanks for the suggestion! We definitively want that the users like the way to configure PrettyFaces. So you (the users) should have a say in this decision! :)

    Christian

    #21202

    Hey Frank!

    I finally found some time to work on this issue. I added a new attribute named inheritable to the URL actions. The default value of this attribute is false which means, that child mappings won’t inherit the action. If you want an action to be inherited, simply set the attribute to true:

    @URLAction(mappingId = "signupSocial", inheritable=true)

    I didn’t start a voting on this because I think that false is really the better default value.

    Thanks

    Christian

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

You must be logged in to reply to this topic.

Comments are closed.