protected CookieSetting getCredentialsCookie ( final Request request , final Response response ) { CookieSetting credentialsCookie = response . getCookieSettings ( ) . getFirst ( this . getCookieName ( ) ) ; if ( credentialsCookie == null ) { credentialsCookie = new CookieSetting ( this . getCookieName ( ) , null ) ; credentialsCookie . setAccessRestricted ( true ) ; // authCookie.setVersion(1); if ( request . getRootRef ( ) != null ) { final String p = request . getRootRef ( ) . getPath ( ) ; credentialsCookie . setPath ( p == null ? "/" : p ) ; } else { // authCookie.setPath("/"); } response . getCookieSettings ( ) . add ( credentialsCookie ) ; } return credentialsCookie ; }
Returns the credentials cookie setting . It first try to find an existing cookie . If necessary it creates a new one .