Doric add prism style
This commit is contained in:
@@ -23,6 +23,7 @@ public class DoricContext {
|
||||
private final Context mContext;
|
||||
private RootNode mRootNode = new RootNode(this);
|
||||
private final String source;
|
||||
private String script;
|
||||
|
||||
DoricContext(Context context, String contextId, String source) {
|
||||
this.mContext = context;
|
||||
@@ -34,8 +35,13 @@ public class DoricContext {
|
||||
return source;
|
||||
}
|
||||
|
||||
public String getScript() {
|
||||
return script;
|
||||
}
|
||||
|
||||
public static DoricContext create(Context context, String script, String source) {
|
||||
DoricContext doricContext = DoricContextManager.getInstance().createContext(context, script, source);
|
||||
doricContext.script = script;
|
||||
doricContext.callEntity(DoricConstant.DORIC_ENTITY_CREATE);
|
||||
return doricContext;
|
||||
}
|
||||
|
@@ -58,6 +58,26 @@ public class LocalServer extends NanoHTTPD {
|
||||
return jsonArray;
|
||||
}
|
||||
});
|
||||
commandMap.put("context", new APICommand() {
|
||||
@Override
|
||||
public String name() {
|
||||
return "context";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object exec(IHTTPSession session) {
|
||||
String id = session.getParms().get("id");
|
||||
DoricContext doricContext = DoricContextManager.getContext(id);
|
||||
if (doricContext != null) {
|
||||
return new JSONBuilder()
|
||||
.put("id", doricContext.getContextId())
|
||||
.put("source", doricContext.getSource())
|
||||
.put("script", doricContext.getScript())
|
||||
.toJSONObject();
|
||||
}
|
||||
return "{}";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static String getIpAddressString() {
|
||||
|
Reference in New Issue
Block a user