All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xiongyingqi.utils.baidu.CommonUtil Maven / Gradle / Ivy

There is a newer version: 0.1.10
Show newest version
package com.xiongyingqi.utils.baidu;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xiongyingqi.util.PropertiesHelper;

import java.util.Map;

/**
 * 
* Created by 瑛琪xiongyingqi.com on 2014/7/9 0009. */ public class CommonUtil { public static String ipLocationApiUrl; public static String ak; public static String sk; public static boolean sn; public static ThreadLocal _mapper = new ThreadLocal() { @Override protected ObjectMapper initialValue() { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); objectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); return objectMapper; } }; static { Map propertiesMap = PropertiesHelper.readProperties(CommonUtil.class.getClassLoader().getResourceAsStream("baidu_api.properties")); ipLocationApiUrl = propertiesMap.get("ip-location-api"); ak = propertiesMap.get("ak"); sk = propertiesMap.get("sk"); String snStr = propertiesMap.get("sn"); if (snStr != null && "true".equals(snStr)) { sn = true; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy