This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
package org.redkale.net.http;
|
package org.redkale.net.http;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
import org.redkale.convert.*;
|
import org.redkale.convert.*;
|
||||||
import org.redkale.convert.json.JsonConvert;
|
import org.redkale.convert.json.JsonConvert;
|
||||||
|
|
||||||
@@ -41,7 +42,15 @@ public class HttpScope {
|
|||||||
|
|
||||||
public static HttpScope template(String template) {
|
public static HttpScope template(String template) {
|
||||||
HttpScope rs = new HttpScope();
|
HttpScope rs = new HttpScope();
|
||||||
return rs.template(template);
|
rs.setTemplate(template);
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HttpScope attr(Map<String, Object> 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) {
|
public HttpScope attr(String name, Object value) {
|
||||||
@@ -60,6 +69,11 @@ public class HttpScope {
|
|||||||
return parent == null ? null : parent.find(name);
|
return parent == null ? null : parent.find(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void forEach(BiConsumer<String, Object> action) {
|
||||||
|
if (this.attributes == null) return;
|
||||||
|
this.attributes.forEach(action);
|
||||||
|
}
|
||||||
|
|
||||||
public String getTemplate() {
|
public String getTemplate() {
|
||||||
return template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user