public void addRequestHeaders(NativeObject headersNO) { if (headersNO != null) { for (Object o : headersNO.getAllIds()) { Object val = headersNO.get(o.toString(), null); if (val instanceof NativeArray) { NativeArray arr = (NativeArray) val; for (int i = 0; i < arr.getLength(); i++) { method.addHeader(o.toString(), arr.get(i, null).toString()); } } else { method.addHeader(o.toString(), val.toString()); } } } }
public void addRequestParameters(NativeObject paramsNO) { if (paramsNO != null) { for (Object o : paramsNO.getAllIds()) { Object val = paramsNO.get(o.toString(), null); if (val instanceof NativeArray) { NativeArray arr = (NativeArray) val; for (int i = 0; i < arr.getLength(); i++) { addRequestParameter(o.toString(), arr.get(i, null).toString()); } } else { addRequestParameter(o.toString(), val.toString()); } } } }