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的效果

相关推荐
2020-12-14
android进度条
为者败之,执者失之。——《道德经》 原生安卓实现的进度条 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566package com.example.uidemo.activity;import androidx.appcompat.app.AppCompatActivity;import android.os.Bundle;import android.view.View;import android.widget.ProgressBar;import android.widget.SeekBar;import android.widget.TextView;import com.example.uidemo.R;import java.math.BigDecimal;import java.util.Locale;public class ProgressBarActivity...
2020-08-31
驼峰下划线互转工具类
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253package com.ruben.utils;import java.util.regex.Matcher;import java.util.regex.Pattern;/** * @ClassName: CamelCaseUtils * @Description: * @Date: 2020/8/31 19:13 * * * @author: achao<achao1441470436 @ gmail.com> * @version: 1.0 * @since: JDK 1.8 */public class CamelCaseUtils { private static Pattern underlinePattern = Pattern.compile("_(\\w)"); private static Pattern upper...
2024-03-19
liteflow快速开始
人类永远会选择他们理解的,摒弃不理解的。这个世界唯一剩下的动物,就是他们已经驯服的那些,匍匐在他们的脚边,或者那些非常警觉,一察觉到他们靠近就逃离的动物,没有介于二者之间的。——《西部世界》 今天上手用了下liteflow,感觉非常不错 首先引入 12345<dependency> <groupId>com.yomahub</groupId> <artifactId>liteflow-spring-boot-starter</artifactId> <version>2.11.4.2</version></dependency> 编写A组件 1234567891011121314151617181920212223import com.yomahub.liteflow.annotation.LiteflowComponent;import com.yomahub.liteflow.core.NodeComponent;import com.yomahub.lit...
2024-10-22
protocol示例
没有意义的事物是最美丽的。——《新名字的故事》 github: https://github.com/protocolbuffers/protobuf 官方文档: https://protobuf.dev/ Protocol Buffers(又名 protobuf)是 Google 的语言中立、平台中立、可扩展的机制,用于序列化结构化数据。您可以在protobuf 的文档中了解更多信息。 使用 Protocol Buffers 在前后端传输数据的示例。后端使用 Spring Boot,前端使用 Parcel 和 JavaScript,前后端通过 .proto 文件定义的 Person 类进行数据传输。 后端 (Java - Spring Boot) pom.xml (包含 Spring Boot 和 Protocol Buffers 的依赖): 12345678910111213141516171819202122232425262728293031323334353637383940414243444546<project xmlns="http://mav...
2023-06-13
VIN解析
爱情易失不易得。——佚名 分享一个VIN解析的代码 https://gitee.com/dromara/hutool/pulls/1005 使用方式 1234567891011121314151617181920212223242526272829303132333435363738394041package org.dromara.hutool.core.data;import org.dromara.hutool.core.data.vin.Vin;import org.junit.jupiter.api.Assertions;import org.junit.jupiter.api.Test;import java.time.Year;/** * @author VampireAchao * @since 2023/5/31 14:43 */public class VinTest { @Test public void parseVinTest() { String vinStr = "HE9XR1C48PS083871"; ...
2023-12-13
boot项目添加运行参数的maven插件
不存在十全十美的文章,如同不存在彻头彻尾的绝望。——村上春树 之前说了 单元测试添加运行参数的maven插件 难道对于非单元测试就只能手动写命令了吗?当然不是!我们只需要使用: 123456789101112131415161718192021222324252627282930313233<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> <config...
