I am creating a custom authentication service in my spring mvc application:
@Service public class AuthenticationServiceImpl implements AuthenticationService
To add a new cookie, use HttpServletResponse.addCookie(Cookie). The Cookie is pretty much a key value pair taking a name and value as strings on construction.