public class ImSession extends Object
该类用于需要使用会话状态控制的场景,作为数据存储的对象使用
Session state control object class
This class is used for scenarios that require session state control and is used as an object of data storage.
program: Sinlmao Commons Network Utils
description: 会话状态控制对象类
create: 2019-11-07 14:55
| 限定符和类型 | 字段和说明 |
|---|---|
protected boolean |
ExecCallbackNow |
| 构造器和说明 |
|---|
ImSession() |
| 限定符和类型 | 方法和说明 |
|---|---|
ImSession |
addCookie(com.alibaba.fastjson.JSONObject cookies)
添加Cookie,当数据已经存在,则不再添加
Add a Cookie, when the data already exists, it will not be added
|
ImSession |
addCookie(Map<String,String> cookies)
添加Cookie,当数据已经存在,则不再添加
Add a Cookie, when the data already exists, it will not be added
|
ImSession |
addCookie(String name,
String value)
添加Cookie,当数据已经存在,则不再添加
Add a Cookie, when the data already exists, it will not be added
|
ImSession |
addExtra(com.alibaba.fastjson.JSONObject extras)
添加Extra(额外/附加)数据,当数据已经存在,则不再添加
Add Extra (extra/additional) data, when the data already exists, it will not be added
|
ImSession |
addExtra(Map<String,Object> extras)
添加Extra(额外/附加)数据,当数据已经存在,则不再添加
Add Extra (extra/additional) data, when the data already exists, it will not be added
|
ImSession |
addExtra(String name,
Object value)
添加Extra(额外/附加)数据,当数据已经存在,则不再添加
Add Extra (extra/additional) data, when the data already exists, it will not be added
|
ImSession |
addHeader(com.alibaba.fastjson.JSONObject headers)
添加Header,当数据已经存在,则不再添加
Add a Header, when the data already exists, it will not be added
|
ImSession |
addHeader(Map<String,String> headers)
添加Header,当数据已经存在,则不再添加
Add a Header, when the data already exists, it will not be added
|
ImSession |
addHeader(String name,
String value)
添加Header,当数据已经存在,则不再添加
Add a Header, when the data already exists, it will not be added
|
int |
getAutoAuthenticationTryCount()
获取自动处理身份认证时最大次数
Get the maximum number of automatic processing of identity authentication
|
protected ImSessionCallback |
getCallback() |
String |
getCookieData(String name)
根据Cookie键获得对应值
Get the corresponding value according to the Cookie key
|
Set<String> |
getCookieNames()
获得所有Cookie键
Get all Cookie keys
|
protected Map<String,String> |
getCookies() |
int |
getCookieSize()
获得Cookie数量
Get the count of Cookies
|
Set<String> |
getExtraNames()
获得所有Extra(额外/附加)数据键
Get all Extra (extra/additional) data keys
|
int |
getExtraSize()
获得Extra(额外/附加)数据数量
Get the count of Extra (extra/additional) datas
|
Object |
getExtraValue(String name)
根据Extra(额外/附加)数据键获得对应值
Get the corresponding value according to the Extra (extra/additional) data key
|
Set<String> |
getHeaderNames()
获得所有Header键
Get all Header keys
|
protected Map<String,String> |
getHeaders() |
int |
getHeaderSize()
获得Header数量
Get the count of Headers
|
String |
getHeaderValue(String name)
根据Header键获得对应值
Get the corresponding value according to the Header key
|
boolean |
isAutoAuthentication()
获取是否需要自动处理身份认证
Get the need to automatically handle identity authentication
|
boolean |
isNeedAuthentication()
获取是否需要身份认证
Get whether authentication is required
|
ImSession |
setAutoAuthentication(boolean autoAuthentication)
设置是否需要自动处理身份认证
当设置该标记后,还需要设置NeedAuthentication和ImSessionCallback,否则该项不会生效
Set the need to automatically handle identity authentication
After setting this flag, you need to set NeedAuthentication and ImSessionCallback, otherwise the item will not take effect.
|
ImSession |
setAutoAuthenticationTryCount(int autoAuthenticationTryCount)
设置自动处理身份认证时最大次数(最小1次,最大5次)
当设置该值后,还需要设置NeedAuthentication、AutoAuthentication和ImSessionCallback,否则该项不会生效
Set the maximum number of automatic processing of identity authentication (minimum 1 time, maximum 5 times)
After setting this value, you also need to set NeedAuthentication, AutoAuthentication and ImSessionCallback, otherwise the item will not take effect.
|
void |
setCallback(ImSessionCallback callback)
设置ImSessionCallback的实现接口类
Set the implementation interface class of ImSessionCallback
|
ImSession |
setCookie(com.alibaba.fastjson.JSONObject cookies)
添加Cookie,当数据已经存在,则以最后设置的为准
Set the Cookie.
|
ImSession |
setCookie(Map<String,String> cookies)
添加Cookie,当数据已经存在,则以最后设置的为准
Set the Cookie.
|
ImSession |
setCookie(String name,
String value)
添加Cookie,当数据已经存在,则以最后设置的为准
Set the Cookie.
|
protected void |
setCookies(Map<String,String> cookies) |
ImSession |
setExtra(com.alibaba.fastjson.JSONObject extras)
设置Extra(额外/附加)数据,当数据已经存在,则以最后设置的为准
Set the Extra (extra/additional) data.
|
ImSession |
setExtra(Map<String,Object> extras)
设置Extra(额外/附加)数据,当数据已经存在,则以最后设置的为准
Set the Extra (extra/additional) data.
|
ImSession |
setExtra(String name,
Object value)
设置Extra(额外/附加)数据,当数据已经存在,则以最后设置的为准
Set the Extra (extra/additional) data.
|
ImSession |
setHeader(com.alibaba.fastjson.JSONObject headers)
设置Header,当数据已经存在,则以最后设置的为准
Set the Header.
|
ImSession |
setHeader(Map<String,String> headers)
设置Header,当数据已经存在,则以最后设置的为准
Set the Header.
|
ImSession |
setHeader(String name,
String value)
设置Header,当数据已经存在,则以最后设置的为准
Set the Header.
|
protected void |
setHeaders(Map<String,String> headers) |
ImSession |
setNeedAuthentication(boolean needAuthentication)
设置是否需要身份认证
当设置该标记后,还需要设置ImSessionCallback,否则该项不会生效
Set whether authentication is required
After setting this flag, you also need to set ImSessionCallback, otherwise the item will not take effect.
|
public ImSession setNeedAuthentication(boolean needAuthentication)
当设置该标记后,还需要设置ImSessionCallback,否则该项不会生效
Set whether authentication is required
After setting this flag, you also need to set ImSessionCallback, otherwise the item will not take effect.
needAuthentication - 是否需要身份认证 public boolean isNeedAuthentication()
Get whether authentication is required
public ImSession setAutoAuthentication(boolean autoAuthentication)
当设置该标记后,还需要设置NeedAuthentication和ImSessionCallback,否则该项不会生效
Set the need to automatically handle identity authentication
After setting this flag, you need to set NeedAuthentication and ImSessionCallback, otherwise the item will not take effect.
autoAuthentication - 是否需要自动处理身份认证 public boolean isAutoAuthentication()
Get the need to automatically handle identity authentication
public ImSession setAutoAuthenticationTryCount(int autoAuthenticationTryCount)
当设置该值后,还需要设置NeedAuthentication、AutoAuthentication和ImSessionCallback,否则该项不会生效
Set the maximum number of automatic processing of identity authentication (minimum 1 time, maximum 5 times)
After setting this value, you also need to set NeedAuthentication, AutoAuthentication and ImSessionCallback, otherwise the item will not take effect.
autoAuthenticationTryCount - 自动处理身份认证时最大次数 public int getAutoAuthenticationTryCount()
Get the maximum number of automatic processing of identity authentication
public void setCallback(ImSessionCallback callback)
Set the implementation interface class of ImSessionCallback
callback - ImSessionCallback的实现接口类 ImSessionCallbackpublic ImSession addHeader(String name, String value)
Add a Header, when the data already exists, it will not be added
name - Header键 value - Header值 public ImSession addHeader(Map<String,String> headers)
Add a Header, when the data already exists, it will not be added
headers - Map类型的Header数据 public ImSession addHeader(com.alibaba.fastjson.JSONObject headers)
Add a Header, when the data already exists, it will not be added
headers - JSONObject类型的Header数据 public ImSession setHeader(String name, String value)
Set the Header. When the data already exists, the last setting is subject to
name - Header键 value - Header值 public ImSession setHeader(com.alibaba.fastjson.JSONObject headers)
Set the Header. When the data already exists, the last setting is subject to
headers - JSONObject类型的Header数据 public ImSession setHeader(Map<String,String> headers)
Set the Header. When the data already exists, the last setting is subject to
headers - Map类型的Header数据 public ImSession addCookie(String name, String value)
Add a Cookie, when the data already exists, it will not be added
name - Cookie键 value - Cookie值 public ImSession addCookie(Map<String,String> cookies)
Add a Cookie, when the data already exists, it will not be added
cookies - Map类型的Cookie数据 public ImSession addCookie(com.alibaba.fastjson.JSONObject cookies)
Add a Cookie, when the data already exists, it will not be added
cookies - JSONObject类型的Cookie数据 public ImSession setCookie(String name, String value)
Set the Cookie. When the data already exists, the last setting is subject to
name - Cookie键 value - Cookie值 public ImSession setCookie(Map<String,String> cookies)
Set the Cookie. When the data already exists, the last setting is subject to
cookies - Map类型的Cookie数据 public ImSession setCookie(com.alibaba.fastjson.JSONObject cookies)
Set the Cookie. When the data already exists, the last setting is subject to
cookies - JSONObject类型的Cookie数据 public ImSession addExtra(String name, Object value)
Add Extra (extra/additional) data, when the data already exists, it will not be added
name - Extra键 value - Extra值 public ImSession addExtra(Map<String,Object> extras)
Add Extra (extra/additional) data, when the data already exists, it will not be added
extras - Map类型的Header数据 public ImSession addExtra(com.alibaba.fastjson.JSONObject extras)
Add Extra (extra/additional) data, when the data already exists, it will not be added
extras - JSONObject类型的Header数据 public ImSession setExtra(String name, Object value)
Set the Extra (extra/additional) data. When the data already exists, the last setting is subject to
name - Header键 value - Header值 public ImSession setExtra(com.alibaba.fastjson.JSONObject extras)
Set the Extra (extra/additional) data. When the data already exists, the last setting is subject to
extras - JSONObject类型的Header数据 public ImSession setExtra(Map<String,Object> extras)
Set the Extra (extra/additional) data. When the data already exists, the last setting is subject to
extras - Map类型的Header数据 public String getHeaderValue(String name)
Get the corresponding value according to the Header key
name - Header键 public Set<String> getHeaderNames()
Get all Header keys
public int getHeaderSize()
Get the count of Headers
public String getCookieData(String name)
Get the corresponding value according to the Cookie key
name - Cookie键 public Set<String> getCookieNames()
Get all Cookie keys
public int getCookieSize()
Get the count of Cookies
public Object getExtraValue(String name)
Get the corresponding value according to the Extra (extra/additional) data key
name - Extra键 public Set<String> getExtraNames()
Get all Extra (extra/additional) data keys
public int getExtraSize()
Get the count of Extra (extra/additional) datas
protected ImSessionCallback getCallback()
Copyright © 2020. All rights reserved.