byte[] buf = res.toString().getBytes(enc);
is = new ByteArrayInputStream(buf);
l = buf.length;
}
Headers hd = httpExchange.getResponseHeaders();
hd.put("Content-Type", Arrays.asList("text/plain; charset=" + enc));
hd.put("Content-Length", Arrays.asList(Long.toString(l)));
String h = cntx.getFullName(grp_out, "hdrs.");
Map<String, Object> result = cntx.getGroupParams(grp_out);
for (Map.Entry<String, Object> e : result.entrySet()) {
String k = e.getKey();
if (k.indexOf(h) == 0) {
k = k.substring(h.length());
Object o = e.getValue();
String v;
if (o != null && o instanceof IDependentParam) {
IDependentParam idp = (IDependentParam)o;
try {
o = idp.getValue(cntx);
} catch (CalculateException e1) {
e1.printStackTrace();
}
}
if (o == null)
continue;
v = Strings.getString(o);
hd.put(k, Arrays.asList(v));
}
}
httpExchange.sendResponseHeaders(200, l);
OutputStream w = httpExchange.getResponseBody();
byte[] buf = new byte[8 * 1024];