From ba618ceba0d3623395d222556009b0ec65310c1a Mon Sep 17 00:00:00 2001 From: Redkale Date: Tue, 28 Jun 2022 12:08:03 +0800 Subject: [PATCH] --- .../org/redkale/net/http/HttpRequest.java | 26 +++++++++---------- .../org/redkale/net/http/HttpResponse.java | 6 ++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/redkale/net/http/HttpRequest.java b/src/main/java/org/redkale/net/http/HttpRequest.java index 68b3016ce..824aafbd2 100644 --- a/src/main/java/org/redkale/net/http/HttpRequest.java +++ b/src/main/java/org/redkale/net/http/HttpRequest.java @@ -118,7 +118,7 @@ public class HttpRequest extends Request { protected byte[] queryBytes; - protected String newsessionid; + protected String newSessionid; protected final Map params = new HashMap<>(); @@ -789,7 +789,7 @@ public class HttpRequest extends Request { this.respConvertType = null; this.headers.clear(); //其他 - this.newsessionid = null; + this.newSessionid = null; this.method = null; this.getmethod = false; this.protocol = null; @@ -1278,16 +1278,16 @@ public class HttpRequest extends Request { /** * 获取sessionid * - * @param create 无sessionid是否自动创建 + * @param autoCreate 无sessionid是否自动创建 * * @return sessionid */ @ConvertDisabled - public String getSessionid(boolean create) { + public String getSessionid(boolean autoCreate) { String sessionid = getCookie(SESSIONID_NAME, null); - if (create && (sessionid == null || sessionid.isEmpty())) { + if (autoCreate && (sessionid == null || sessionid.isEmpty())) { sessionid = context.createSessionid(); - this.newsessionid = sessionid; + this.newSessionid = sessionid; } return sessionid; } @@ -1298,27 +1298,27 @@ public class HttpRequest extends Request { * @return 新的sessionid值 */ public String changeSessionid() { - this.newsessionid = context.createSessionid(); - return newsessionid; + this.newSessionid = context.createSessionid(); + return newSessionid; } /** * 指定值更新sessionid * - * @param newsessionid 新sessionid值 + * @param newSessionid 新sessionid值 * * @return 新的sessionid值 */ - public String changeSessionid(String newsessionid) { - this.newsessionid = newsessionid == null ? context.createSessionid() : newsessionid.trim(); - return newsessionid; + public String changeSessionid(String newSessionid) { + this.newSessionid = newSessionid == null ? context.createSessionid() : newSessionid.trim(); + return newSessionid; } /** * 使sessionid失效 */ public void invalidateSession() { - this.newsessionid = ""; //为空表示删除sessionid + this.newSessionid = ""; //为空表示删除sessionid } /** diff --git a/src/main/java/org/redkale/net/http/HttpResponse.java b/src/main/java/org/redkale/net/http/HttpResponse.java index a1c527090..0d41c356e 100644 --- a/src/main/java/org/redkale/net/http/HttpResponse.java +++ b/src/main/java/org/redkale/net/http/HttpResponse.java @@ -1084,7 +1084,7 @@ public class HttpResponse extends Response { for (Entry en : this.header.getStringEntrys()) { headerArray.put((en.name + ": " + en.getValue() + "\r\n").getBytes()); } - if (request.newsessionid != null) { + if (request.newSessionid != null) { String domain = defaultCookie == null ? null : defaultCookie.getDomain(); if (domain == null || domain.isEmpty()) { domain = ""; @@ -1093,10 +1093,10 @@ public class HttpResponse extends Response { } String path = defaultCookie == null ? null : defaultCookie.getPath(); if (path == null || path.isEmpty()) path = "/"; - if (request.newsessionid.isEmpty()) { + if (request.newSessionid.isEmpty()) { headerArray.put(("Set-Cookie: " + HttpRequest.SESSIONID_NAME + "=; " + domain + "Path=/; Max-Age=0; HttpOnly\r\n").getBytes()); } else { - headerArray.put(("Set-Cookie: " + HttpRequest.SESSIONID_NAME + "=" + request.newsessionid + "; " + domain + "Path=/; HttpOnly\r\n").getBytes()); + headerArray.put(("Set-Cookie: " + HttpRequest.SESSIONID_NAME + "=" + request.newSessionid + "; " + domain + "Path=/; HttpOnly\r\n").getBytes()); } } if (this.cookies != null) {