// Path: src/main/java/org/datacite/conres/Configuration.java
// public class Configuration {
//     public static final String SOLR_BASE_URL;
//     public static final String SOLR_API_URL;
//     public static final String SOLR_STATUS_URL;
//     public static final String APP_CONTEXT;
//     public static final String APP_GOOGLE_ANALYTICS;
//     public static final String BUGSNAG_KEY;
//     public static final Properties prop;
//     public static final int SOLR_CACHE_SIZE;
//     public static final int SOLR_CACHE_EXPIRE;
//     public static final int CACHE_CONTROL_MAX_AGE;
// 
//     static {
//         prop = new Properties();
//         InputStream in = Configuration.class.getResourceAsStream("/config.properties");
//         if (in == null)
//             throw new RuntimeException("Please setup valid config.properties");
//         try {
//             prop.load(in);
//             SOLR_BASE_URL = (String) Configuration.prop.get("solr.base.url");
//             SOLR_API_URL = Configuration.SOLR_BASE_URL + "/api";
//             SOLR_STATUS_URL = Configuration.SOLR_BASE_URL + "/status";
//             APP_CONTEXT = (String) Configuration.prop.get("app.context");
//             APP_GOOGLE_ANALYTICS = (String) Configuration.prop.get("app.google_analytics");
//             BUGSNAG_KEY = (String) Configuration.prop.get("app.bugsnag.key");
//             SOLR_CACHE_SIZE = Integer.parseInt((String) Configuration.prop.get("solr.cache.size.items"));
//             SOLR_CACHE_EXPIRE = Integer.parseInt((String) Configuration.prop.get("solr.cache.expire.seconds"));
//             CACHE_CONTROL_MAX_AGE = Integer.parseInt((String) Configuration.prop.get("cache.control.max.age.seconds"));
//             in.close();
//         } catch (IOException e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
// }
// 
// Path: src/main/java/org/datacite/conres/service/CslFormatterService.java
// public interface CslFormatterService {
//     String format(JSONObject cslJson, String cslStyle, String cslLocale);
// }


import com.google.common.base.Charsets;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import org.codehaus.jettison.json.JSONObject;
import org.datacite.conres.Configuration;
import org.datacite.conres.service.CslFormatterService;
import javax.ws.rs.core.MediaType;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
package org.datacite.conres.service.impl;




public class CslFormatterServiceImpl implements CslFormatterService {
    private static Client client = Client.create();

    @Override
    public String format(JSONObject cslJson, String cslStyle, String cslLocale) {
        if (cslStyle == null || cslStyle.equals(""))
            cslStyle = "springer-basic-author-date";

// Path: src/main/java/org/datacite/conres/Configuration.java
// public class Configuration {
//     public static final String SOLR_BASE_URL;
//     public static final String SOLR_API_URL;
//     public static final String SOLR_STATUS_URL;
//     public static final String APP_CONTEXT;
//     public static final String APP_GOOGLE_ANALYTICS;
//     public static final String BUGSNAG_KEY;
//     public static final Properties prop;
//     public static final int SOLR_CACHE_SIZE;
//     public static final int SOLR_CACHE_EXPIRE;
//     public static final int CACHE_CONTROL_MAX_AGE;
// 
//     static {
//         prop = new Properties();
//         InputStream in = Configuration.class.getResourceAsStream("/config.properties");
//         if (in == null)
//             throw new RuntimeException("Please setup valid config.properties");
//         try {
//             prop.load(in);
//             SOLR_BASE_URL = (String) Configuration.prop.get("solr.base.url");
//             SOLR_API_URL = Configuration.SOLR_BASE_URL + "/api";
//             SOLR_STATUS_URL = Configuration.SOLR_BASE_URL + "/status";
//             APP_CONTEXT = (String) Configuration.prop.get("app.context");
//             APP_GOOGLE_ANALYTICS = (String) Configuration.prop.get("app.google_analytics");
//             BUGSNAG_KEY = (String) Configuration.prop.get("app.bugsnag.key");
//             SOLR_CACHE_SIZE = Integer.parseInt((String) Configuration.prop.get("solr.cache.size.items"));
//             SOLR_CACHE_EXPIRE = Integer.parseInt((String) Configuration.prop.get("solr.cache.expire.seconds"));
//             CACHE_CONTROL_MAX_AGE = Integer.parseInt((String) Configuration.prop.get("cache.control.max.age.seconds"));
//             in.close();
//         } catch (IOException e) {
//             throw new RuntimeException(e);
//         }
//     }
// 
// }
// 
// Path: src/main/java/org/datacite/conres/service/CslFormatterService.java
// public interface CslFormatterService {
//     String format(JSONObject cslJson, String cslStyle, String cslLocale);
// }


// Path: src/main/java/org/datacite/conres/service/impl/CslFormatterServiceImpl.java
import com.google.common.base.Charsets;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import org.codehaus.jettison.json.JSONObject;
import org.datacite.conres.Configuration;
import org.datacite.conres.service.CslFormatterService;
import javax.ws.rs.core.MediaType;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

package org.datacite.conres.service.impl;




public class CslFormatterServiceImpl implements CslFormatterService {
    private static Client client = Client.create();

    @Override
    public String format(JSONObject cslJson, String cslStyle, String cslLocale) {
        if (cslStyle == null || cslStyle.equals(""))
            cslStyle = "springer-basic-author-date";

        if (cslLocale == null || cslLocale.equals(""))