diff --git a/src/org/redkale/net/http/WebSocketRange.java b/src/org/redkale/net/http/WebSocketRange.java index a8f5ca550..70ab73147 100644 --- a/src/org/redkale/net/http/WebSocketRange.java +++ b/src/org/redkale/net/http/WebSocketRange.java @@ -18,35 +18,47 @@ import org.redkale.convert.json.JsonConvert; * @author zhangjx */ public class WebSocketRange implements Serializable { - + protected String wskey; - + protected Map attach; - + public WebSocketRange() { } - + public WebSocketRange(String wskey) { this.wskey = wskey; } - + public WebSocketRange(String wskey, Map attach) { this.wskey = wskey; this.attach = attach; } - + + public boolean containsAttach(String key) { + return this.attach == null ? false : this.attach.containsKey(key); + } + + public String getAttach(String key) { + return this.attach == null ? null : this.attach.get(key); + } + + public String getAttach(String key, String defval) { + return this.attach == null ? defval : this.attach.getOrDefault(key, defval); + } + public String getWskey() { return wskey; } - + public void setWskey(String wskey) { this.wskey = wskey; } - + public Map getAttach() { return attach; } - + public void setAttach(Map attach) { this.attach = attach; }