diff --git a/src/org/redkale/net/http/HttpScope.java b/src/org/redkale/net/http/HttpScope.java index 7d77ba06b..d3a07725b 100644 --- a/src/org/redkale/net/http/HttpScope.java +++ b/src/org/redkale/net/http/HttpScope.java @@ -6,6 +6,7 @@ package org.redkale.net.http; import java.util.*; +import java.util.function.BiConsumer; import org.redkale.convert.*; import org.redkale.convert.json.JsonConvert; @@ -41,7 +42,15 @@ public class HttpScope { public static HttpScope template(String template) { HttpScope rs = new HttpScope(); - return rs.template(template); + rs.setTemplate(template); + return rs; + } + + public HttpScope attr(Map map) { + if (map == null) return this; + if (this.attributes == null) this.attributes = new LinkedHashMap<>(); + this.attributes.putAll(map); + return this; } public HttpScope attr(String name, Object value) { @@ -60,6 +69,11 @@ public class HttpScope { return parent == null ? null : parent.find(name); } + public void forEach(BiConsumer action) { + if (this.attributes == null) return; + this.attributes.forEach(action); + } + public String getTemplate() { return template; }