Get cookie value in java

后端 未结 6 1847
悲&欢浪女
悲&欢浪女 2020-12-24 15:00

I\'ve initialized cooke like this in my JSP,

String timeStamp = new SimpleDateFormat(\"dd:MM:yyyy_HH:mm:ss:SSS\").format(Calendar.getInstance().getTime());
t         


        
6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-24 15:18

    In kotlin it will be much shorter:

    fun HttpServletRequest.getCookie( name: String) = cookies.firstOrNull { it.name == name }
    
    

提交回复
热议问题