Announcement Announcement Module
Collapse
No announcement yet.
Roo 1.1.1 keeps regenerating pushed-in controller methods Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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, 02:20 PM.

    Comment


    • #3
      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, 05:35 AM.

      Comment


      • #4
        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.

        Comment


        • #5
          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?

          Comment


          • #6
            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.

            Comment

            Working...
            X