Actually, I'm not quite sure how that method is supposed to work. To authenticate, you need credentials, and there appears that there's an assumption that the ServletResponse object contains those credentials somewhere.
Instead of using this method, try the HttpServletRequest.login() method, instead.
I am assuming that your Glassfish server is a version advanced enough to support Servlet 3.0, since if it isn't, none of the above will work.
As a practical exercise - and to support older servlet implementations - I recommend NOT doing an internal login after registration, but rather to redirect to a secured URL, which will trigger a login. Remember, the actual login form has no URL, so you need to set up a user page, which can be a simple "welcome new user" page.
The justification for doing things that way is that it tests whether the user's credentials are what he/she thinks they are, and does a memory reinforcement on them.
Customer surveys are for companies who didn't pay proper attention to begin with.
subject: How to authenticate user after registration?