<%@ page contentType="text/html; charset=euc-kr"%>

<jsp:directive.page import="java.io.File" />
<jsp:directive.page import="java.io.FileInputStream" />
<jsp:directive.page import="java.util.*"/>
<jsp:directive.page import="org.kldp.ebmsh.moniter.failHandler.EngineFailMessageInfo"/>
<jsp:directive.page import="org.kldp.ebmsh.config.EbmsConstants"/>
<jsp:directive.page import="org.kldp.util.io.FileIoUtil"/>
<jsp:directive.page import="org.kldp.ebmsh.moniter.failHandler.*"/>

<jsp:directive.page import="org.kldp.ebmsh.moniter.permission.PermissionManager"/>
<jsp:directive.page import="org.kldp.ebmsh.config.EbmsConstants"/>

<%@ include file="/authorize/loginCheck.jsp" %>

<%@ include file="/setup/setupCheck.jsp" %>

<%
	String bizboxUrl = request.getParameter("bizboxUrl");

	// 실패 메시지 정보를 세션에 저장합니다.
	List<EngineFailMessageInfo> failMessageInfoList = (List<EngineFailMessageInfo>)session.getAttribute("engineFailMessageInfoList");
	
	String failMessageDirectory = EbmsConstants.messagePath + FileIoUtil.fileSeparatorAddOrNone("fail");
	
	// 메시지 처리 결과를 저장할 객체
	List<EngineFailMessageProcessResult> failMessageProcessResultList = new ArrayList<EngineFailMessageProcessResult>();
	
	
	for(int i = 0; i < failMessageInfoList.size(); i++) {
		FailMessageManager manager = new FailMessageManager();
	
		EngineFailMessageInfo failMessageInfo = failMessageInfoList.get(i);
	
		EngineFailMessageProcessResult failMessageProcessResult = manager.reProcessFailMessage(failMessageInfo.getFileName(), bizboxUrl);
		
		// 객체 저장
		failMessageProcessResultList.add(failMessageProcessResult);
	}
		
	// 세션에서 fail message 정보 삭제
	session.removeAttribute("engineFailMessageInfoList");
	
	// 세션에 fail message process result 정보 저장
	session.setAttribute("engineFailMessageProcessResultList", failMessageProcessResultList);
	
	response.sendRedirect("engineFailHandlerResult.jsp");
%>
