Skip to content

Commit

Permalink
update url
Browse files Browse the repository at this point in the history
  • Loading branch information
hfbin committed Aug 27, 2018
1 parent 885a0ba commit 28ca1dc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public String detail2(Model model,
@RequestMapping("/detail/{goodsId}")
@ResponseBody
public Result<GoodsDetailVo> detail(Model model,
@PathVariable("goodsId")long goodsId , HttpServletRequest request , HttpServletResponse response ) {
@PathVariable("goodsId")long goodsId , HttpServletRequest request ) {
String loginToken = CookieUtil.readLoginToken(request);
User user = redisService.get(UserKey.getByName, loginToken, User.class);

Expand Down
8 changes: 3 additions & 5 deletions src/main/java/cn/hfbin/seckill/util/CookieUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import javax.servlet.http.HttpServletResponse;

/**
* My Blog : www.hfbin.cn
* github: https://github.com/hfbin
* Created by: HuangFuBin
* Date: 2018/5/5
Expand All @@ -25,9 +24,9 @@ public static String readLoginToken(HttpServletRequest request){
Cookie[] cks = request.getCookies();
if(cks != null){
for(Cookie ck : cks){
//log.info("read cookieName:{},cookieValue:{}",ck.getName(),ck.getValue());
log.info("read cookieName:{},cookieValue:{}",ck.getName(),ck.getValue());
if(StringUtils.equals(ck.getName(),COOKIE_NAME)){
// log.info("return cookieName:{},cookieValue:{}",ck.getName(),ck.getValue());
log.info("return cookieName:{},cookieValue:{}",ck.getName(),ck.getValue());
return ck.getValue();
}
}
Expand All @@ -50,11 +49,10 @@ public static void writeLoginToken(HttpServletResponse response, String token){
//单位是秒。
//如果这个maxage不设置的话,cookie就不会写入硬盘,而是写在内存。只在当前页面有效。
ck.setMaxAge(60 * 60 * 24 * 365);//如果是-1,代表永久
// log.info("write cookieName:{},cookieValue:{}",ck.getName(),ck.getValue());
log.info("write cookieName:{},cookieValue:{}",ck.getName(),ck.getValue());
response.addCookie(ck);
}


public static void delLoginToken(HttpServletRequest request, HttpServletResponse response){
Cookie[] cks = request.getCookies();
if(cks != null){
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/hfbin/seckill/util/UserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static void createUser(int count) throws Exception{
// conn.close();
// System.out.println("insert to db");
//登录,生成token
String urlString = "http://localhost:8080/user/login";
String urlString = "http://localhost:8080/page/login";
File file = new File("D:/tokens.txt");
if(file.exists()) {
file.delete();
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server.port=8888
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/seckill?useUnicode=true&characterEncoding=UTF-8&useSSL=false
spring.datasource.username=root
spring.datasource.password=***
spring.datasource.password=****
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
# 数据源其他配置
#spring.datasource.initialSize= 5
Expand Down Expand Up @@ -66,10 +66,10 @@ spring.resources.chain.html-application-cache=true
spring.resources.static-locations=classpath:/static/

#rabbitmq
spring.rabbitmq.host=168.***
spring.rabbitmq.host=****
spring.rabbitmq.port=5672
spring.rabbitmq.username=***
spring.rabbitmq.password=***
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
spring.rabbitmq.virtual-host=/
spring.rabbitmq.listener.simple.concurrency= 10
spring.rabbitmq.listener.simple.max-concurrency= 10
Expand Down

0 comments on commit 28ca1dc

Please sign in to comment.