Package io.github.enxign.shed.toolkit
Class ParameterUtils
java.lang.Object
io.github.enxign.shed.toolkit.ParameterUtils
파라미터 유틸리티 클래스
이 클래스는 HttpServletRequest에서 파라미터를 추출하고, XSS 공격을 방지하는 기능을 제공합니다.
- Since:
- 2020-01-09
- Version:
- 1.0
수정일 수정자 수정내용 ---------- --------- ------------------------------- 2020-01-09 first create
- Author:
- enxign
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
XSS 공격을 방지하기 위해 객체의 모든 문자열 필드에서 위험한 문자를 제거합니다.static Map
getParameterMap
(javax.servlet.http.HttpServletRequest request, Map paramerterMap) HttpServletRequest에서 파라미터를 추출하여 Map 형태로 반환합니다.static Map
getParameterMapWithOutSession
(javax.servlet.http.HttpServletRequest request, Map paramerterMap) HttpServletRequest에서 파라미터를 추출하여 Map 형태로 반환합니다.static String
Replaces a String with another String inside a larger String, for the firstmax
values of the search String.static String
replaceHTMLtoText
(String value) XSS 공격을 방지하기 위해 문자열에서 위험한 문자를 제거합니다.
-
Constructor Details
-
ParameterUtils
public ParameterUtils()
-
-
Method Details
-
getParameterMapWithOutSession
public static Map getParameterMapWithOutSession(javax.servlet.http.HttpServletRequest request, Map paramerterMap) HttpServletRequest에서 파라미터를 추출하여 Map 형태로 반환합니다.- Parameters:
request
- HttpServletRequest 객체paramerterMap
- 파라미터 Map- Returns:
- 파라미터를 담은 Map
-
getParameterMap
HttpServletRequest에서 파라미터를 추출하여 Map 형태로 반환합니다.- Parameters:
request
- HttpServletRequest 객체paramerterMap
- 파라미터 Map- Returns:
- 파라미터를 담은 Map
-
replaceHTMLtoText
XSS 공격을 방지하기 위해 문자열에서 위험한 문자를 제거합니다.- Parameters:
value
- 검사할 문자열- Returns:
- XSS 공격이 제거된 문자열
-
replace
Replaces a String with another String inside a larger String, for the first
max
values of the search String.A
null
reference passed to this method is a no-op.StringUtils.replace(null, *, *, *) = null StringUtils.replace("", *, *, *) = "" StringUtils.replace("any", null, *, *) = "any" StringUtils.replace("any", *, null, *) = "any" StringUtils.replace("any", "", *, *) = "any" StringUtils.replace("any", *, *, 0) = "any" StringUtils.replace("abaa", "a", null, -1) = "abaa" StringUtils.replace("abaa", "a", "", -1) = "b" StringUtils.replace("abaa", "a", "z", 0) = "abaa" StringUtils.replace("abaa", "a", "z", 1) = "zbaa" StringUtils.replace("abaa", "a", "z", 2) = "zbza" StringUtils.replace("abaa", "a", "z", -1) = "zbzz"
- Parameters:
text
- text to search and replace in, may be nullsearchString
- the String to search for, may be nullreplacement
- the String to replace it with, may be nullmax
- maximum number of values to replace, or-1
if no maximum- Returns:
- the text with any replacements processed,
null
if null String input
-
cleanXSS
XSS 공격을 방지하기 위해 객체의 모든 문자열 필드에서 위험한 문자를 제거합니다.- Parameters:
object
- 검사할 객체- Returns:
- XSS 공격이 제거된 객체
-