TimeOut Message

From JCFWiKi

Jump to: navigation, search

목차

[편집] sessiontimeout 설정

[편집] was에서 설정

    • tomcat의 경우 conf 폴더 밑에 web.xml에서 설정함 (기본값 30분)
 <session-config>
        <session-timeout>30</session-timeout>
    </session-config>

[편집] application내에서 설정

  • web/web-inf/web.xml에서 설정(was설정보다 우선함)
 <session-config>
        <session-timeout>30</session-timeout>
    </session-config>

[편집] 마이플렛폼에서 설정

  • pid 상에서 설정가능함.
  • 서버에 한번 요청을 한후 response가 오는 시간을 설정

[편집] spring security에서 세션timeout exception 잡아내기

  • exceptionTranslationFilter에서 authenticationEntryPoint property를 수정, 세션종료후 서버단 호출시 exception잡아서 loginFormUrl을 호출
  • loginFormUrl은 /commonJSP/loginError.jsp이며 jsp에서 에러코드를 던짐
  • applicationContext-security.xml 수정
  • filterInvocationInterceptor bean을 아래와 같이 수정하여 모든 action에 대해 spring security가 권한을 intercept 할수있도록 함
	<bean id="filterInvocationInterceptor"
			class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
			<property name="authenticationManager" ref="authenticationManager" />
		  	<property name="accessDecisionManager" ref="accessDecisionManager" />
 
		  	<!--with db//filterInvocationDefinitionSource -->
		  	  <!-- 
			<property name="objectDefinitionSource"><ref bean="filterInvocationDefinitionSource"/></property>
		
			 -->
			<property name="objectDefinitionSource">
				<value>
					CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
					PATTERN_TYPE_APACHE_ANT
				    /login.jsp*=ROLE_ANONYMOUS
				    /j_acegi_logout*=ROLE_ANONYMOUS
				    /login/*.action*=ROLE_ANONYMOUS
					<!-- test하는 모든 권한을 넣어주세요
						ex)/**/*.action=ROLE_COMMON_ADMIN,ROLE_CIMS_ADMIN,ROLE_ACC_ADMIN
					-->
				    /**/*.action=ROLE_COMMON_ADMIN				  		    
				</value>			 
			</property>
 
		</bean>
  • filterInvocationInterceptor bean에서 url 패턴별로 권한을 검사한 후 권한이 없는 요청이 왔을때 exceptionTranslationFilter에서 처리
<bean id="exceptionTranslationFilter"
		class="org.acegisecurity.ui.ExceptionTranslationFilter">
<!--부여받은 롤이 없어서 롤이 anonymous일때-->
		<property name="authenticationEntryPoint">
<bean class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
<property name="loginFormUrl" value="/commonJSP/loginError.jsp" />
<property name="serverSideRedirect" value="true"/>

</bean> </property> <!-- 권한이 anonymous가 아니지만 허락된 권한이 아닐떄--> <property name="accessDeniedHandler"> <bean class="org.acegisecurity.ui.AccessDeniedHandlerImpl"> <property name="errorPage" value="/commonJSP/loginError.jsp" /> </bean> </property>

</bean>

[편집] loginFormUrl에서 세션timeout 에러코드와 에러메세지 던지기

  • loginError.jsp
<%@page import="jcf.web.ux.miplatform.MiResponse"%>
<%@page contentType="text/html; charset=EUC-KR" %>
<% 	
		System.out.println("세션만료");
		
MiResponse res = new MiResponse(response);
res.error("-10000", "세션이 만료되었습니다.");
%>

[편집] 마이플렛폼에서 서버단 메세지 받기

[편집] Transaction 사용하여 서버에 호출하는 경우

  • 마이플렛폼 화면에서 서버호출 (예)용어사전 조회버튼 누를시
function menuFind()
{
Transaction(
"FIND",

"Common::term/findTerms.action", "", "ds_term=ds_term", "", "trancallback" );

}
  • 마이플렛폼 화면에서 서버호출 후 callback에서 에러처리
    • 에러코드를 잡에서 setMessage를 호출하고 에러코드가 양수일 경우 status bar에 메세지를 뿌려주는 postxxx()를 호출
