Results 1 to 6 of 6

Thread: Roo 1.1.1 keeps regenerating pushed-in controller methods

  1. #1
    Join Date
    Nov 2010
    Posts
    18

    Question Roo 1.1.1 keeps regenerating pushed-in controller methods

    In my Roo application, I need to add an additional parameter to the list method, so I pushed it in to my controller class:

    Code:
    @RooWebScaffold(path = "participants", formBackingObject = MyDomainClass.class)
    @RequestMapping("/foo/{myPath}/")
    class MyController {
    
        @RequestMapping(value="/", method = RequestMethod.GET, headers="Accept=text/html")
        public String list(
            @PathVariable String myPath,
            @RequestParam(value = "page", required = false) Integer page,
            @RequestParam(value = "size", required = false) Integer size, Model model) {
        ...
        }
    
    }
    Unfortunately, since version 1.1.1, Roo keeps re-generating the original list() method in MyController_Roo_Controller.aj, leading to a 500-errorpage with the following error message:

    Code:
    Ambiguous handler methods mapped for HTTP path '/foo/somepath': {public java.lang.String MyController.list(java.lang.Integer,java.lang.Integer,org.springframework.ui.Model), public java.lang.String MyController.list(java.lang.String,java.lang.Integer,java.lang.Integer,org.springframework.ui.Model)}.
    Is there some way to prevent Roo from regenerating the method? This has only started happening since I upgraded to version 1.1.1.

    Thanks,
    --Chris

  2. #2
    Join Date
    May 2008
    Location
    Silicon Valley, CA
    Posts
    139

    Default

    maybe remove mypath form the Controller and apply to the method:
    Code:
    @RequestMapping("/foo")
    class MyController {
    
    @RequestMapping(value="/{myPath}", method = RequestMethod.GET, headers="Accept=text/html")
    Last edited by Jack Punt; Jan 12th, 2011 at 01:20 PM.

  3. #3
    Join Date
    Nov 2010
    Posts
    18

    Default

    Jack, thanks for the response. My actual controller binds to a sub-path of the request mapping

    Code:
    @RequestMapping("/foo/{myPath}/bar")
    class MyController
    and there are other Controllers that are even more nested (e.g. /foo/{myPath}/bar/{myBar}/baz). If I changed all their paths to /foo, the Roo-generated methods now would all be ambiguous.

    Also, the method would still have an extra parameter (which, I suspect, is the reason why Roo regenerates the scaffolded method(s)).
    Last edited by ccmtaylor; Jan 13th, 2011 at 04:35 AM.

  4. #4
    Join Date
    May 2008
    Location
    Silicon Valley, CA
    Posts
    139

    Default

    Indeed, the generation is tied to the signature.
    So push-in the signature that you want to stop generating,
    and bind it to a path that will not conflict.

  5. #5
    Join Date
    Oct 2010
    Location
    Almere, The Netherlands
    Posts
    32

    Default Changed behavior 1.1.0 vs. 1.1.1

    I have the same problem. Almost all of my controllers with pushed-in methods are broken because ROO re-generated methods in the roo_controller.aj files since the update from 1.1.0 to 1.1.1. In this an intended change in behavior in 1.1.1 (issue #?) or should we consider it a bug?

  6. #6
    Join Date
    Oct 2010
    Location
    Almere, The Netherlands
    Posts
    32

    Default

    Quote Originally Posted by Jack Punt View Post
    Indeed, the generation is tied to the signature.
    So push-in the signature that you want to stop generating,
    and bind it to a path that will not conflict.
    Seems like pushing in and removing any request mapping is enough.

    E.g. just:
    PHP Code:
    public String createForm(Model model) {return null;} 
    does the trick but it is not nice having these dummy methods in the controller.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •