code: public static void setCookieData(
          String pcType,
          String username,
          String oufqn,
          HttpServletRequest request,
          HttpServletResponse response) {
  
          // set the PC type cookie only if security dialog is enabled
          if (OpenCms.getLoginManager().isEnableSecurity() && CmsStringUtil.isNotEmpty(pcType)) {
              Cookie pcTypeCookie = getCookie(request, COOKIE_PCTYPE);
              pcTypeCookie.setValue(pcType);
              setCookie(pcTypeCookie, false, request, response);
          }
  
          // only store user name and OU cookies on private PC types
          if (PCTYPE_PRIVATE.equals(pcType)) {
              // set the user name cookie
              Cookie userNameCookie = getCookie(request, COOKIE_USERNAME);
              userNameCookie.setValue(username);
              setCookie(userNameCookie, false, request, response);
  
              // set the organizational unit cookie
              Cookie ouFqnCookie = getCookie(request, COOKIE_OUFQN);
              ouFqnCookie.setValue(oufqn);
              setCookie(ouFqnCookie, false, request, response);
          } else if (OpenCms.getLoginManager().isEnableSecurity() && PCTYPE_PUBLIC.equals(pcType)) {
              // delete user name and organizational unit cookies
              Cookie userNameCookie = getCookie(request, COOKIE_USERNAME);
              setCookie(userNameCookie, true, request, response);
              Cookie ouFqnCookie = getCookie(request, COOKIE_OUFQN);
              setCookie(ouFqnCookie, true, request, response);
  
          }
      }
docs: Sets the cookie data.<p>
  
  @param pcType the pctype value
  @param username the username value
  @param oufqn the oufqn value
  
  @param request the current request
  @param response the current response