function trancallback(trid, ErrorCode, ErrorMsg )
{
 
 if( trid == "save" )
	{
if( ErrorCode < 0 ) {
setMessage(ErrorMsg, "ALERT");
break;

}

postSave();
}


if( trid == "FIND" ) {

if( ErrorCode < 0 ){
setMessage(ErrorMsg, "ALERT");
break;

}

postFind();
} }

그림:check.gif

  • setMessage() 란?
    • JCF_JS::jcf_message.js 사용
    • setMessage(errorMeg, type);
    • type종류("ALERT","STARUS","CONFIRM")

[편집] srv_fn_AsyncCall사용하여 서버에 호출하는 경우

[편집] srv_fn_AsyncCall

그림:information.gif

  • srv_fn_AsyncCall()
    • 위치 : JCF_JS::lib_service.js
    • 역할: 비동기식 서버호출 , Progress UI(loading.xml) 보여줌, 서버 호출 후 errorcode 및 errorMsg 받아서 setMassage 해줌)
    • 특징: 단위화면에서 callback function으로 에러메세지처리 구현 하지 않아도 됨.
/******************************************************************
 * 입력: svcid		: svcid
         svcName	: Transaction코드
         InData		: Input Dataset List
         OutData	: Output Dataset List
         arg		: 처리하고자할 argument
         Result		: 서비스후에 처리할 Function
 * return    	    : 처리 결과 Dataset
 * ex : srv_fn_AsyncCall("select","KCAE01_MVCColsSelect.jsp","",args_out,args_mvs,"fnCallBack");
******************************************************************/
function srv_fn_AsyncCall(svcid,svcName,InData,OutData,arg,Result,Progress)
{
	SetWaitCursor(true);
	SetCapture();
	global.MainFrame.enable = false;
	//alert(Progress);
	if(Progress == true) {		
		objProgress = object("DivProgress");
		if(!isValidObject(objProgress)) {
			objProgress = Create("Div","DivProgress",'Url="CommonGroup::Loading.xml" width="0" height="0" Visible=false');
		}
		objProgress.Width = nProgWidth;
		objProgress.Height = nProgHeight;
		objProgress.Left = srv_fn_GetProgLeft();
		objProgress.Top = srv_fn_GetProgTop();
		objProgress.Visible = true;
	}
 
	scmv_userFunc = Result;
	Transaction(svcid,svcName,InData,OutData,arg,"srv_fn_Result");
	}
}
 
function srv_fn_GetProgLeft()
{
	return (this.Width / 2) - (nProgWidth / 2);
}
 
function srv_fn_GetProgTop()
{
	return (this.Height / 2) - (nProgHeight / 2);
}
 
/******************************************************************
 * Async Transaction 결과
 *****************************************************************/
function srv_fn_Result(TrID,strErrCode,strErrorMsg)
{
	if(objProgress.Visible == true) objProgress.Visible = false;
	global.MainFrame.enable = true;
	ReleaseCapture();
	SetWaitCursor(false);
	// session time out (재로그인)
	if(toNumber(strErrCode) == -10000)
	{
if(JSESSIONID != "timeout") {
JSESSIONID = "timeout";
alert(strErrorMsg);
}
return;
}

// no authority - 권한 없음(로그아웃) if(toNumber(strErrCode) == -20000) { // 권한 없음 처리 로직을 넣으세요... return; } // Exception 처리 if(toNumber(strErrCode) == -70000) { // Exception 처리 로직을 넣으세요... return; } if(toNumber(strErrCode) < 0 && toNumber(strErrCode) > -1000000000) { //alert(strErrCode); alert(strErrorMsg); } if(length(scmv_userFunc) == 0) return; var ExprCall = scmv_userFunc + '(TrID, strErrCode, strErrorMsg)'; eval(ExprCall);

}
  • srv_fn_AsyncCall 사용하여 마이플렛폼 화면에서 서버호출 (예)용어사전 조회버튼 누를시
function menuFind()
{
srv_fn_AsyncCall(
"FIND",

"Common::term/findTerms.action", "", "ds_term=ds_term", "", "trancallback", true);

}