private Result decorate(Map<String, String> headers, String body) { try { NodeContext.set(); Component.setWrappedComponent(new Component(headers, body)); String path = Http.Context.current().request().path().substring(1); if (headers.containsKey(Component.PATH_ALIAS)) { path = headers.get(Component.PATH_ALIAS); } return CoreLoader.loadPage(path); } finally { NodeContext.clear(); } }
public static boolean isProvider(String withType, Class clazz) { return NodeContext.current().attributes.get(withType).equals(clazz); }