Interface CookieConfigurer

All Known Implementing Classes:
DefaultCookieConfigurerImpl
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface CookieConfigurer

CookieUtils에 사용될 쿠키 설정을 위한 인터페이스

주의) 유연한 쿠키 사용을 위해 쿠키의 name, value, maxAge 설정은 CookieRequest 사용을 권고함.

기본적으로는 DefaultCookieConfigurerImpl이 이 인터페이스를 구현하고 있음. 해당 구현체는 개발용으로 쿠키 설정이 되어 있음. 만약 쿠키 설정 커스텀을 하고자 한다면

  1. CookieConfigurer를 implements하며,
  2. 해당 구현체에 @Primary@Component어노테이션을 부여한다.

쿠키 설정 커스텀 예시)


 @Primary
 @Component
 public class MyCookieConfigurer implements CookieConfigurer {

     @Override
     public void configureCookie(Cookie cookie) {
         cookie.setHttpOnly(true);
         cookie.setPath("/");
         cookie.setSecure(True);
     }
 }
 
 
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    configureCookie(jakarta.servlet.http.Cookie cookie)
    쿠키 설정 콜백 메서드.
  • Method Details

    • configureCookie

      void configureCookie(jakarta.servlet.http.Cookie cookie)
      쿠키 설정 콜백 메서드.
      Parameters:
      cookie - CookieUtils 내부 메서드에서 사용될 설정 대상 쿠키