use of com.helger.json.IJsonObject in project ph-web by phax.
the class LoggingRequest method getAsJson.
@Nonnull
public IJsonObject getAsJson() {
final JsonObject ret = new JsonObject();
if (m_sSender != null)
ret.add("sender", m_sSender);
if (m_sMethod != null)
ret.add("method", m_sMethod);
if (m_sPath != null)
ret.add("path", m_sPath);
if (m_aParams != null)
ret.addJson("params", new JsonObject().addAll(m_aParams));
if (m_aHeaders != null) {
final IJsonObject aHeaders = new JsonObject();
m_aHeaders.forEachSingleHeader(aHeaders::add, true);
ret.addJson("headers", aHeaders);
}
if (m_sBody != null)
ret.add("body", m_sBody);
return ret;
}
use of com.helger.json.IJsonObject in project ph-web by phax.
the class LoggingResponse method getAsJson.
@Nonnull
public IJsonObject getAsJson() {
final JsonObject ret = new JsonObject();
if (m_nStatus != 0)
ret.add("status", m_nStatus);
if (m_aHeaders != null) {
final IJsonObject aHeaders = new JsonObject();
m_aHeaders.forEachSingleHeader(aHeaders::add, true);
ret.addJson("headers", aHeaders);
}
if (m_sBody != null)
ret.add("body", m_sBody);
return ret;
}
Aggregations