Results 1 to 2 of 2

Thread: class xxxController extends xxxController doesn't work

  1. #1
    Join Date
    Mar 2012
    Location
    Vienna, Austria
    Posts
    14

    Question class xxxController extends xxxController doesn't work

    hi,

    i tried to modify my BookmarkController to subclass the SecureController:

    Code:
    package bookmarks
    import org.springframework.dao.DataIntegrityViolationException
    class BookmarkController extends SecureController{
    
        static allowedMethods = [save: "POST", update: "POST", delete: "POST"]
    
        def index() {
    
            redirect(action: 'list', params: params)
    
        }
    def list() {} def create(){} list(){} ....
    }
    when i run the server, the and click on the bookmarkcontroller, the server says:
    Message
    Cannot issue a redirect(..) here. A previous call to redirect(..) has already redirected the response.

    Around line 10 of grails-app\controllers\bookmarks\BookmarkController.groov y (line 10 is the line which i made bold)

    So whats wrong now? the weird thing is, when i run it without extends SecureController it works.

    for the sake of completeness the SecureController. (maybe something wrong here?!


    Code:
    package bookmarks
    
    abstract class SecureController {
    
        def beforeInterceptor = [
                    action: this.&auth,
                    except:['handleLogin','login', 'handleRegister', 'register']
                    ]
           
            private auth() {
                    if(!session.user){
                            redirect(controller:'user', action:'login')
                            }
                    }
    }
    regards,
    manuel

  2. #2
    Join Date
    Mar 2012
    Posts
    11

    Default

    Maybe you downloaded the wrong file?

Posting Permissions

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