forked from JoyChou93/java-sec-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
36 lines (28 loc) · 1.07 KB
/
Test.java
File metadata and controls
36 lines (28 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.joychou.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("/test")
public class Test {
@RequestMapping(value = "/")
public String Index(HttpServletResponse response, String empId) {
System.out.println(empId);
Cookie cookie = new Cookie("XSRF-TOKEN", "123");
cookie.setDomain("taobao.com");
cookie.setMaxAge(-1); // forever time
response.addCookie(cookie);
return "success";
}
@RequestMapping(value = "/aa")
public void test(HttpServletResponse response, String empId) {
System.out.println(empId);
Cookie cookie = new Cookie("XSRF-TOKEN", "123");
cookie.setDomain("taobao.com");
cookie.setMaxAge(-1); // forever time
response.addCookie(cookie);
}
}