Example usage for com.google.gson GsonBuilder setPrettyPrinting

List of usage examples for com.google.gson GsonBuilder setPrettyPrinting

Introduction

In this page you can find the example usage for com.google.gson GsonBuilder setPrettyPrinting.

Prototype

public GsonBuilder setPrettyPrinting() 

Source Link

Document

Configures Gson to output Json that fits in a page for pretty printing.

Usage

From source file:org.mobicents.servlet.restcomm.http.SmsMessagesEndpoint.java

License:Open Source License

@PostConstruct
public void init() {
    final DaoManager storage = (DaoManager) context.getAttribute(DaoManager.class.getName());
    configuration = (Configuration) context.getAttribute(Configuration.class.getName());
    configuration = configuration.subset("runtime-settings");
    dao = storage.getSmsMessagesDao();//from   w ww  .ja  v  a2s .  c  om
    accountsDao = storage.getAccountsDao();
    aggregator = (ActorRef) context.getAttribute("org.mobicents.servlet.restcomm.sms.SmsService");
    system = (ActorSystem) context.getAttribute(ActorSystem.class.getName());
    super.init(configuration);
    final SmsMessageConverter converter = new SmsMessageConverter(configuration);
    final GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(SmsMessage.class, converter);
    builder.setPrettyPrinting();
    gson = builder.create();
    xstream = new XStream();
    xstream.alias("RestcommResponse", RestCommResponse.class);
    xstream.registerConverter(converter);
    xstream.registerConverter(new SmsMessageListConverter(configuration));
    xstream.registerConverter(new RestCommResponseConverter(configuration));

    normalizePhoneNumbers = configuration.getBoolean("normalize-numbers-for-outbound-calls");
}

From source file:org.mobicents.servlet.restcomm.http.statistics.StatisticsCallsPerDayLast30DaysEndpoint.java

License:Open Source License

@PostConstruct
public void init() {
    final DaoManager storage = (DaoManager) context.getAttribute(DaoManager.class.getName());
    dao = storage.getStatisticsDao();/*from w ww  .  j a  v a  2  s . c  o m*/
    accountsDao = storage.getAccountsDao();
    configuration = (Configuration) context.getAttribute(Configuration.class.getName());
    configuration = configuration.subset("runtime-settings");
    super.init(configuration);
    final StatisticsCallsPerDayLast30DaysConverter converter = new StatisticsCallsPerDayLast30DaysConverter(
            configuration);
    final GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Client.class, converter);
    builder.setPrettyPrinting();
    gson = builder.create();

}

From source file:org.mobicents.servlet.restcomm.http.statistics.StatisticsCallsPerMonthLast12MonthsEndpoint.java

License:Open Source License

@PostConstruct
public void init() {
    final DaoManager storage = (DaoManager) context.getAttribute(DaoManager.class.getName());
    dao = storage.getStatisticsDao();//  www.  j a v a 2  s.c om
    accountsDao = storage.getAccountsDao();
    configuration = (Configuration) context.getAttribute(Configuration.class.getName());
    configuration = configuration.subset("runtime-settings");
    super.init(configuration);
    final StatisticsCallsPerMonthLast12MonthsConverter converter = new StatisticsCallsPerMonthLast12MonthsConverter(
            configuration);
    final GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Client.class, converter);
    builder.setPrettyPrinting();
    gson = builder.create();

}

From source file:org.mobicents.servlet.restcomm.http.statistics.StatisticsSMSPerDayLast30DaysEndpoint.java

License:Open Source License

@PostConstruct
public void init() {
    final DaoManager storage = (DaoManager) context.getAttribute(DaoManager.class.getName());
    dao = storage.getStatisticsDao();// w w w  . j  a v  a 2  s.c  o m
    accountsDao = storage.getAccountsDao();
    configuration = (Configuration) context.getAttribute(Configuration.class.getName());
    configuration = configuration.subset("runtime-settings");
    super.init(configuration);
    final StatisticsSMSPerDayLast30DaysConverter converter = new StatisticsSMSPerDayLast30DaysConverter(
            configuration);
    final GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Client.class, converter);
    builder.setPrettyPrinting();
    gson = builder.create();

}

From source file:org.mobicents.servlet.restcomm.http.statistics.StatisticsSMSPerMonthLast12MonthsEndpoint.java

License:Open Source License

