use of com.helger.json.JsonObject in project peppol-commons by phax.
the class SMPJsonResponse method convertEndpoint.
@Nonnull
public static IJsonObject convertEndpoint(@Nonnull final com.helger.xsds.bdxr.smp1.EndpointType aEndpoint) {
final IJsonObject aJsonEP = new JsonObject().add(JSON_TRANSPORT_PROFILE, aEndpoint.getTransportProfile()).add(JSON_ENDPOINT_REFERENCE, aEndpoint.getEndpointURI()).add(JSON_REQUIRE_BUSINESS_LEVEL_SIGNATURE, aEndpoint.isRequireBusinessLevelSignature()).add(JSON_MINIMUM_AUTHENTICATION_LEVEL, aEndpoint.getMinimumAuthenticationLevel());
aJsonEP.addIfNotNull(JSON_SERVICE_ACTIVATION_DATE, getLDT(aEndpoint.getServiceActivationDate()));
aJsonEP.addIfNotNull(JSON_SERVICE_EXPIRATION_DATE, getLDT(aEndpoint.getServiceExpirationDate()));
convertCertificate(aJsonEP, Base64.encodeBytes(aEndpoint.getCertificate()));
aJsonEP.add(JSON_SERVICE_DESCRIPTION, aEndpoint.getServiceDescription()).add(JSON_TECHNICAL_CONTACT_URL, aEndpoint.getTechnicalContactUrl()).add(JSON_TECHNICAL_INFORMATION_URL, aEndpoint.getTechnicalInformationUrl()).addIfNotNull(JSON_EXTENSION, BDXR1ExtensionConverter.convertToJson(aEndpoint.getExtension()));
return aJsonEP;
}
use of com.helger.json.JsonObject in project peppol-commons by phax.
the class SMPJsonResponse method convertEndpoint.
@Nonnull
public static IJsonObject convertEndpoint(@Nonnull final com.helger.xsds.peppol.smp1.EndpointType aEndpoint) {
final String sEndpointRef = aEndpoint.getEndpointReference() == null ? null : W3CEndpointReferenceHelper.getAddress(aEndpoint.getEndpointReference());
final IJsonObject aJsonEP = new JsonObject().add(JSON_TRANSPORT_PROFILE, aEndpoint.getTransportProfile()).add(JSON_ENDPOINT_REFERENCE, sEndpointRef).add(JSON_REQUIRE_BUSINESS_LEVEL_SIGNATURE, aEndpoint.isRequireBusinessLevelSignature()).add(JSON_MINIMUM_AUTHENTICATION_LEVEL, aEndpoint.getMinimumAuthenticationLevel());
aJsonEP.addIfNotNull(JSON_SERVICE_ACTIVATION_DATE, getLDT(aEndpoint.getServiceActivationDate()));
aJsonEP.addIfNotNull(JSON_SERVICE_EXPIRATION_DATE, getLDT(aEndpoint.getServiceExpirationDate()));
convertCertificate(aJsonEP, aEndpoint.getCertificate());
aJsonEP.add(JSON_SERVICE_DESCRIPTION, aEndpoint.getServiceDescription()).add(JSON_TECHNICAL_CONTACT_URL, aEndpoint.getTechnicalContactUrl()).add(JSON_TECHNICAL_INFORMATION_URL, aEndpoint.getTechnicalInformationUrl()).add(JSON_EXTENSION, SMPExtensionConverter.convertToString(aEndpoint.getExtension()));
return aJsonEP;
}
use of com.helger.json.JsonObject in project peppol-commons by phax.
the class SMPJsonResponse method getJsonPrincipal.
@Nonnull
public static IJsonObject getJsonPrincipal(@Nonnull final X500Principal aPrincipal) {
ValueEnforcer.notNull(aPrincipal, "Principal");
final IJsonObject ret = new JsonObject();
ret.add("name", aPrincipal.getName());
try {
for (final Rdn aRdn : new LdapName(aPrincipal.getName()).getRdns()) ret.add(aRdn.getType(), aRdn.getValue());
} catch (final InvalidNameException ex) {
// shit happens
}
return ret;
}
use of com.helger.json.JsonObject 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.JsonObject 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