set-cookie
发表于|更新于
|浏览量:
我的肩上是风,风上是闪烁的星群。——北岛
我们可以在响应头中添加set-cookie的响应头来操作cookie
例如我此处:
1 | @Resource |
就设置了一个名为cookie-name,值为cookie-value,路径为/,仅限http请求,过期时间为5秒的cookie
完整的参数可以看MDN文档:
https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers/Set-Cookie
此处cookie的效果

相关推荐
2023-12-19
state-machine持久化踩坑
植物借栽培而生育,人类借教育而成人。——罗素 今天使用spring-state-machine踩坑了,这里配了持久化,然后在事件里更改了额外数据 12gameInfo = stateMachine.getExtendedState().get(WordChainConst.GAME_INFO, GameInfo.class);gameInfo.setXxx(xxx); 结果在interceptor或者guard等其他地方使用的时候,却获取不到正确的值 原来在修改值后,还需要持久化保存一下。。。 1public class RedisSmPersister extends AbstractStateMachinePersister<StateEnum, EventEnum, String> 1redisSmPersister.persist(sm, sm.getId());
2021-09-14
并行流线程数获取
我那时喜欢的是黄昏、荒郊和忧伤,而如今则向往清晨、市区和宁静。——博尔赫斯 这里用一个Set去接收并行流产生的线程id,对于上方的reduce函数我之前一篇博客已经讲过了,今天就来论证一下,到底并行流的线程数是否和JVM虚拟机可用的处理器数一致: 代码如下: 12345678910List<Integer> list = Stream.generate(() -> 1).limit(100).collect(Collectors.toList());System.out.println(list);int sum = list.parallelStream().reduce(1, Integer::sum, (a, b) -> { System.out.println(Thread.currentThread().getId() + " " + Thread.currentThread().getName() + " parallelStream执行sum时上次结果:[" + a + "...
2023-09-01
apache-streamparkpr和代码规范指南
世界上本来就有许多格格不入的事物为了共存而不得不相互接受。——博尔赫斯《沙之书》 最近在为streampark起草代码规范指南,对应的pr如下 https://github.com/apache/incubator-streampark-website/pull/226 对应的内容: 12345678910111213141516<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); yo...
2022-09-04
maven版本号插件
莫等闲,白了少年头,空悲切——岳飞 我们maven项目除了使用这种方式修改版本号,还有一种统一管理版本号的方式: 项目地址:https://github.com/mojohaus/flatten-maven-plugin 官方文档:http://www.mojohaus.org/flatten-maven-plugin/ 引入: 12345678910111213141516171819<build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>flatten-maven-plugin</artifactId> <!--<version>INSERT LATEST VERSION HERE</version>--> <executions> <execution> ...
2023-08-19
Delimiter
青春如初春,如朝日,如百卉之萌动,如利刃之新发于硎,人生最宝贵之时期也。青年之于社会,犹新鲜活泼细胞之在身。——陈独秀 分享一下:org.springframework.boot.convert.Delimiter的用法 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950/* * Copyright 2012-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-...
2022-09-28
springboot动态配置
耐心和持久胜过激烈和狂热——拉封丹 分享一个springboot动态配置框架:https://github.com/Code2Life/spring-boot-dynamic-config 在一些场景下可以用到热更新配置 轻量方便,简单好用 GAV 12345<dependency> <groupId>top.code2life</groupId> <artifactId>spring-boot-dynamic-config</artifactId> <version>1.0.9</version></dependency> 添加注解:@DynamicConfig 以及@Value 1234567891011121314151617181920212223242526272829303132333435import lombok.Data;import org.springframework.beans.factory.annotation.Value;impor...

阿超
我的名字叫阿超 年龄25岁 家在北京市 职业是软件开发 每天最晚也会在八点前回家 不抽烟 酒浅尝辄止 晚上十二点上床 保证睡足八个小时 睡前写一篇博客 再做二十分钟俯卧撑暖身 然后再睡觉 基本能熟睡到天亮 像婴儿一样不留下任何疲劳和压力 就这样迎来第二天的早晨 健康检查结果也显示我很正常 我想说明我是一个不论何时都追求内心平稳的人 不拘泥于胜负 不纠结于烦恼 不树立使我夜不能寐的敌人 这就是我在这社会的生活态度
Follow Me公告
This is my Blog