Authored by hugufei

删除无用代码

... ... @@ -22,18 +22,6 @@ public class HttpServletRequestUtils {
return resultMap;
}
public static String transParamParamStr(HttpServletRequest request) {
if (request.getParameterMap() != null) {
StringBuilder paramStringBuilder = new StringBuilder();
for (Map.Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
String value = ArrayUtils.isEmpty(entry.getValue()) ? null : entry.getValue()[0];
paramStringBuilder.append('&').append(entry.getKey()).append('=').append(value);
}
return paramStringBuilder.toString().replaceFirst("&", "");
}
return "";
}
public static String getRequestUrl(HttpServletRequest request) {
StringBuffer sb = new StringBuffer();
sb.append(request.getRequestURI());
... ... @@ -48,26 +36,6 @@ public class HttpServletRequestUtils {
return sb.toString();
}
public static String getIpAddress(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
return ip;
}
public static String genParamString(Map<?, ?> paramMap) {
if (paramMap == null || paramMap.isEmpty()) {
return "";
... ...
package com.yoho.search.common.utils;
import com.yoho.search.base.utils.MD5Util;
import com.yoho.search.core.es.model.SearchParam;
import com.yoho.search.core.es.utils.SearchParamUtils;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import java.util.List;
import java.util.Set;
/**
* Created by henry on 2016/9/21.
*/
public class LocalCacheKeyUtils {
public static String guavaCacheKey(String indexName,SearchParam searchParam){
StringBuilder sb = new StringBuilder();
// 拼装索引名称
sb.append("indexName:").append(indexName).append(';');
// 拼装报文
SearchSourceBuilder searchSourceBuilder = SearchParamUtils.genSearchSourceBuilderFromSearchParam(searchParam);
sb.append("searchSource:").append(searchSourceBuilder.toString()).append(';');
String cacheKey = "YOHOSEARCH:" + MD5Util.string2MD5(sb.toString());
return cacheKey;
}
public static String genMultiGetParamKey(String indexName, Set<String> idList, List<String> fields) {
StringBuilder sb = new StringBuilder();
// 拼装索引名称
sb.append("indexName:").append(indexName).append(';');
// 拼装搜索类型
sb.append("idList:").append(idList.toString()).append(';');
// 拼装报文
sb.append("fields:").append(fields == null ? "" : fields.toString()).append(';');
// 打印拼装结果
return "YOHOSEARCH:" + MD5Util.string2MD5(sb.toString());
}
}
... ... @@ -17,8 +17,7 @@ public class SnappyUtils {
/**
* 压缩
*
* @param text
* @param unCompressedVal
* @return
*/
public static String compress(String unCompressedVal) {
... ... @@ -61,7 +60,7 @@ public class SnappyUtils {
/**
* 解压缩
*
* @param compressVal
* @param compressedVal
* @return
*/
public static String uncompress(String compressedVal) {
... ...