From 916a3cbabe4e50062fce61ff6f2f5d46c05dfbd1 Mon Sep 17 00:00:00 2001 From: 이민희 <mhlee@maprex.co.kr> Date: 목, 17 3월 2022 17:47:45 +0900 Subject: [PATCH] - api로 이슈 추가 시 url/ip로 업체 찾는 코드 수정 --- src/main/java/kr/wisestone/owl/util/CommonUtil.java | 38 ++++++++++++++++++++++++++++++++++++-- 1 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/main/java/kr/wisestone/owl/util/CommonUtil.java b/src/main/java/kr/wisestone/owl/util/CommonUtil.java index 4901e3b..6ee3905 100644 --- a/src/main/java/kr/wisestone/owl/util/CommonUtil.java +++ b/src/main/java/kr/wisestone/owl/util/CommonUtil.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Lists; -import com.google.gson.Gson; +import kr.wisestone.owl.constant.Regular; import kr.wisestone.owl.domain.enumType.FileType; import kr.wisestone.owl.type.LikeType; import kr.wisestone.owl.vo.DepartmentVo; @@ -56,7 +56,9 @@ private static final String PASS_PHRASE = "1024"; // AES128 �븫�샇�솕�뿉 �궗�슜 private static final int ITERATION_COUNT = 10000; // AES128 �븫�샇�솕�뿉 �궗�슜 private static final int KEY_SIZE = 128; // AES128 �븫�샇�솕�뿉 �궗�슜 - private static final String TMP_UPLOAD_FOLDER = "/tmpUploadFolder/"; // �씠�뒋 �깮�꽦, �닔�젙�뿉�꽌 �뙆�씪 �뾽濡쒕뱶�븷 �븣 �엫�떆 �뤃�뜑濡� �궗�슜 + private static final String TMP_UPLOAD_FOLDER = "/tmpUploadFolder/"; // �씠�뒋 �깮�꽦, �닔�젙�뿉�꽌 �뙆�씪 �뾽濡쒕뱶�븷 �븣 �엫�떆 �뤃�뜑濡� �궗�슜' + public static final String COMMA = ","; // 援щ텇�옄 + public static String getClinetIp() { try { @@ -1042,4 +1044,36 @@ } return ""; } + + + /** + * �젙洹쒖떇 寃��궗(URL) + * @param url ���긽 臾몄옄�뿴(URL) + * @return 寃��궗 寃곌낵 + */ + public static boolean verifyUrl(String url) { + return verifyRegular(url, Regular.URL); + } + + /** + * �젙洹쒖떇 寃��궗(IP) + * @param ip ���긽 臾몄옄�뿴(IP) + * @return 寃��궗 寃곌낵 + */ + public static boolean verifyIp(String ip) { + return verifyRegular(ip, Regular.IP); + } + + /** + * �젙洹쒖떇 寃��궗 + * @param value ���긽 臾몄옄�뿴 + * @param regular �젙洹쒖떇 寃��궗瑜� �븷 �젙洹쒖떇 援щЦ + * @return 寃��궗 寃곌낵 + */ + public static boolean verifyRegular(String value, String regular) { + if (!StringUtils.isEmpty(value)) { + return Pattern.matches(regular, value); + } + return false; + } } -- Gitblit v1.8.0