2023년 5월 18일 목요일
자바 시큐어코딩 Public메소드부터 반환된 Private 배열 또는 private 배열에 Public 데이타 할당
2023년 5월 16일 화요일
자바 시큐어코딩 부적절한 XML 외부개체 참조
자바 시큐어코딩 HTTP응답 분할
2023년 4월 2일 일요일
2022년 5월 25일 수요일
클래스로더 ClassLoader 가 로딩중인 lib 파일 경로 찾기
ClassLoader classloader =
org.apache.xmlbeans.XmlOptions.class.getClassLoader();
java.net.URL res = classloader.getResource(
"org/apache/xmlbeans/XmlOptions.class");
String path = res.getPath();
System.out.println("XmlOptions came from " + path);
2022년 5월 11일 수요일
2022년 4월 10일 일요일
HashMap 데이타 추출
Map<String, Object> pMap = new HashMap<String, Object>();
pMap.put("UserId", "id");
pMap.put("UserId", "id");
pMap.put("UserId", "id");
for( Map.Entry<String, Object> pa : pMap.entrySet()){
System.out.println(" [pMap key] :" + pa.getKey() + ", [Value] : " + pa.getValue());
}
2022년 2월 3일 목요일
@RequestMapping + 한글 파라미터 404 Not Found
@PathVariable 한글 파라미터 인경우
2021년 8월 23일 월요일
git commit 후 comment 수정
git commit --amend
가장 마지막에 commit한 내용을 수정 가능
팝업 창이 뜨면 해당 코멘트 내용을 수정하고 닫으면 반영됨.
2021년 7월 30일 금요일
Servlet2.3 이하에서 ServletContext 내 getContextPath() 가 없는 경우 처리
WEB.xml
<context-param>
<param-name>contextPath</param-name>
<!-- 원하는 context명을 입력한다 -->
<param-value>/Sample</param-name>
</context-param>
java
String contextPath = ServletContext.getInitParameter("contextPath");
System.out.println("contextPath :: " + contextPath);
==> 결과 : /Sample
j2ee 버전이 높은경우
web.xml 설정없음.
java
String contextPath = ServletContext.getContextPath();
로 사용하면 된다.
참고 : https://chrismare.tistory.com/entry/Servlet-%EB%8D%B0%EC%9D%B4%ED%84%B0-%EA%B3%B5%EC%9C%A0-ServletContext
2021년 2월 2일 화요일
log4j2 설정에 필요한 파일
Log4j2 를 사용하기 위해서는 log4j-core , log4j-api , log4j-slf4j-impl 3가지가 필요합니다.
또한 인터페이스화 시키기 위하여 SLF4J 의 slf4j-api , slog4j-over-slf4j 를 추가합니다.
log4j-core , log4j-api , log4j-slf4j-impl
는 2버전 이상으로 구할것.
slog4j-over-slf4j
==> https://mvnrepository.com/artifact/org.slf4j/log4j-over-slf4j/1.7.30
slf4j-api
==> https://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.7.30
2020년 1월 29일 수요일
이클립스 + java UserLib + java Build Path 등록 후 publish/export dependency 가 널인경우 /WEB-INF/lib 추가하기
1. 프로젝트 선택
필터 --> .resuorce 체크 풀기
.classpath 열어 아래 항목 추가
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/etcs"/>
----> 변경
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/etcs">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
2019년 12월 12일 목요일
자바시큐리티 보안취약점 점검 : Private 배열에 Public 데이터 할당
1. Private 배열에 Public 데이터 할당
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
private List<String> noTest = null;
public void setNoSessionUrls(List<String> aTest){
this.noTest = aTest;
}
아래의 형태로 변경
public void setNoSessionUrls(List<String> aTest){
// Private배열에 Public데이터 할당
// this.noTest = aTest;
this.noTest = new ArrayList<String>();
this.noTest .addAll(aTest);
}
| cs |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
private char[] aTest; String[] 등도
public Test(char[] bTest) {
this.aTest= bTest;
}
아래로 변경
public Test(char[] bTest) {
// Private배열에 Public데이터 할당
// this.aTest= bTest;
this.aTest= new char[bTest.length];
for(int i=0; i<bTest.length; i++){
this.aTest[i] = bTest[i];
}
}
| cs |
2019년 11월 13일 수요일
트리거 홋따옴표 처리
-- 파라미터 1개일때 vTxt := 'delete from test where col = ''' || :old.col || '''' DELETE FROM TEST WHERE COL = '1';
앞에 3개 뒤에 4개 : ''' || :old.col || ''''
;
-- 파라미터 2개이상일때 vTxt := 'delete from test where col = ''' || :OLD.col || ''' AND CD = ''' || :OLD.CD || '''';
DELETE FROM TEST WHERE COL = '1' AND CD = 'C';
3/3/3/4
2019년 10월 16일 수요일
WEBTOB/tomcat compression 옵션 사용 - gzip 압축 전송
compression 적용
=========================================================
*SERVER 절
HTML svgname = htmlg....
TEST svgname = htmlg, MinProc=2,
compression ="application/javascript"
*EXT
js MimeType = "application/x-javascript", SvrType = HTML
TEST 도메인에 ( jeus 서버가 되시겠다 ) js 파일이 올라가 있는경우에는 작동하지만
EXT의 js 파일을 보면 SvrType = HTML 임
*Server 절의 HTML에서 해당 파일을 읽고 내려보내줌.
현재의 내용대로라면 compression 옵션은 무용지물
따라서 HTML 에서 compression 옵션을 추가해야함.
*SERVER 절
HTML svgname = htmlg....
compression ="application/javascript"
TEST svgname = htmlg, MinProc=2,
compression ="application/javascript"
=========================================================
특정 도메인에만 compression 적용
=========================================================
Webtob에서 운영하는 도메인이 여러개인경우 특정 도메인에만 적용시킬려면
*SERVER GROUP절에 test에 관련된 group 추가
HTMLTEST NODENAME = "web1", SVRTYPE=HTML, vhostname="test, test_ssl"
*SERVER 절 아래 항목 추가
HTMLTEST svgname = HTMLTEST, MinProc=2, vhost="test, test_ssl",
compression ="application/javascript"
tomcat 7 이상 - SERVER.xml
2019년 10월 9일 수요일
웹 어플리케이션 로딩시 특정 클래스 먼저 로딩/실행하기. ( WEB.xml)
예 ) 서버 구동시 SQL 실행하여 특정 작업을 할때
버전 체크 등의 작업
샘플
web.xml
1
2
3
4
5
|
<servlet>
<servlet-name>CrunchifyTutorials</servlet-name>
<servlet-class>org.tmt.core.test.CrunchifyServletExample</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
| cs |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import org.apache.log4j.Logger;
public class CrunchifyServletExample extends HttpServlet{
/** Logger */
final static Logger log = Logger.getLogger(CrunchifyServletExample.class);
public void init() throws ServletException
{
System.out.println("----------");
System.out.println("---------- CrunchifyServletExample Initialized successfully ----------");
System.out.println("----------");
}
}
| cs |
참고
https://crunchify.com/how-to-run-java-program-automatically-on-tomcat-startup/
2019년 9월 19일 목요일
고용보험 수급 조건
수급자격이 제한되지 아니하는 정당한 이직 사유(시행규칙 제101조제2항 별표2)
1. 다음 각 목의 어느 하나에 해당하는 사유가 이직일 전 1년 이내에 2개월 이상 발생한 경우
-
가. 실제 근로조건이 채용 시 제시된 근로조건이나 채용 후 일반적으로 적용받던 근로조건보다 낮아지게 된 경우
-
나. 임금체불이 있는 경우
-
다. 소정근로에 대하여 지급받은 임금이 「최저임금법」에 따른 최저임금에 미달하게 된 경우
-
라.「근로기준법」 제53조에 따른 연장 근로의 제한을 위반한 경우
-
마. 사업장의 휴업으로 휴업 전 평균임금의 70퍼센트 미만을 지급받은 경우
2. 사업장에서 종교, 성별, 신체장애, 노조활동 등을 이유로 불합리한 차별대우를 받은 경우
3. 사업장에서 본인의 의사에 반하여 성희롱, 성폭력, 그 밖의 성적인 괴롭힘을 당한 경우
4. 사업장의 도산ㆍ폐업이 확실하거나 대량의 감원이 예정되어 있는 경우
5. 다음 각 목의 어느 하나에 해당하는 사정으로 사업주로부터 퇴직을 권고받거나, 인원 감축이 불가피하여
고용조정계획에 따라 실시하는 퇴직 희망자의 모집으로 이직하는 경우
-
가. 사업의 양도ㆍ인수ㆍ합병
-
나. 일부 사업의 폐지나 업종전환
-
다. 직제개편에 따른 조직의 폐지ㆍ축소
-
라. 신기술의 도입, 기술혁신 등에 따른 작업형태의 변경
-
마. 경영의 악화, 인사 적체, 그 밖에 이에 준하는 사유가 발생한 경우
6. 다음 각 목의 어느 하나에 해당하는 사유로 통근이 곤란(통근 시 이용할 수 있는 통상의 교통수단으로는 중 하나에
해당하는 사유로 통근이 곤란(통근 시 이용할 수 있는 통상의 교통수단으로는 사업장으로의 왕복에 드는 시간이
3시간 이상인 경우를 말한다)하게 된 경우
-
가. 사업장의 이전
-
나. 지역을 달리하는 사업장으로의 전근
-
다. 배우자나 부양하여야 할 친족과의 동거를 위한 거소 이전
-
라. 그 밖에 피할 수 없는 사유로 통근이 곤란한 경우
7. 부모나 동거 친족의 질병ㆍ부상 등으로 30일 이상 본인이 간호해야 하는 기간에 기업의 사정상 휴가나 휴직이
허용되지 않아 이직할 경우
8.「산업안전보건법」 제2조제7호에 따른 "중대재해"가 발생한 사업장으로서 그 재해와 관련된 고용노동부장관의
안전보건상의 시정명령을 받고도 시정기간까지 시정하지 아니하여 같은 재해 위험에 노출된 경우
9. 체력의 부족, 심신장애, 질병, 부상, 시력ㆍ청력ㆍ촉각의 감퇴 등으로 피보험자에게 주어진 업무를 수행하게 하는 것이
곤란하고, 기업의 사정상 업무종류의 전환이나 휴직이 허용되지 않아 이직한 것이 의사의 소견서, 사업주 의견 등에
근거하여 객관적으로 인정되는 경우
10. 임신, 출산, 만 8세 이하 또는 초등학교 2학년 이하의 자녀의 육아, 「병역법」에 따른 의무복무 등으로 업무를
계속적으로 수행하기 어려운 경우로서 사업주가 휴가나 휴직을 허용하지 않아 이직한 경우
11. 사업주의 사업 내용이 법령의 제정ㆍ개정으로 위법하게 되거나 취업 당시와는 달리 법령에서 금지하는 재화 또는
용역을 제조하거나 판매하게 된 경우
12. 정년의 도래나 계약기간의 만료로 회사를 계속 다닐 수 없게 된 경우
13. 그 밖에 피보험자와 사업장 등의 사정에 비추어 그러한 여건에서는 통상의 다른 근로자도 이직했을 것이라는
사실이 객관적으로 인정되는 경우
2019년 9월 16일 월요일
maven plugin 에러 : Multiple annotations found at this line:
1. 프로젝트 우클릭 > Run As > Maven Install
2. 이클립스 프로젝트 탐색기에서 해당 프로젝트 클릭 후 F5(새로고침)
3. 프로젝트 우클릭 > Maven > Update Project
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (execution: default-testCompile, phase: test-compile)
- CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved:
The following artifacts could not be resolved: org.apache.maven:maven-plugin-api:jar:2.0.9, org.apache.maven:maven-artifact:jar:2.0.9, org.codehaus.plexus:plexus-utils:jar:1.5.1, org.apache.maven:maven-core:jar:2.0.9, org.apache.maven:maven-settings:jar:
2.0.9, org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.9, org.apache.maven:maven-profile:jar:2.0.9, org.apache.maven:maven-model:jar:2.0.9, org.apache.maven:maven-repository-metadata:jar:2.0.9, org.apache.maven:maven-error-diagnostics:jar:
2.0.9, org.apache.maven:maven-project:jar:2.0.9, org.apache.maven:maven-plugin-registry:jar:2.0.9, org.apache.maven:maven-plugin-descriptor:jar:2.0.9, org.apache.maven:maven-artifact-manager:jar:2.0.9, org.apache.maven:maven-monitor:jar:2.0.9,
org.apache.maven:maven-toolchain:jar:1.0, org.apache.maven.shared:maven-shared-utils:jar:0.1, org.apache.maven.shared:maven-shared-incremental:jar:1.1, org.codehaus.plexus:plexus-compiler-api:jar:2.2, org.codehaus.plexus:plexus-compiler-manager:jar:2.2,
org.codehaus.plexus:plexus-compiler-javac:jar:2.2, org.codehaus.plexus:plexus-container-default:jar:1.5.5: Failure to transfer org.apache.maven:maven-plugin-api:jar:2.0.9 from https://repo.maven.apache.org/maven2 was cached in the local repository,
resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-plugin-api:jar:2.0.9 from/to central (https://repo.maven.apache.org/maven2):
repo.maven.apache.org
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (execution: default-compile, phase: compile)
- CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed
to collect dependencies at org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 -> org.apache.maven.shared:maven-shared-utils:jar:0.1: ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.shared:maven-shared-utils:jar:0.1:
ArtifactResolutionException: Failure to transfer org.apache.maven.shared:maven-shared-utils:pom:0.1 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has
elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.shared:maven-shared-utils:pom:0.1 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
2019년 8월 7일 수요일
티베로 lock 조회 및 kill
select sess_id, used_blk from v$transaction;
-- SID, 시리얼번호, SQL번호
select sid, serial#, sql_id, PREV_SQL_ID from v$session where sid = 388;
-----------------------------------------------
SID SERIAL# SQL_ID PREV_SQL_ID
388 1234567 <NULL> 9999
-----------------------------------------------
-- lock SQL 확인
select * from v$sqltext where sql_id= 9999;
-----------------------------------------------
-- kill 세션
alter system kill session( SID, SERIAL);
alter system kill session( 388, 19880409);