// HttpsServer srv = (HttpsServer)
// httpExchange.getHttpContext().getServer();
// SSLContext ssl = srv.getHttpsConfigurator().getSSLContext();
// }
NewTaskInfo nti = getChild();
Context cntx_child = null;
try {
String grp_in = cntx.getPrmString("grp_in");
if (grp_in == null)
grp_in = "in";
String grp_out = cntx.getPrmString("grp_out");
if (grp_out == null)
grp_out = "out";
if (!Strings.parseBooleanNvl(
cntx.getPrmString("save-in-body"), true)) {
prms.remove("body");
}
cntx_child = nti.createAndReadyTask(cntx.ta, cntx,
cntx.id_subject, grp_in, prms);
Object res = null;
if ((cntx_child == null) || (cntx_child.id_task <= 0)) {
res = cntx_child
.getPrmByFullName(((grp_out == null) || (grp_out
.length() == 0)) ? "body" : grp_out
+ "/body");
if (res == null) {
Headers hd = httpExchange.getResponseHeaders();
hd.put("Content-Type",
Arrays.asList("text/plain; charset=" + enc));
httpExchange.sendResponseHeaders(503, 0);
OutputStream w = httpExchange.getResponseBody();
w.write("Обработчик не выбран".getBytes(enc));
w.close();
return;
}
} else {
Process.currentProcess().regResourceName(
cntx_child.id_task, "child.id");
long wait = Strings.parseIntegerNvl(
cntx.getPrmByFullName("wait"), 30000);// !!!
cntx.log(false, "Start waiting (", wait, ")");
cntx_child.ta.waitFinished(cntx_child.id_subject,
cntx_child.id_task, wait);
cntx.log(false, "End waiting");
res = cntx_child
.getPrmByFullName(((grp_out == null) || (grp_out
.length() == 0)) ? "body" : grp_out
+ "/body");
}
if (res != null) {
Map<String, Object> result = cntx_child
.getGroupParams(grp_out);
long l = 0;
if (res instanceof FileInputStream) {
is = (FileInputStream) res;
l = ((FileInputStream) is).getChannel().size();