@PostConstruct
public void init() {
    final DaoManager storage = (DaoManager) context.getAttribute(DaoManager.class.getName());
    dao = storage.getStatisticsDao();// www . j  av a 2 s.  c  o m
    accountsDao = storage.getAccountsDao();
    configuration = (Configuration) context.getAttribute(Configuration.class.getName());
    configuration = configuration.subset("runtime-settings");
    super.init(configuration);
    final StatisticsSMSPerMonthLast12MonthsConverter converter = new StatisticsSMSPerMonthLast12MonthsConverter(
            configuration);
    final GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Client.class, converter);
    builder.setPrettyPrinting();
    gson = builder.create();

}

From source file:org.mobicents.servlet.restcomm.http.statistics.StatisticsTopTenCallersEndpoint.java

License:Open Source License

@PostConstruct
public void init() {
    final DaoManager storage = (DaoManager) context.getAttribute(DaoManager.class.getName());
    dao = storage.getStatisticsDao();/*from   www . jav  a 2s .co  m*/
    accountsDao = storage.getAccountsDao();
    configuration = (Configuration) context.getAttribute(Configuration.class.getName());
    configuration = configuration.subset("runtime-settings");
    super.init(configuration);
    final StatisticsTopTenCallersConverter converter = new StatisticsTopTenCallersConverter(configuration);
    final GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Client.class, converter);
    builder.setPrettyPrinting();
    gson = builder.create();

}

From source file:org.mobicents.servlet.restcomm.http.statistics.StatisticsTopTenSMSEndpoint.java

License:Open Source License

@PostConstruct
public void init() {
    final DaoManager storage = (DaoManager) context.getAttribute(DaoManager.class.getName());
    dao = storage.getStatisticsDao();/*  ww w.j  av  a 2  s .c  o  m*/
    accountsDao = storage.getAccountsDao();
    configuration = (Configuration) context.getAttribute(Configuration.class.getName());
    configuration = configuration.subset("runtime-settings");
    super.init(configuration);
    final StatisticsTopTenSMSConverter converter = new StatisticsTopTenSMSConverter(configuration);
    final GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Client.class, converter);
    builder.setPrettyPrinting();
    gson = builder.create();

}

From source file:org.mobicents.servlet.restcomm.http.statistics.StatisticsTotalCallsLast24HoursEndpoint.java

License:Open Source License

@PostConstruct
public void init() {
    final DaoManager storage = (DaoManager) context.getAttribute(DaoManager.class.getName());
    dao = storage.getStatisticsDao();//  w  w  w .j  a  va2s .com
    accountsDao = storage.getAccountsDao();
    configuration = (Configuration) context.getAttribute(Configuration.class.getName());
    configuration = configuration.subset("runtime-settings");
    super.init(configuration);
    final StatisticsTotalCallsLast24HoursConverter converter = new StatisticsTotalCallsLast24HoursConverter(
            configuration);
    final GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(StatisticsTotalCallsLast24Hours.class, converter);
    builder.setPrettyPrinting();
    gson = builder.create();

}

From source file:org.mobicents.servlet.restcomm.http.statistics.StatisticsTotalSMSLast24HoursEndpoint.java

License:Open Source License

@PostConstruct
public void init() {
    final DaoManager storage = (DaoManager) context.getAttribute(DaoManager.class.getName());
    dao = storage.getStatisticsDao();/*  w  ww  .  ja  va2  s  .  c o  m*/
    accountsDao = storage.getAccountsDao();
    configuration = (Configuration) context.getAttribute(Configuration.class.getName());
    configuration = configuration.subset("runtime-settings");
    super.init(configuration);
    final StatisticsTotalSMSLast24HoursConverter converter = new StatisticsTotalSMSLast24HoursConverter(
            configuration);
    final GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(StatisticsTotalSMSLast24Hours.class, converter);
    builder.setPrettyPrinting();
    gson = builder.create();

}

From source file:org.mobicents.servlet.restcomm.http.TranscriptionsEndpoint.java

License:Open Source License

@PostConstruct
public void init() {
    final DaoManager storage = (DaoManager) context.getAttribute(DaoManager.class.getName());
    configuration = (Configuration) context.getAttribute(Configuration.class.getName());
    configuration = configuration.subset("runtime-settings");
    super.init(configuration);
    dao = storage.getTranscriptionsDao();
    accountsDao = storage.getAccountsDao();
    final TranscriptionConverter converter = new TranscriptionConverter(configuration);
    final GsonBuilder builder = new GsonBuilder();
    builder.registerTypeAdapter(Transcription.class, converter);
    builder.setPrettyPrinting();
    gson = builder.create();/* www  .j  a v  a 2s . c  om*/
    xstream = new XStream();
    xstream.alias("RestcommResponse", RestCommResponse.class);
    xstream.registerConverter(converter);
    xstream.registerConverter(new TranscriptionListConverter(configuration));
    xstream.registerConverter(new RestCommResponseConverter(configuration));
}