이노릭스 커밋
28
pom.xml
@ -514,7 +514,35 @@
|
||||
<artifactId>commons-dbutils</artifactId>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-compress</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>InnorixJAVA</groupId>
|
||||
<artifactId>InnorixJAVA</artifactId>
|
||||
<version>r2146</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>JSON-java</groupId>
|
||||
<artifactId>JSON-java</artifactId>
|
||||
<version>1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
|
||||
<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
|
||||
@ -100,5 +100,6 @@
|
||||
<mvc:resources mapping="/codemirror/**" location="/codemirror/" />
|
||||
<mvc:resources mapping="/AnySign4PC/**" location="/AnySign4PC/" />
|
||||
<mvc:resources mapping="/html/**" location="/html/" />
|
||||
<mvc:resources mapping="/innorix_2/**" location="/innorix_2/" />
|
||||
|
||||
</beans>
|
||||
@ -0,0 +1,171 @@
|
||||
<li class="subTab_b">
|
||||
<div class="apl_title">
|
||||
<button type="button" class="btn_apl_slide" onclick="aplSlide(this);">
|
||||
신청인" + areaCount2 + " <i class="icon slide up"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn_text btn_35 darkblue_border btn_delete_apl" onclick="removeLi(this);" title="신청인1 삭제">신청인 삭제</button>
|
||||
</div>
|
||||
<div class="table_type_rows apl_info_input">
|
||||
<table>
|
||||
<colgroup>
|
||||
<col style="width:200px;">
|
||||
<col style="width:auto;">
|
||||
<col style="width:200px;">
|
||||
<col style="width:auto;">
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>
|
||||
<p class="required_text">*<span>필수입력</span></p>상호
|
||||
</th>
|
||||
<td>
|
||||
<input name="applcntCompany_" + areaCount2 + " type="text" id="applcntCompany_" + areaCount2 + " maxlength="100" class="input_text w100per applcntCompany">
|
||||
</td>
|
||||
<th>
|
||||
<p class="required_text">*<span>필수입력</span></p>대표자
|
||||
</th>
|
||||
<td>
|
||||
<input name="companyCeo_" + areaCount2 + " type="text" id="companyCeo_" + areaCount2 + " class="input_text w100per companyCeo" maxlength="25">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<p class="required_text">*<span>필수입력</span></p>개인/법인
|
||||
</th>
|
||||
<td colspan="3">
|
||||
<select name="companyGubun_" + areaCount2 + " id="companyGubun_" + areaCount2 + " class="select companyGubun" title="개인/법인 선택">
|
||||
<option value="">선택하세요</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<p class="required_text">*<span>필수입력</span></p>우편번호
|
||||
</th>
|
||||
<td colspan="3">
|
||||
<ul class="input_box postcode_input">
|
||||
<li>
|
||||
<input name="addrZip_" + areaCount2 + " id="addrZip_" + areaCount2 + " type="text" class="input_text addrZip" readonly="readonly" title="우편번호 입력">
|
||||
</li>
|
||||
<li>
|
||||
<button type="button" class="btn btn_text darkblue_border btn_40" onclick="goJuso('A_${sts.index+1}');">우편번호검색</button>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" id="s_foreignCountry" name="s_foreignCountry-" + areaCount2 + " value="Y" class="checkbox" ><label for="s_foreignCountry">해외시 체크해주세요.</label>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="cf_text small color_red">*우편물(공문)을 수령할 수 있는 자택/사업장 주소를 기입 바랍니다.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<p class="required_text">*<span>필수입력</span></p>도로명 주소
|
||||
</th>
|
||||
<td colspan="3">
|
||||
<ul class="input_box address_input">
|
||||
<li>
|
||||
<input name="roadAddr1_" + areaCount2 + " type="text" id="roadAddr1_" + areaCount2 + " class="input_text" readonly="readonly">
|
||||
</li>
|
||||
<li>
|
||||
<input name="roadAddr2_" + areaCount2 + " type="text" id="roadAddr2_" + areaCount2 + " class="input_text" maxlength="250">
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<p class="required_text">*<span>필수입력</span></p>이메일
|
||||
</th>
|
||||
<td colspan="3">
|
||||
<div class="email_wrap">
|
||||
<input type="text" class="input_text input_email email1" name="clientEmail1_" + areaCount2 + " id="clientEmail1_" + areaCount2 + " maxlength="25" title="이메일 공급자 입력">
|
||||
@
|
||||
<input type="text" class="input_text input_email email2" name="hidEmail2_" + areaCount2 + " id="hidEmail2_" + areaCount2 + " maxlength="23" title="이메일 공급자 입력">
|
||||
<select name="clientEmail2_" + areaCount2 + " id="clientEmail2_" + areaCount2 + " class="select email_select" title="이메일 공급자 선택" onchange="email_change(" + areaCount2 + ");">
|
||||
<option value="0">직접입력</option>
|
||||
<option value="chol.com">chol.com</option>
|
||||
<option value="daum.net">daum.net</option>
|
||||
<option value="dreamwiz.com">dreamwiz.com</option>
|
||||
<option value="empal.com">empal.com</option>
|
||||
<option value="freechal.com">freechal.com</option>
|
||||
<option value="gmail.com">gmail.com</option>
|
||||
<option value="hanafos.com">hanafos.com</option>
|
||||
<option value="hanmir.com">hanmir.com</option>
|
||||
<option value="hitel.com">hitel.com</option>
|
||||
<option value="hotmail.com">hotmail.com</option>
|
||||
<option value="korea.com">korea.com</option>
|
||||
<option value="lycos.co.kr">lycos.co.kr</option>
|
||||
<option value="nate.com">nate.com</option>
|
||||
<option value="naver.com">naver.com</option>
|
||||
<option value="netian.com">netian.com</option>
|
||||
<option value="paran.com">paran.com</option>
|
||||
<option value="yahoo.com">yahoo.com</option>
|
||||
<option value="yahoo.co.kr">yahoo.co.kr</option>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<p class="required_text">*<span>필수입력</span></p>휴대폰
|
||||
</th>
|
||||
<td>
|
||||
<div class="phone_wrap">
|
||||
<select name="tel1_" + areaCount2 + " id="tel1_" + areaCount2 + " title="핸드폰 첫번째 자리 선택" class="select">
|
||||
<option value="010">010</option>
|
||||
<option value="011">011</option>
|
||||
<option value="016">016</option>
|
||||
<option value="017">017</option>
|
||||
<option value="018">018</option>
|
||||
<option value="019">019</option>
|
||||
<option value="070">070</option>
|
||||
<option value="02">02</option>
|
||||
<option value="031">031</option>
|
||||
<option value="032">032</option>
|
||||
<option value="033">033</option>
|
||||
<option value="041">041</option>
|
||||
<option value="042">042</option>
|
||||
<option value="043">043</option>
|
||||
<option value="044">044</option>
|
||||
<option value="051">051</option>
|
||||
<option value="052">052</option>
|
||||
<option value="053">053</option>
|
||||
<option value="054">054</option>
|
||||
<option value="055">055</option>
|
||||
<option value="061">061</option>
|
||||
<option value="062">062</option>
|
||||
<option value="063">063</option>
|
||||
<option value="064">064</option>
|
||||
<option value="" selected="selected">없음</option>
|
||||
</select> -
|
||||
<input name="tel2_" + areaCount2 + " type="text" id="tel2_" + areaCount2 + " class="input_text tel2" title="대표 전화번호 중간번호" maxlength="4" onkeyup="removeChar(event);" onkeydown='onlyNumber(event);' style="ime-mode:disabled;" title="핸드폰 가운데 자리 입력">
|
||||
-
|
||||
<input name="tel3_" + areaCount2 + " type="text" id="tel3_" + areaCount2 + " class="input_text tel3" title="대표 전화번호 끝번호" maxlength="4" onkeyup="removeChar(event);" onkeydown='onlyNumber(event);' style="ime-mode:disabled;" title="핸드폰 마지막 자리 입력">
|
||||
</div>
|
||||
</td>
|
||||
<th>FAX</th>
|
||||
<td>
|
||||
<div class="phone_wrap fax_wrap">
|
||||
<input name="fax1_" + areaCount2 + " type="text" id="20" class="input_text" title="팩스 앞 자리 입력" maxlength="3" onkeyup="removeChar(event);" onkeydown='onlyNumber(event);' style="ime-mode:disabled;">-
|
||||
<input name="fax2_" + areaCount2 + " type="text" id="" class="input_text" title="팩스 가운데 자리 입력" maxlength="4" onkeyup="removeChar(event);" onkeydown='onlyNumber(event);' style="ime-mode:disabled;">-
|
||||
<input name="fax3_" + areaCount2 + " type="text" id="" class="input_text" title="팩스 마지막 자리 입력" maxlength="4" onkeyup="removeChar(event);" onkeydown='onlyNumber(event);' style="ime-mode:disabled;">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<p class="required_text">*<span>필수입력</span></p>사업자등록번호<br>('-'제외)
|
||||
</th>
|
||||
<td>
|
||||
<input name="bizrNo_" + areaCount2 + " type="text" id="bizrNo_" + areaCount2 + " class="input_text w100per bizrNo" maxlength="15" onkeyup="removeChar(event);" onkeydown='onlyNumber(event);' style="ime-mode:disabled;" title="사업자등록번호 입력">
|
||||
</td>
|
||||
<th>법인등록번호<br>('-'제외)</th>
|
||||
<td>
|
||||
<input name="cprNo_" + areaCount2 + " type="text" id="22" class="input_text w100per" maxlength="15" onkeyup="removeChar(event);" onkeydown='onlyNumber(event);' style="ime-mode:disabled;" title="법인등록번호 입력">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</li>
|
||||
@ -1940,6 +1940,57 @@ String captchaChk = SeedUtils.setReplaceNull(seedProperties.getConfigValue("capt
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!여기까지 step01
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="tip q11"><span class="tip_con">조정유형 : 분쟁조정에 필요한 최소한의 정보(성명, 연락처, 주소 등)는 당사자 및 </span></div>
|
||||
<div class="tip q12"><span class="tip_con">신청사유 : 계약상대방의 불공정거래행위 유형을 선택하되, 해당 행위가 복수인 경우 피해금액이 가장 큰 유형을 먼저 선택합니다. (신청사유는 최대 3개까지 선택할 수 있습니다.)</span></div>
|
||||
<div class="tip q13"><span class="tip_con">상호 : 계약당사자가 개인사업자의 경우 사업자등록증 상의 상호를, 법인사업자인 경우 법인등기부등본 상의 법인명을 기재하시기 바랍니다. </span></div>
|
||||
@ -2371,6 +2422,26 @@ String captchaChk = SeedUtils.setReplaceNull(seedProperties.getConfigValue("capt
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!여기까지 step01
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="tip q11"><span class="tip_con">조정유형 : 분쟁조정에 필요한 최소한의 정보(성명, 연락처, 주소 등)는 당사자 및 </span></div>
|
||||
<div class="tip q12"><span class="tip_con">신청사유 : 계약상대방의 불공정거래행위 유형을 선택하되, 해당 행위가 복수인 경우 피해금액이 가장 큰 유형을 먼저 선택합니다. (신청사유는 최대 3개까지 선택할 수 있습니다.)</span></div>
|
||||
<div class="tip q13"><span class="tip_con">상호 : 계약당사자가 개인사업자의 경우 사업자등록증 상의 상호를, 법인사업자인 경우 법인등기부등본 상의 법인명을 기재하시기 바랍니다. </span></div>
|
||||
|
||||
48
src/main/webapp/innorix_2/exam/autoAddFiles.html
Normal file
@ -0,0 +1,48 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl',
|
||||
installUrl: '../install/install.html',
|
||||
uploadUrl: './upload.jsp'
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
};
|
||||
|
||||
function addFiles() {
|
||||
var fileArray = new Array();
|
||||
// 자동으로 추가할 사용자측 파일목록 구성
|
||||
var fileObj = new Object();
|
||||
fileObj.filePath = "c:\\windows\\notepad.exe",
|
||||
fileObj.fileSize = "246784",
|
||||
|
||||
fileArray.push(fileObj);
|
||||
|
||||
control.addFiles(fileArray); // 리스트 컨트롤에 파일 추가
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="파일 자동추가" onclick="addFiles();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
1
src/main/webapp/innorix_2/exam/combine.html
Normal file
@ -0,0 +1 @@
|
||||
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../innorix.css">
<script src="../innorix.js"></script>
<script>
var control = new Object();
window.onload = function() {
// 파일전송 컨트롤 생성
control = innorix.create({
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
transferMode: 'both', // 업로드, 다운로드 혼합사용
installUrl: '../install/install.html', // Agent 설치 페이지
uploadUrl: './upload.jsp' // 업로드 URL
});
// 업로드 완료 이벤트
control.on('uploadComplete', function (p) {
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
var fileArray = new Array();
var f = p.files;
for (var i = 0; i < f.length; i++ ) {
var fileObj = new Object();
fileObj.printFileName = f[i].clientFileName;
fileObj.fileSize = f[i].fileSize;
fileObj.downloadUrl = urlBase + "download.jsp?fileName=" + f[i].serverFileName;
fileArray.push(fileObj);
}
console.log(fileArray);
control.removeAllFiles(); // 리스트 컨트롤에서 파일을 삭제
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
});
};
</script>
</head>
<body>
<a href="../index.html">← 예제 목록</a><br /><br />
<div id="fileControl"></div><br/>
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
<input type="button" value="업로드" onclick="control.upload();"/> |
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();"/>
<input type="button" value="전체 다운로드" onclick="control.download();"/>
</body>
</html>
|
||||
53
src/main/webapp/innorix_2/exam/download.html
Normal file
@ -0,0 +1,53 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html' // Agent 설치 페이지
|
||||
});
|
||||
|
||||
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP Brochure.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP パンフレット.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||
}]);
|
||||
});
|
||||
};
|
||||
|
||||
function getFileCount(){
|
||||
var fileCount = control.getFileCount();
|
||||
alert("allFileCount" + "\n" + fileCount);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
<input type="button" value="getFileCount" onClick="getFileCount();"/>
|
||||
</body>
|
||||
</html>
|
||||
144
src/main/webapp/innorix_2/exam/download.jsp
Normal file
@ -0,0 +1,144 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||
<%@ page import="java.io.*" %>
|
||||
|
||||
<%
|
||||
out.clear();
|
||||
out = pageContext.pushBody();
|
||||
|
||||
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||
|
||||
/*
|
||||
filePath
|
||||
파일이 저장된 스토리지 전체경로
|
||||
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||
윈도우 - C:/storage/path1/path2/data
|
||||
유닉스 - /storage/path1/path2/data
|
||||
*/
|
||||
|
||||
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||
String szStartOffset = request.getParameter("_StartOffset");
|
||||
String szEndOffset = request.getParameter("_EndOffset");
|
||||
|
||||
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||
String fileID = request.getParameter("fileID");
|
||||
String fileName = request.getParameter("fileName");
|
||||
String sysFileName = new String();
|
||||
String orgFileName = new String();
|
||||
String htmlMode = request.getParameter("_Html5");
|
||||
|
||||
if (fileID != null) {
|
||||
if (fileID.equals("1")) {
|
||||
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||
}
|
||||
|
||||
if (fileID.equals("2")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP Brochure.pdf";
|
||||
}
|
||||
|
||||
if (fileID.equals("3")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||
}
|
||||
}
|
||||
|
||||
if (fileName != null) {
|
||||
sysFileName = "data/" + fileName;
|
||||
orgFileName = fileName;
|
||||
}
|
||||
|
||||
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
|
||||
File file = new File(filePath + sysFileName);
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||
|
||||
long startOffset = 0;
|
||||
long endOffset = 0;
|
||||
|
||||
if (szStartOffset != null) {
|
||||
startOffset = Long.parseLong(szStartOffset);
|
||||
}
|
||||
|
||||
if (szEndOffset != null) {
|
||||
endOffset = Long.parseLong(szEndOffset);
|
||||
}
|
||||
|
||||
long contentLength = 0;
|
||||
|
||||
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||
contentLength = endOffset - startOffset + 1;
|
||||
} else { // html 일반 다운로드 요청시
|
||||
contentLength = file.length();
|
||||
}
|
||||
|
||||
response.setHeader("Content-Length", "" + contentLength);
|
||||
|
||||
byte b[] = new byte[8192];
|
||||
BufferedInputStream input = null;
|
||||
BufferedOutputStream output = null;
|
||||
|
||||
try {
|
||||
input = new BufferedInputStream(new FileInputStream(file));
|
||||
output = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
int read = 0;
|
||||
|
||||
if (startOffset != 0) {
|
||||
long n = input.skip(startOffset);
|
||||
if (n == -1) read = -1;
|
||||
}
|
||||
|
||||
if(contentLength > 0) {
|
||||
while (contentLength > 0) {
|
||||
if(contentLength < 8192) {
|
||||
b = new byte[(int)contentLength];
|
||||
}
|
||||
|
||||
read = input.read(b);
|
||||
|
||||
if(read == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
output.write(b, 0, read);
|
||||
contentLength = contentLength - read;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("fileID \t: " + fileID);
|
||||
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||
System.out.println("totalLength \t: " + file.length() );
|
||||
System.out.println("startOffset \t: " + startOffset);
|
||||
System.out.println("endOffset \t: " + endOffset);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(output != null) {
|
||||
output.flush();
|
||||
output.close();
|
||||
}
|
||||
|
||||
if(input != null) {
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private String delimiterReplace(String fullDir)
|
||||
{
|
||||
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||
|
||||
return ret2;
|
||||
}
|
||||
%>
|
||||
121
src/main/webapp/innorix_2/exam/downloadCustomTable.html
Normal file
@ -0,0 +1,121 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style>
|
||||
button { font-size:9pt; }
|
||||
table.fileTable {
|
||||
width: 500px;
|
||||
font-size: 9pt;
|
||||
color: #333333;
|
||||
border-width: 1px;
|
||||
border-color: #c0c0c0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.fileTable th {
|
||||
border-width: 1px;
|
||||
padding: 8px;
|
||||
border-style: solid;
|
||||
border-color: #c0c0c0;
|
||||
background-color: #dedede;
|
||||
}
|
||||
table.fileTable td {
|
||||
border-width: 1px;
|
||||
padding: 8px;
|
||||
border-style: solid;
|
||||
border-color: #c0c0c0;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
#fileTable tr > .fileInfo { display:none; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
var control = new Object(); // 파일전송 컨트롤
|
||||
|
||||
innoJquery(document).ready(function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html' // Agent 설치 페이지
|
||||
});
|
||||
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
for (var i=1; i<4; i++) {
|
||||
var _filePath = urlBase + "download.jsp?fileID=" + i;
|
||||
var _fileSize = 1433885;
|
||||
var _fileType = "normal";
|
||||
|
||||
var fileName = i + ". INNORIX WP 소개서.pdf";
|
||||
var fileSize = bytesToSize(_fileSize);
|
||||
var fileType = "일반";
|
||||
|
||||
// 다운로드 파일 목록을 커스텀 테이블에 추가
|
||||
innoJquery('#fileTable > tbody:last').append(' \
|
||||
<tr class="fileTable"> \
|
||||
<td class="fileInfo">' + _filePath + '</td> \
|
||||
<td class="fileInfo">' + _fileSize + '</td> \
|
||||
<td class="fileInfo">' + _fileType + '</td> \
|
||||
<td>' + fileName + '</td> \
|
||||
<td>' + fileSize + '</td> \
|
||||
<td>' + fileType + '</td> \
|
||||
</tr> \
|
||||
');
|
||||
}
|
||||
});
|
||||
|
||||
// 파일 사이즈 bytes 를 KB, MB... 형식으로 변환
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
||||
if (bytes == 0) return 'n/a';
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
if (i == 0) return bytes + ' ' + sizes[i];
|
||||
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
|
||||
}
|
||||
|
||||
// 커스텀 테이블 파일 정보를 확인
|
||||
function getTableFiles() {
|
||||
var tbl = innoJquery('#fileTable tr:has(td)').map(function(i, v) {
|
||||
var innoJquerytd = innoJquery('td', this);
|
||||
return {
|
||||
downloadUrl: innoJquerytd.eq(0).text(),
|
||||
fileSize: Number(innoJquerytd.eq(1).text()),
|
||||
printFileName: innoJquerytd.eq(3).text()
|
||||
}
|
||||
}).get();
|
||||
|
||||
return tbl;
|
||||
}
|
||||
|
||||
// 다운로드 실행
|
||||
function download(obj, type) {
|
||||
control.removeAllFiles(); // 이전에 컨트롤에 담겨진 파일정보 모두 삭제
|
||||
var data = getTableFiles(); // 커스텀 테이블로부터 파일 다운로드 정보 얻어옴
|
||||
control.presetDownloadFiles(data); // 커스텀 테이블의 파일정보를 컨트롤에 추가
|
||||
setTimeout(function(){ control.download(); }, 500);
|
||||
}
|
||||
</script>
|
||||
|
||||
<head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<table id="fileTable" class="fileTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="fileInfo">filePath</th>
|
||||
<th class="fileInfo">fileSize</th>
|
||||
<th class="fileInfo">fileType</th>
|
||||
<th>파일명</th>
|
||||
<th>용량</th>
|
||||
<th>구분</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
|
||||
<div id="fileControl" style="display:none"></div><br/>
|
||||
|
||||
<input type="button" value="모든파일 다운로드" onclick="download();"/>
|
||||
</body>
|
||||
</html>
|
||||
61
src/main/webapp/innorix_2/exam/downloadMulti.html
Normal file
@ -0,0 +1,61 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control1 = new Object();
|
||||
var control2 = new Object();
|
||||
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
|
||||
window.onload = function() {
|
||||
|
||||
// 파일전송 컨트롤 생성
|
||||
control1 = innorix.create({
|
||||
el: '#fileControl1',
|
||||
installUrl: '../install/install.html' // Agent 설치 페이지
|
||||
});
|
||||
|
||||
control2 = innorix.create({
|
||||
el: '#fileControl2',
|
||||
installUrl: '../install/install.html'
|
||||
});
|
||||
|
||||
control1.on('loadComplete', function (p) {
|
||||
control1.presetDownloadFiles([{
|
||||
printFileName: "INNORIX WEB PAGES 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WEB PAGES Brochure.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||
}]);
|
||||
});
|
||||
|
||||
control2.on('loadComplete', function (p) {
|
||||
control2.presetDownloadFiles([{
|
||||
printFileName: "INNORIX WEB PAGES パンフレット.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||
}]);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl1"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control1.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control1.download();"/><br /><br />
|
||||
|
||||
<div id="fileControl2"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control2.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control2.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
49
src/main/webapp/innorix_2/exam/dropZone.html
Normal file
@ -0,0 +1,49 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
window.onload = function() {
|
||||
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
// 특정 html 객체를 파일추가용 DropZone 으로 활성
|
||||
innoJquery("#dropZone").on({
|
||||
"dragenter": function(innoJqueryevt) {
|
||||
control.setDropZone(innoJqueryevt, this);
|
||||
}
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<table id="dropZone" style="width:555px; height:150px; border: 1px solid green">
|
||||
<tr><td align="center">Drop files and folders here</td></tr>
|
||||
</table><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
1
src/main/webapp/innorix_2/exam/edit.html
Normal file
1
src/main/webapp/innorix_2/exam/html5Combine.html
Normal file
@ -0,0 +1 @@
|
||||
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../innorix.css">
<script src="../innorix.js"></script>
<script>
var control = new Object();
window.onload = function() {
// 파일전송 컨트롤 생성
control = innorix.create({
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
transferMode: 'both', // 업로드, 다운로드 혼합사용
agent: false, // true = Agent 설치, false = html5 모드 사용
installUrl: '../install/install.html', // Agent 설치 페이지
uploadUrl: './upload.jsp' // 업로드 URL
});
// 업로드 완료 이벤트
control.on('uploadComplete', function (p) {
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
var fileArray = new Array();
var f = p.files;
for (var i = 0; i < f.length; i++ ) {
var fileObj = new Object();
fileObj.printFileName = f[i].clientFileName;
fileObj.fileSize = f[i].fileSize;
fileObj.downloadUrl = urlBase + "download.jsp?fileName=" + f[i].serverFileName;
fileArray.push(fileObj);
}
control.removeAllFiles(); // 파일을 삭제
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
});
};
</script>
</head>
<body>
<a href="../index.html">← 예제 목록</a><br /><br />
<div id="fileControl"></div><br/>
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
<input type="button" value="업로드" onclick="control.upload();"/> |
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();"/>
<input type="button" value="전체 다운로드" onclick="control.download();"/>
</body>
</html>
|
||||
47
src/main/webapp/innorix_2/exam/html5Download.html
Normal file
@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
agent: false, // true = Agent 설치, false = html5 모드 사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
});
|
||||
|
||||
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP Brochure.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP パンフレット.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||
}]);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
37
src/main/webapp/innorix_2/exam/html5Upload.html
Normal file
@ -0,0 +1,37 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
agent: false, // true = Agent 설치, false = html5 모드 사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
1
src/main/webapp/innorix_2/exam/index.html
Normal file
@ -0,0 +1 @@
|
||||
<script>location.href="../index.html";</script>
|
||||
78
src/main/webapp/innorix_2/exam/installCheck.html
Normal file
@ -0,0 +1,78 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
|
||||
window.onload = function() {
|
||||
// 강제 html5 모드여부 확인
|
||||
var useHtml5 = !!(getCookie("forceHtml5Mode"));
|
||||
|
||||
// agent 설치 URL
|
||||
var installUrl = "../install/install.html?redirect="+ encodeURIComponent("http://innorix.com");
|
||||
|
||||
// 강제 html5 모드가 아니면
|
||||
|
||||
if (useHtml5 != true) {
|
||||
// agent 설치 또는 버전체크
|
||||
innorix.checkVersion(function (result) {
|
||||
if (result != true) {
|
||||
location.href = installUrl;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: installUrl,
|
||||
uploadUrl: './upload.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
};
|
||||
|
||||
function getCookie( name ) {
|
||||
var nameOfCookie = name + "=", endOfCookie, x = 0;
|
||||
|
||||
while ( x <= document.cookie.length ) {
|
||||
var y = (x+nameOfCookie.length);
|
||||
if ( document.cookie.substring( x, y ) == nameOfCookie ) {
|
||||
if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
|
||||
endOfCookie = document.cookie.length;
|
||||
return unescape( document.cookie.substring( y, endOfCookie ) );
|
||||
}
|
||||
x = document.cookie.indexOf( " ", x ) + 1;
|
||||
if ( x === 0 )
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function setCookie( name, value, expiredays ) {
|
||||
var todayDate = new Date();
|
||||
todayDate.setDate( todayDate.getDate() + expiredays);
|
||||
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" ;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
<input type="button" value="forceHtml5Mode 쿠키삭제" onclick="setCookie('forceHtml5Mode', false, 0);"/>
|
||||
</body>
|
||||
</html>
|
||||
53
src/main/webapp/innorix_2/exam/postParam.html
Normal file
@ -0,0 +1,53 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
};
|
||||
|
||||
function upload() {
|
||||
var postObj = new Object();
|
||||
postObj.type = "t31",
|
||||
postObj.part = "p25"
|
||||
|
||||
/*
|
||||
postObj =
|
||||
{
|
||||
type : "t31",
|
||||
part : "p25",
|
||||
}
|
||||
*/
|
||||
|
||||
control.setPostData(postObj); // 업로드시 함께 전달될 POST Param 추가
|
||||
control.upload(); // 업로드 시작
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
18
src/main/webapp/innorix_2/exam/result.jsp
Normal file
@ -0,0 +1,18 @@
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<%
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
java.util.Enumeration names = request.getParameterNames();
|
||||
|
||||
while (names.hasMoreElements()) {
|
||||
String name = (String)names.nextElement();
|
||||
String values[] = request.getParameterValues(name);
|
||||
|
||||
if (values != null) {
|
||||
for (int i=0; i< values.length; i++) {
|
||||
System.out.println ( i + ". " + name + " = " + values[i]);
|
||||
out.println ( i + ". " + name + " = " + values[i] + "<br />");
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
BIN
src/main/webapp/innorix_2/exam/sample-file.pdf
Normal file
49
src/main/webapp/innorix_2/exam/upload.html
Normal file
@ -0,0 +1,49 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
|
||||
var files = JSON.stringify(f);
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||
innoJquery('form#f_write').submit();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||
test1 : <input type="text" name="test1" />
|
||||
</form><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
67
src/main/webapp/innorix_2/exam/upload.jsp
Normal file
@ -0,0 +1,67 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||
|
||||
<%
|
||||
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||
if (request.getMethod().equals("POST"))
|
||||
{
|
||||
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||
int maxPostSize = 2147482624; // bytes
|
||||
|
||||
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||
|
||||
/*
|
||||
전달되는 _action Param 정보
|
||||
speedCheck : 전송속도 측정
|
||||
getServerInfo : 서버정보 확인
|
||||
getFileInfo : 파일정보 확인
|
||||
attachFile : 파일전송 진행
|
||||
attachFileCompleted : 파일전송 완료
|
||||
*/
|
||||
|
||||
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||
String _type = uploader.getParameter("type"); // 커스텀 정의 POST Param 1
|
||||
String _part = uploader.getParameter("part"); // 커스텀 정의 POST Param 2
|
||||
String _transferId = uploader.getParameter("_transferId"); // TransferId
|
||||
String _run_retval = uploader.run();
|
||||
|
||||
// 개별파일 업로드 완료
|
||||
if (uploader.isUploadDone()) {
|
||||
/*
|
||||
System.out.println("========== uploader.isUploadDone() " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("_orig_filename \t = " + _orig_filename);
|
||||
System.out.println("_new_filename \t = " + _new_filename);
|
||||
System.out.println("_filesize \t = " + _filesize);
|
||||
System.out.println("_filepath \t = " + _filepath);
|
||||
System.out.println("_el \t = " + _el);
|
||||
*/
|
||||
}
|
||||
|
||||
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("_action \t = " + _action);
|
||||
System.out.println("_run_retval \t = " + _run_retval);
|
||||
System.out.println("_orig_filename \t = " + _orig_filename);
|
||||
System.out.println("_new_filename \t = " + _new_filename);
|
||||
System.out.println("_filesize \t = " + _filesize);
|
||||
System.out.println("_start_offset \t = " + _start_offset);
|
||||
System.out.println("_end_offset \t = " + _end_offset);
|
||||
System.out.println("_filepath \t = " + _filepath);
|
||||
System.out.println("_el \t = " + _el);
|
||||
System.out.println("_type \t = " + _type);
|
||||
System.out.println("_part \t = " + _part);
|
||||
}
|
||||
|
||||
// CORS 관련 헤더 추가
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||
%>
|
||||
164
src/main/webapp/innorix_2/exam/uploadCustomTable.html
Normal file
@ -0,0 +1,164 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style>
|
||||
button { font-size:9pt; }
|
||||
table.fileTable {
|
||||
width: 500px;
|
||||
font-size: 9pt;
|
||||
color: #333333;
|
||||
border-width: 1px;
|
||||
border-color: #c0c0c0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.fileTable th {
|
||||
border-width: 1px;
|
||||
padding: 8px;
|
||||
border-style: solid;
|
||||
border-color: #c0c0c0;
|
||||
background-color: #dedede;
|
||||
}
|
||||
table.fileTable td {
|
||||
border-width: 1px;
|
||||
padding: 8px;
|
||||
border-style: solid;
|
||||
border-color: #c0c0c0;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
#fileTable tr > .fileInfo { display:none; }
|
||||
</style>
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
var control = new Object(); // 파일전송 컨트롤
|
||||
var tableRowInsert = true; // 파일 추가시 커스텀 테이블에 정보전달 여부
|
||||
|
||||
innoJquery(document).ready(function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
innoJquery("#dropZone").on({ // 외부 HTML 객체 DropZone 활성
|
||||
"dragenter": function(innoJqueryevt) {
|
||||
control.setDropZone(innoJqueryevt, this); // DropZone 으로 지정
|
||||
}
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
|
||||
// 파일을 추가후 발생 이벤트
|
||||
control.on('afterAddFiles', function (p) {
|
||||
|
||||
// 커스텀 테이블 사용하는 경우 선택된 파일정보 전달
|
||||
if (tableRowInsert == true) {
|
||||
for (var i = 0; i < p.length; i++ ) {
|
||||
|
||||
var _filePath = p[i].filePath;
|
||||
var _fileSize = p[i].fileSize;
|
||||
var _fileID = p[i].id;
|
||||
var _fileType = "normal";
|
||||
|
||||
var arr = (_filePath.replace(/\\/gi,"/")).split("/");
|
||||
var fileName = arr[arr.length-1];
|
||||
var fileSize = bytesToSize(_fileSize);
|
||||
var fileType = "일반";
|
||||
|
||||
if (_fileSize > 104857600) {
|
||||
var _fileType = "large";
|
||||
var fileType = "대용량";
|
||||
}
|
||||
|
||||
// 선택된 파일을 커스텀 테이블에 추가
|
||||
innoJquery('#fileTable > tbody:last').append(' \
|
||||
<tr class="fileTable"> \
|
||||
<td class="fileInfo">' + _filePath + '</td> \
|
||||
<td class="fileInfo">' + _fileSize + '</td> \
|
||||
<td class="fileInfo">' + _fileType + '</td> \
|
||||
<td>' + fileName + '</td> \
|
||||
<td>' + fileSize + '</td> \
|
||||
<td>' + fileType + '</td> \
|
||||
<td><input type="button" value="삭제" onClick="deleteRow(this,\'' + _fileID + '\')"/></td> \
|
||||
</tr> \
|
||||
');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 파일 사이즈 bytes 를 KB, MB... 형식으로 변환
|
||||
function bytesToSize(bytes) {
|
||||
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
||||
if (bytes == 0) return 'n/a';
|
||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
|
||||
if (i == 0) return bytes + ' ' + sizes[i];
|
||||
return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i];
|
||||
}
|
||||
|
||||
// 커스텀 테이블 행 삭제
|
||||
function deleteRow(obj, fileID) {
|
||||
var row = obj.parentNode.parentNode;
|
||||
row.parentNode.removeChild(row);
|
||||
control.removeFileById(fileID);
|
||||
}
|
||||
|
||||
// 커스텀 테이블 파일 정보를 확인
|
||||
function getTableFiles() {
|
||||
var tbl = innoJquery('#fileTable tr:has(td)').map(function(i, v) {
|
||||
var innoJquerytd = innoJquery('td', this);
|
||||
var type = innoJquerytd.eq(2).text();
|
||||
if (type == "large") {
|
||||
var uploadUrl = control.option.uploadUrl + "?type=large";
|
||||
} else {
|
||||
var uploadUrl = control.option.uploadUrl + "?type=normal";
|
||||
}
|
||||
return {
|
||||
basePath: "",
|
||||
filePath: innoJquerytd.eq(0).text(),
|
||||
fileSize: Number(innoJquerytd.eq(1).text()),
|
||||
fileType: innoJquerytd.eq(2).text(),
|
||||
uploadUrl: uploadUrl
|
||||
}
|
||||
}).get();
|
||||
|
||||
return tbl;
|
||||
}
|
||||
</script>
|
||||
|
||||
<head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
<div id="dropZone" style="overflow:auto; width:500px; height:200px; border: 1px solid #c0c0c0;">
|
||||
<table id="fileTable" class="fileTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="fileInfo">filePath</th>
|
||||
<th class="fileInfo">fileSize</th>
|
||||
<th class="fileInfo">fileType</th>
|
||||
<th>파일명</th>
|
||||
<th>용량</th>
|
||||
<th>구분</th>
|
||||
<th>삭제</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="fileControl" style="display:none"></div><br/>
|
||||
|
||||
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
84
src/main/webapp/innorix_2/exam/uploadMulti.html
Normal file
@ -0,0 +1,84 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control1 = new Object(); // 파일전송 컨트롤 1
|
||||
var control2 = new Object(); // 파일전송 컨트롤 2
|
||||
var control3 = new Object(); // 파일전송 컨트롤 3
|
||||
|
||||
function uploadAll() {
|
||||
control3.addFiles(control1.getAllFiles());
|
||||
control3.addFiles(control2.getAllFiles());
|
||||
control3.upload();
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control1 = innorix.create({
|
||||
el: '#fileControll', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp?el=fileControll'
|
||||
});
|
||||
|
||||
control2 = innorix.create({
|
||||
el: '#fileControl2',
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp?el=fileControl2'
|
||||
});
|
||||
|
||||
control3 = innorix.create({
|
||||
el: '#fileControl3',
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp'
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control1.on('uploadComplete', function (p) {
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
|
||||
control2.on('uploadComplete', function (p) {
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
|
||||
control3.on('uploadComplete', function (p) {
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
<div id="fileControll"></div><br />
|
||||
|
||||
<input type="button" value="파일추가" onclick="control1.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="control1.upload();" /><br /><br />
|
||||
|
||||
<div id="fileControl2"></div><br />
|
||||
|
||||
<input type="button" value="파일추가" onclick="control2.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="control2.upload();" /><br /><br />
|
||||
|
||||
<div id="fileControl3" style="display:none"></div>
|
||||
|
||||
<input type="button" value="전체 업로드" onclick="uploadAll();" />
|
||||
</body>
|
||||
</html>
|
||||
320
src/main/webapp/innorix_2/gnIndex.html
Normal file
@ -0,0 +1,320 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=yes">
|
||||
<meta name="author" content="(주)지엔기술">
|
||||
<title>GNIT 이노릭스 샘플 목록</title>
|
||||
<link rel="shortcut icon" href="./gnexam/img/favicon.ico" />
|
||||
<link rel="stylesheet" href="./gnexam/css/gnit.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header id="header">
|
||||
<h1><img src="./gnexam/img/gnlogo.png">INNORIX SAMPLE LIST</h1>
|
||||
</header>
|
||||
|
||||
<div class="section">
|
||||
<div class="cont-wrap">
|
||||
<div class="notice-wrap">
|
||||
<table class="notice-tb">
|
||||
<colgroup>
|
||||
<col style="width:50%">
|
||||
<col style="width:50%">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<th colspan="2" class="notice-txt"><p>이노릭스는 사용하고 계시는 모드별로 제공되는 기능이 다릅니다. 샘플 비고란을 참고해주세요.</p></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="notice notice-a">
|
||||
<p><img src="./gnexam/img/agent.png"> Agent 모드 </p>
|
||||
<span>사용자 PC에 exe파일로 설치되며, 제공되는 기능이 더 많습니다. (agent : true)</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="notice notice-h">
|
||||
<p><img src="./gnexam/img/html5.png"> Html5 모드 </p>
|
||||
<span>무설치형으로 파일전송을 이용하며, 제약되는 기능이 있습니다. (agent : false)</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="origin-exam"><a href="./index.html">이노릭스제공 기본예제로 이동</a></p>
|
||||
<div class="table-wrap">
|
||||
<table class="list-tb">
|
||||
<colgroup>
|
||||
<col style="width:60px">
|
||||
<col style="width:auto">
|
||||
<col style="width:15%">
|
||||
<col style="width:15%">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<th>No</th>
|
||||
<th>기능설명</th>
|
||||
<th>샘플</th>
|
||||
<th>비고</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>01</td>
|
||||
<td class="ta_l">
|
||||
<p>업로드 파일 첨부 시 정책 설정</p>
|
||||
<span class="refer">전체 파일개수, 첨부할 확장자제한/허용, 개별파일 사이즈, 전체파일 사이즈, 중복파일 첨부여부 등을 제어</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/setAddFilePolicy.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
<img src="./gnexam/img/html5.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>02</td>
|
||||
<td class="ta_l">
|
||||
<p>전송 오류 시 전송 간격 및 횟수 설정</p>
|
||||
<span class="refer">retryCount, retryDelay, maximumErrorCount 옵션 사용방법</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/setErrorRetry.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>03</td>
|
||||
<td class="ta_l">
|
||||
<p>(클라이언트→서버) 업로드 시 추가 데이터 전송</p>
|
||||
<span class="refer">setPostData, setFilePostDataByIndex를 이용하여 클라이언트단에서 서버단으로 추가 데이터 전송</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/postData.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
<img src="./gnexam/img/html5.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>04</td>
|
||||
<td class="ta_l">
|
||||
<p>(서버→클라이언트) 업로드 시 커스텀 벨류 전송</p>
|
||||
<span class="refer">setCustomValue를 이용하여 서버단에서 클라이언트단으로 커스텀 벨류 전송</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/uploadCustomValue.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
<img src="./gnexam/img/html5.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>05</td>
|
||||
<td class="ta_l">
|
||||
<p>업로드 시 경로 설정 및 저장 파일명 변경</p>
|
||||
<span class="refer">업로드되는 서버의 경로 설정 및 저장 파일명 변경 방법</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/uploadServerDirChangeName.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
<img src="./gnexam/img/html5.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>06</td>
|
||||
<td class="ta_l">
|
||||
<p>(서버→클라이언트) 업로드 시 커스텀 에러 전송</p>
|
||||
<span class="refer">업로드 시 서버측 에러메세지 및 에러코드를 클라이언트측으로 반환</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/uploadCustomError.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>07</td>
|
||||
<td class="ta_l">
|
||||
<p>(서버→클라이언트) 다운로드 시 커스텀 에러 전송</p>
|
||||
<span class="refer">다운로드 중 서버측 에러메세지 및 에러코드를 클라이언트측으로 반환</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/downloadCustomError.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>08</td>
|
||||
<td class="ta_l">
|
||||
<p>다운로드 완료 시 처리방법 예제</p>
|
||||
<span class="refer">다운로드가 완료된 후, 후처리가 필요할 때 처리방법</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/downloadCompleted.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>09</td>
|
||||
<td class="ta_l">
|
||||
<p>폴더구조 첨부 제한, 서버에 폴더구조 업로드 제어</p>
|
||||
<span class="refer">폴더 구조 첨부를 제한하고, 폴더 구조 업로드를 제한할 때 처리방법</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/folderIntact.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>10</td>
|
||||
<td class="ta_l">
|
||||
<p>컨트롤 UI의 폴더 트리구조 관련 옵션 사용 예제</p>
|
||||
<span class="refer">폴더구조를 첨부할 때 보여지는 트리구조 제어(showFolderItems, showFolderItemsTree 사용방법)</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/setFolderTreeItems.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>11</td>
|
||||
<td class="ta_l">
|
||||
<p>폴더구조의 파일로 다운로드 구성 예제</p>
|
||||
<span class="refer">폴더구조의 파일로 다운로드 목록을 구성(presetDownloadFiles)하는 방법</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/folderDownload.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>12</td>
|
||||
<td class="ta_l">
|
||||
<p>폴더구조 파일 combine예제</p>
|
||||
<span class="refer">폴더구조의 파일을 업로드하고, 업로드한 파일로 다운로드 목록이 구성되게 하는 예제</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/folderCombine.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>13</td>
|
||||
<td class="ta_l">
|
||||
<p>사용자가 다운로드 경로 지정, 다운로드 완료 후 탐색기열기</p>
|
||||
<span class="refer">사용자가 다운로드될 경로를 지정할 수 있고, 다운로드 완료 후 탐색기를 열어줄 수 있는 예제</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/setDownloadPath.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>14</td>
|
||||
<td class="ta_l">
|
||||
<p>전송 조각 사이즈변경, 세션 개수 설정</p>
|
||||
<span class="refer">기본 조각 사이즈 2MB, 세션 16개가 적용되어있고 이를 수정가능</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/setSliceSizeSessionCount.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
<img src="./gnexam/img/html5.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>15</td>
|
||||
<td class="ta_l">
|
||||
<p>컨트롤 파일목록의 선택, 이동, 삭제 아이콘 제어</p>
|
||||
<span class="refer">컨트롤에 첨부된 파일목록의 기능 아이콘을 제어하는 showSelectBox, showFuncBtn 옵션 사용방법</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/setFuncBtn.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
<img src="./gnexam/img/html5.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>16</td>
|
||||
<td class="ta_l">
|
||||
<p>출력 메세지 언어 전환(한/영)</p>
|
||||
<span class="refer">출력되는 메세지는 기본 영문으로, 이를 한글로 설정하는 방법</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/setLanguage.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
<img src="./gnexam/img/html5.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>17</td>
|
||||
<td class="ta_l">
|
||||
<p>컨트롤 옵션 동적 설정 예제</p>
|
||||
<span class="refer">컨트롤 옵션을 setOption을 통해 설정하는 방법</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/setOption.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
<img src="./gnexam/img/html5.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>18</td>
|
||||
<td class="ta_l">
|
||||
<p>컨트롤 동적 생성 예제</p>
|
||||
<span class="refer">동적으로 컨트롤을 생성하고 제어하는 방법</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/dynamicCreate.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
<img src="./gnexam/img/html5.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>19</td>
|
||||
<td class="ta_l">
|
||||
<p>Html5모드 다운로드 요청 간격 설정</p>
|
||||
<span class="refer">Html5모드에서 다운로드 시 downloadDelay옵션을 이용한 다운로드 딜레이 설정 방법</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/setDownloadDelay.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/html5.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>20</td>
|
||||
<td class="ta_l">
|
||||
<p>업로드 완료 시 클라이언트단에 서버경로 숨김처리</p>
|
||||
<span class="refer">setHideServerPathInfo 메소드를 이용해 업로드 간 메타정보 상 노출되는 서버 경로를 숨기기 위한 방법</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/setHideServerPathInfo.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>21</td>
|
||||
<td class="ta_l">
|
||||
<p>첨부파일 압축 업로드 및 압축해제 다운로드 예제</p>
|
||||
<span class="refer">isCompress 메소드를 이용해 업로드시 서버에 압축하여 저장 및, setAutoDecompress이용하여 다운시 자동 압축해제</span>
|
||||
</td>
|
||||
<td><a class="exam-link" href="./gnexam/compressCombine.html">샘플보기</a></td>
|
||||
<td>
|
||||
<img src="./gnexam/img/agent.png">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="notice notice-pdf">
|
||||
<p><img src="./gnexam/img/pdf.png">이노릭스 참고 문서</p>
|
||||
<span><a href="../INNORIX Platform WP v9.2 Manual(KR).pdf" target="_blank">INNORIX Platform WP v9.2 Manual.pdf</a></span>
|
||||
<span><a href="../이노릭스 에이전트 증상 별 조치 안내 가이드.pdf" target="_blank">이노릭스 에이전트 증상 별 조치 안내 가이드.pdf</a></span>
|
||||
<span><a href="../INNORIX-WP-JSP-빠른설치-R2.pdf" target="_blank">INNORIX-WP-JSP-빠른설치-R2.pdf</a></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div><!-- //.section -->
|
||||
|
||||
<footer id="footer">
|
||||
<p>추가 문의사항은 <em>innorix@gnit.co.kr</em>로 보내주시길 바랍니다.</p>
|
||||
<span class="top_btn" onclick="window.scrollTo(0,0);">TOP</span>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
89
src/main/webapp/innorix_2/gnexam/agentImageUpload.html
Normal file
@ -0,0 +1,89 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
innorix.setLanguage('ko');
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'upload', // 업로드, 다운로드 혼합사용
|
||||
agent : true,
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
allowExtension : ["png", "jpg", "jpeg"],
|
||||
showPreviewImage: true, // 이미지 미리보기
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
|
||||
var files = JSON.stringify(f);
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||
//innoJquery('form#f_write').submit();
|
||||
});
|
||||
|
||||
// 파일 선택 시
|
||||
control.on('onSelectRows', function (p) {
|
||||
console.log(p);
|
||||
console.log('---------------------------');
|
||||
});
|
||||
};
|
||||
|
||||
function imageUpload(){
|
||||
control.appendThumbnailProperty("ALL", 200, 200, "VERTICAL");
|
||||
control.appendWatermarkProperty("ALL", "innorix_logo.png", "CENTER|BOTTOM");
|
||||
|
||||
control.upload();
|
||||
}
|
||||
|
||||
/*
|
||||
이미지 미리보기
|
||||
- 옵션 : showPreviewImage: true
|
||||
|
||||
- 썸네일 생성(리사이징) : control.appendThumbnailProperty((1), (2), (3), (4));
|
||||
(1) 리사이징을 진행할 원본 이미지 인덱스 Number를 입력해주시거나 ALL을 입력받습니다.
|
||||
ex: control.appendThumnailProperty(1, 300, 300, "VERTICAL");
|
||||
(2) 가로 픽셀 사이즈 (Number)
|
||||
(3) 세로 픽셀 사이즈 (Number)
|
||||
(4) 리사이징을 진행할 가로세로 기준
|
||||
VERTICAL : 세로축 기준 리사이징
|
||||
HORIZONTAL : 가로축 기준 리사이징
|
||||
FIX : 설정한 사이즈에 맞게 리사이징(비율무시)
|
||||
|
||||
- 워터마크 추가 : control.appendWatermarkProperty((1), (2), (3));
|
||||
(1) 워터마크를 적용할 원본 파일 인덱스 Number를 입력해주시거나 ALL을 입력받습니다.
|
||||
ex : control.appendWatermarkProperty(2, "innorix_logo.png", "LEFT|MIDDLE")
|
||||
(2) 워터마크 이미지 URL
|
||||
(3) 워터마크를 적용할 위치 ("횡축|종축") ("가로|세로")
|
||||
가로 기준 위치 : "LEFT" / "RIGHT" / "CENTER"
|
||||
세로 기준 위치 : "TOP" / "BOTTOM" / "MIDDLE"
|
||||
*/
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<form action="resultImg.jsp" id="f_write" name="f_write" method="post">
|
||||
test1 : <input type="text" name="test1" />
|
||||
</form><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="imageUpload();"/>
|
||||
</body>
|
||||
</html>
|
||||
96
src/main/webapp/innorix_2/gnexam/agentPreviewImgAll.html
Normal file
@ -0,0 +1,96 @@
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
innorix.setLanguage('ko');
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'upload', // 업로드, 다운로드 혼합사용
|
||||
agent : true, // Agent모드 (설치형)
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
allowExtension : ["png", "jpg", "jpeg"],
|
||||
showPreviewImage: true, // 이미지 미리보기
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
});
|
||||
|
||||
// 파일 첨부시 에러
|
||||
control.on('addFileError', function (p) {
|
||||
alert(p[0].message + "\n " + p[0].type);
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
|
||||
// 파일 선택 시
|
||||
control.on('onSelectRows', function (p) {
|
||||
console.log(p);
|
||||
|
||||
if(p[0].thumbnailUrl != undefined){
|
||||
console.log(p[0].thumbnailUrl); // 이미지 주소
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
// 미리보기 (이미지 전체)
|
||||
function fnShowPreviewAll(){
|
||||
var f = control.getAllFiles(); // 첨부한 전체 파일 정보
|
||||
console.log(f);
|
||||
|
||||
var previewAllZone = $("#previewAllZone"); // 이미지 출력 영역
|
||||
for(var i=0; i<f.length; i++){
|
||||
if(f[i].thumbnailUrl != undefined){ // 썸네일 url이 생성된 이미지 파일만 구분
|
||||
var imgTag = document.createElement('img');
|
||||
|
||||
imgTag.src = 'http://127.0.0.1:4033' + f[i].thumbnailUrl; // (http) 사용자 PC의 에이전트 ↔ 브라우저 통신 url
|
||||
// imgTag.src = 'https://127.0.0.1:4523' + f[i].thumbnailUrl; // (https) 사용자 PC의 에이전트 ↔ 브라우저 통신 url
|
||||
|
||||
// 이미지 출력 예시 <img src="http://127.0.0.1:4033p[0].thumbnailUrl">
|
||||
|
||||
previewAllZone.append(imgTag); // 이미지 출력 영역에 append
|
||||
}
|
||||
}
|
||||
$("#previewAllZone").show();
|
||||
}
|
||||
|
||||
// 닫기
|
||||
function fnClose(){
|
||||
$("#previewAllZone").empty();
|
||||
$("#previewAllZone").hide();
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<style>
|
||||
#previewAllZone{display:none; width:800px; height:400px; border:2px solid #666; background-color:#f2f2f2;}
|
||||
#previewAllZone > img{max-width: 200px; max-height: 200px; display:inline-block;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
|
||||
<input type="button" id="previewAllBtn" data-rowid="" value="미리보기(전체)" onclick="fnShowPreviewAll();"/>
|
||||
<div id="previewAllZone" onclick="fnClose();"></div>
|
||||
</body>
|
||||
</html>
|
||||
55
src/main/webapp/innorix_2/gnexam/changeFileName.html
Normal file
@ -0,0 +1,55 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
allowExtension: 'jpg', //jpg 확장자만 첨부 허용
|
||||
uploadUrl: './changeFileName.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
console.log('실제 저장된 파일명 : '+f[i].serverFileName);
|
||||
}
|
||||
alert(r);
|
||||
|
||||
var files = JSON.stringify(f);
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||
//innoJquery('form#f_write').submit();
|
||||
});
|
||||
|
||||
// 파일 첨부시 에러
|
||||
control.on('addFileError', function (p) {
|
||||
alert(p[0].message + "\n jpg 파일만 등록해주세요.");
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||
test1 : <input type="text" name="test1" />
|
||||
</form><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
69
src/main/webapp/innorix_2/gnexam/changeFileName.jsp
Normal file
@ -0,0 +1,69 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||
<%@ page import="java.util.UUID" %>
|
||||
|
||||
<%
|
||||
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||
if ("POST".equals(request.getMethod()))
|
||||
{
|
||||
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||
int maxPostSize = 2147482624; // bytes
|
||||
|
||||
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||
|
||||
/*
|
||||
전달되는 _action Param 정보
|
||||
speedCheck : 전송속도 측정
|
||||
getServerInfo : 서버정보 확인
|
||||
getFileInfo : 파일정보 확인
|
||||
attachFile : 파일전송 진행
|
||||
attachFileCompleted : 파일전송 완료
|
||||
*/
|
||||
|
||||
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||
String _type = uploader.getParameter("type"); // 커스텀 정의 POST Param 1
|
||||
String _part = uploader.getParameter("part"); // 커스텀 정의 POST Param 2
|
||||
String _transferId = uploader.getParameter("_transferId"); // TransferId
|
||||
|
||||
|
||||
// 파일정보 확인
|
||||
if("getFileInfo".equals(_action)) {
|
||||
/*
|
||||
업로드 시 서버에 저장되는 파일 명 변경 (해당 예제는 랜덥값으로 서버에 저장되는 파일명을 설정)
|
||||
- uploader.setFileName(파일명+확장자);
|
||||
- 확장자 변경 시 파일은 열리지 않게 됩니다.
|
||||
- upload.run()전에 위치
|
||||
*/
|
||||
String saveNm = UUID.randomUUID()+".jpg";
|
||||
uploader.setFileName(saveNm);
|
||||
}
|
||||
|
||||
String _run_retval = uploader.run();
|
||||
|
||||
// 개별파일 업로드 완료
|
||||
if("attachFileCompleted".equals(_action)) {
|
||||
/*
|
||||
System.out.println("========== uploader.isUploadDone() " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("_orig_filename \t = " + _orig_filename);
|
||||
System.out.println("_new_filename \t = " + _new_filename);
|
||||
System.out.println("_filesize \t = " + _filesize);
|
||||
System.out.println("_filepath \t = " + _filepath);
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// CORS 관련 헤더 추가
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||
%>
|
||||
61
src/main/webapp/innorix_2/gnexam/changeTransferMode.html
Normal file
@ -0,0 +1,61 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control1 = new Object();
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
|
||||
window.onload = function () {
|
||||
// 파일전송 컨트롤 생성
|
||||
control1 = innorix.create({
|
||||
el: '#fileControl1', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'upload' // 전송모드
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function download() {
|
||||
control1.destroy(); // 컨트롤 객체 destroy
|
||||
// 파일전송 컨트롤 생성
|
||||
control2 = innorix.create({
|
||||
el: '#fileControl2' // 컨트롤 출력 HTML 객체 ID
|
||||
, enableDropZone: false
|
||||
, transferMode: 'download' // 전송모드
|
||||
, agent: false // true = Agent 설치, false = html5 모드 사용
|
||||
});
|
||||
document.getElementById('fileControl1').style.display = 'none';
|
||||
|
||||
control2.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||
control2.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP Brochure.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP パンフレット.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||
}]);
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="fileControl1"></div>
|
||||
<div id="fileControl2"></div>
|
||||
|
||||
<input type="button" value="다운로드모드" onclick="download();" />
|
||||
</body>
|
||||
|
||||
</html>
|
||||
1
src/main/webapp/innorix_2/gnexam/combine.html
Normal file
@ -0,0 +1 @@
|
||||
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../innorix.css">
<script src="../innorix.js"></script>
<script>
var control = new Object();
window.onload = function() {
// 파일전송 컨트롤 생성
control = innorix.create({
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
transferMode: 'both', // 업로드, 다운로드 혼합사용
installUrl: '../install/install.html', // Agent 설치 페이지
uploadUrl: './upload.jsp' // 업로드 URL
});
// 업로드 완료 이벤트
control.on('uploadComplete', function (p) {
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
var fileArray = new Array();
var f = p.files;
for (var i = 0; i < f.length; i++ ) {
var fileObj = new Object();
fileObj.printFileName = f[i].clientFileName;
fileObj.fileSize = f[i].fileSize;
fileObj.downloadUrl = urlBase + "download.jsp?fileName=" + f[i].serverFileName;
fileArray.push(fileObj);
}
console.log(fileArray);
control.removeAllFiles(); // 리스트 컨트롤에서 파일을 삭제
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
});
};
</script>
</head>
<body>
<a href="../index.html">← 예제 목록</a><br /><br />
<div id="fileControl"></div><br/>
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
<input type="button" value="업로드" onclick="control.upload();"/> |
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();"/>
<input type="button" value="전체 다운로드" onclick="control.download();"/>
</body>
</html>
|
||||
1
src/main/webapp/innorix_2/gnexam/combineTest.html
Normal file
54
src/main/webapp/innorix_2/gnexam/compressCombine.html
Normal file
@ -0,0 +1,54 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
isCompress: true, // 압축 옵션
|
||||
uploadUrl: './compressUpload.jsp' // 업로드 URL
|
||||
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
console.log(p);
|
||||
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
var fileArray = new Array();
|
||||
var f = p.files;
|
||||
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
var fileObj = new Object();
|
||||
fileObj.printFileName = f[i].clientFileName;
|
||||
fileObj.fileSize = f[i].fileSize;
|
||||
fileObj.downloadUrl = urlBase + "compressDownload.jsp?fileName=" + f[i].serverFileName;
|
||||
fileObj.compress = true; //다운로드 파일의 압축 여부
|
||||
fileArray.push(fileObj);
|
||||
}
|
||||
console.log(fileArray);
|
||||
control.removeAllFiles(); // 리스트 컨트롤에서 파일을 삭제
|
||||
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/> |
|
||||
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
144
src/main/webapp/innorix_2/gnexam/compressDownload.jsp
Normal file
@ -0,0 +1,144 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||
<%@ page import="java.io.*" %>
|
||||
|
||||
<%
|
||||
out.clear();
|
||||
out = pageContext.pushBody();
|
||||
|
||||
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||
|
||||
/*
|
||||
filePath
|
||||
파일이 저장된 스토리지 전체경로
|
||||
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||
윈도우 - C:/storage/path1/path2/data
|
||||
유닉스 - /storage/path1/path2/data
|
||||
*/
|
||||
|
||||
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||
String szStartOffset = request.getParameter("_StartOffset");
|
||||
String szEndOffset = request.getParameter("_EndOffset");
|
||||
|
||||
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||
String fileID = request.getParameter("fileID");
|
||||
String fileName = request.getParameter("fileName");
|
||||
String sysFileName = new String();
|
||||
String orgFileName = new String();
|
||||
String htmlMode = request.getParameter("_Html5");
|
||||
|
||||
if (fileID != null) {
|
||||
if (fileID.equals("1")) {
|
||||
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||
}
|
||||
|
||||
if (fileID.equals("2")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP Brochure.pdf";
|
||||
}
|
||||
|
||||
if (fileID.equals("3")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||
}
|
||||
}
|
||||
|
||||
if (fileName != null) {
|
||||
sysFileName = "dataCompress/" + fileName;
|
||||
orgFileName = "dataCompress/" + fileName;
|
||||
}
|
||||
|
||||
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
|
||||
File file = new File(filePath + sysFileName);
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||
|
||||
long startOffset = 0;
|
||||
long endOffset = 0;
|
||||
|
||||
if (szStartOffset != null) {
|
||||
startOffset = Long.parseLong(szStartOffset);
|
||||
}
|
||||
|
||||
if (szEndOffset != null) {
|
||||
endOffset = Long.parseLong(szEndOffset);
|
||||
}
|
||||
|
||||
long contentLength = 0;
|
||||
|
||||
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||
contentLength = endOffset - startOffset + 1;
|
||||
} else { // html 일반 다운로드 요청시
|
||||
contentLength = file.length();
|
||||
}
|
||||
|
||||
response.setHeader("Content-Length", "" + contentLength);
|
||||
|
||||
byte b[] = new byte[8192];
|
||||
BufferedInputStream input = null;
|
||||
BufferedOutputStream output = null;
|
||||
|
||||
try {
|
||||
input = new BufferedInputStream(new FileInputStream(file));
|
||||
output = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
int read = 0;
|
||||
|
||||
if (startOffset != 0) {
|
||||
long n = input.skip(startOffset);
|
||||
if (n == -1) read = -1;
|
||||
}
|
||||
|
||||
if(contentLength > 0) {
|
||||
while (contentLength > 0) {
|
||||
if(contentLength < 8192) {
|
||||
b = new byte[(int)contentLength];
|
||||
}
|
||||
|
||||
read = input.read(b);
|
||||
|
||||
if(read == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
output.write(b, 0, read);
|
||||
contentLength = contentLength - read;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("fileID \t: " + fileID);
|
||||
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||
System.out.println("totalLength \t: " + file.length() );
|
||||
System.out.println("startOffset \t: " + startOffset);
|
||||
System.out.println("endOffset \t: " + endOffset);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(output != null) {
|
||||
output.flush();
|
||||
output.close();
|
||||
}
|
||||
|
||||
if(input != null) {
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private String delimiterReplace(String fullDir)
|
||||
{
|
||||
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||
|
||||
return ret2;
|
||||
}
|
||||
%>
|
||||
75
src/main/webapp/innorix_2/gnexam/compressUpload.jsp
Normal file
@ -0,0 +1,75 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||
|
||||
<%
|
||||
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||
if (request.getMethod().equals("POST"))
|
||||
{
|
||||
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "dataCompress";
|
||||
int maxPostSize = 2147482624; // bytes
|
||||
|
||||
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||
|
||||
/*
|
||||
전달되는 _action Param 정보
|
||||
speedCheck : 전송속도 측정
|
||||
getServerInfo : 서버정보 확인
|
||||
getFileInfo : 파일정보 확인
|
||||
attachFile : 파일전송 진행
|
||||
attachFileCompleted : 파일전송 완료
|
||||
*/
|
||||
|
||||
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||
String _controlId = uploader.getParameter("_controlId"); // 컨트롤 엘리먼트 ID
|
||||
String _type = uploader.getParameter("_type"); // 커스텀 정의 POST Param 1
|
||||
String _part = uploader.getParameter("_part"); // 커스텀 정의 POST Param 2
|
||||
String _subdir = uploader.getParameter("_subdir"); // 커스텀 정의 POST Param 3
|
||||
String _md5 = uploader.getParameter("_integrity_md5"); // md5 해시값
|
||||
|
||||
uploader.setAutoDecompress(true, false); //압축파일 자동 압축해제하여 서버에 저장, 압축해제 후 압축파일 삭제
|
||||
|
||||
String _run_retval = uploader.run();
|
||||
|
||||
|
||||
|
||||
// 개별파일 업로드 완료
|
||||
if (uploader.isUploadDone()) {
|
||||
/*
|
||||
System.out.println("========== uploader.isUploadDone() " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("_orig_filename \t = " + _orig_filename);
|
||||
System.out.println("_new_filename \t = " + _new_filename);
|
||||
System.out.println("_filesize \t = " + _filesize);
|
||||
System.out.println("_filepath \t = " + _filepath);
|
||||
System.out.println("_controlId \t = " + _controlId);
|
||||
*/
|
||||
}
|
||||
|
||||
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("_action \t = " + _action);
|
||||
System.out.println("_run_retval \t = " + _run_retval);
|
||||
System.out.println("_orig_filename \t = " + _orig_filename);
|
||||
System.out.println("_new_filename \t = " + _new_filename);
|
||||
System.out.println("_filesize \t = " + _filesize);
|
||||
System.out.println("_start_offset \t = " + _start_offset);
|
||||
System.out.println("_end_offset \t = " + _end_offset);
|
||||
System.out.println("_filepath \t = " + _filepath);
|
||||
System.out.println("_controlId \t = " + _controlId);
|
||||
System.out.println("_type \t = " + _type);
|
||||
System.out.println("_part \t = " + _part);
|
||||
System.out.println("_md5 \t = " + _md5);
|
||||
|
||||
}
|
||||
|
||||
// CORS 관련 헤더 추가
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||
%>
|
||||
88
src/main/webapp/innorix_2/gnexam/css/gnit.css
Normal file
@ -0,0 +1,88 @@
|
||||
@charset "utf-8";
|
||||
/* RESET CSS */
|
||||
html, body, div, span, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, address, em, img, ins, kbd, q, s, samp,
|
||||
small, strike, strong, sub, sup, tt, var,
|
||||
b, u, i, dl, dt, dd, menu, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td,
|
||||
article, aside, canvas, details, embed,
|
||||
figure, figcaption, footer, header, hgroup,
|
||||
main, menu, nav, output, ruby, section, summary{font-family: 'NanumBarunGothic',sans-serif !important;margin: 0;padding: 0;border: 0;font: inherit;vertical-align: baseline;}
|
||||
article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section {display: block;}
|
||||
body {line-height: 1;}
|
||||
menu, ol, ul, li {list-style: none;}
|
||||
table {border-collapse: collapse;border-spacing: 0;}
|
||||
a {color: #333;text-decoration: none;cursor: pointer;font-size:inherit;}
|
||||
em {color: #73b644; font-weight: bold;}
|
||||
i {font-style: italic;display: inline;}
|
||||
|
||||
.clear {clear: both;display: block;height: 0;overflow: hidden;visibility: hidden;width: 0;}
|
||||
|
||||
|
||||
/* GNIT SAMPLE CSS */
|
||||
html, body{min-width: 900px;}
|
||||
#header{width: 100%; height: 70px; background-color: #73b644; border-bottom: 2px solid #539426; box-sizing: border-box; text-align: center;}
|
||||
#header img{display: inline-block; height: 40px; padding:15px 20px; vertical-align: middle;}
|
||||
#header h1{display: inline-block; font-size: 22px; color: #fff; font-weight: bold;}
|
||||
|
||||
#footer{width: 100%; height: 70px; background-color: #eff4e5; box-sizing: border-box; padding: 45px 0; border-top: 1px solid #539426;}
|
||||
#footer p{color: #333; text-align: center;}
|
||||
#footer .top_btn{
|
||||
display: block; width: 50px; height: 50px;
|
||||
background:url('../img/top_btn.jpg') 0 0 no-repeat; text-indent: -99999px;
|
||||
position: fixed; bottom: 40px; right: 0;
|
||||
}
|
||||
|
||||
.section{width: 100%; height: auto; background-color: #fdfdfd;}
|
||||
.section .cont-wrap{width: 100%; padding: 40px; box-sizing: border-box; max-width: 1300px; margin:0 auto;}
|
||||
|
||||
.notice-tb{width: 100%; table-layout: fixed;}
|
||||
.notice-tb th, .notice-tb td{padding: 15px 30px;}
|
||||
.notice-wrap{padding-bottom: 20px; box-sizing: border-box;}
|
||||
.notice-txt p{font-size: 18px; color:#2b3a58;}
|
||||
.notice-txt p::before{
|
||||
content: ""; display: inline-block; width: 60px; height: 50px;
|
||||
vertical-align: middle; background: url(../img/notice.png) no-repeat; background-size: contain;
|
||||
}
|
||||
.notice{padding-bottom: 20px; }
|
||||
.notice p{padding-bottom: 8px; font-size: 16px; font-weight: bold;}
|
||||
.notice img{width: 24px; vertical-align: text-bottom; padding-right: 5px;}
|
||||
.notice span{font-size: 15px; display: block; padding: 5px;}
|
||||
.notice span::before{content: "-"; display: inline-block; width: 14px;}
|
||||
.notice-a p{color: #005DA6;}
|
||||
.notice-h p{color: #fb843f;}
|
||||
|
||||
.notice-pdf img{width: 20px; padding: 0 10px 0 2px;}
|
||||
.notice-pdf p{color: #444;}
|
||||
.notice-pdf a:hover{text-decoration: underline; color: #0f6fb9;}
|
||||
|
||||
.origin-exam{font-size: 14px; color: #666; text-align: right;}
|
||||
.origin-exam a:hover{text-decoration: underline; color: #0f6fb9;}
|
||||
|
||||
/* (공통)목록 table */
|
||||
/* .list-tb{counter-reset: tr 0;} */
|
||||
/* .list-tb tr td:first-child::before{counter-increment: tr 1; content:counter(tr) '';} */
|
||||
.list-tb{width: 100%; table-layout: fixed; border-top: 3px solid #539426; margin: 20px 0 50px; font-size: 15px;}
|
||||
.list-tb th, .list-tb td{border-right: 1px solid #cecece; text-align: center; padding:12px 18px; line-height: 24px; vertical-align:middle; background-color: #fff; word-break:break-all;}
|
||||
.list-tb th:last-child, .list-tb td:last-child{border:none;}
|
||||
.list-tb th{background-color: #eff4e5; font-size: 16px; color: #333; font-weight: bold;}
|
||||
.list-tb td.ta_l{text-align: left;}
|
||||
.list-tb td.ta_r{text-align: right;}
|
||||
.list-tb td p{font-size: 16px;}
|
||||
.list-tb td > img{width: 24px; padding: 0 5px; vertical-align: middle;}
|
||||
.list-tb td a:hover{ text-decoration:underline;}
|
||||
.list-tb tr{border-bottom: 1px solid #cecece;}
|
||||
.list-tb tr:last-child{border-bottom: 2px solid #539426;}
|
||||
|
||||
.refer{color: #999; font-size: 14px;}
|
||||
|
||||
.exam-link{border-radius: 5px; }
|
||||
.exam-link::before{content: ""; display: inline-block; width: 22px; height: 18px;
|
||||
vertical-align: middle; background: url(../img/code.png) no-repeat; background-size: contain;}
|
||||
.exam-link:hover{color: #0f6fb9;}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1 @@
|
||||
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../innorix.css">
<script src="../innorix.js"></script>
<script>
var control = new Object();
window.onload = function() {
// 파일전송 컨트롤 생성
control = innorix.create({
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
installUrl: '../install/install.html' // Agent 설치 페이지
});
control.on('loadComplete', function (p) { // 다운로드 파일 추가
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
control.presetDownloadFiles(
[{
printFileName: "INNORIX WP 브로셔.pdf",
fileSize: 1433885,
downloadUrl: urlBase + "download.jsp?fileID=1"
},
{
printFileName: "INNORIX WP Brochure.pdf",
fileSize: 1433885,
downloadUrl: urlBase + "download.jsp?fileID=2"
},
{
printFileName: "INNORIX WP パンフレット.pdf",
fileSize: 1433885,
downloadUrl: urlBase + "download.jsp?fileID=3"
}]);
});
// 더블클릭 시
control.on('onDblClickRows', function (file) {
control.downloadAndOpen(file); // 다운로드 완료 후 파일 열기
});
/*
downloadAndOpen (※ Agent 모드 전용 옵션)
- 다운로드 되는 경로 C:\Users\{사용자}\AppData(숨김폴더)\Local\Temp\{난수}
- n개를 선택 후 downloadAndOpen 실행 시 선택한 파일들 중 인덱스 숫자가 큰 파일이 열리게 됩니다.
*/
// 다운로드 완료
control.on('downloadComplete', function (p) {
console.log('download done');
});
};
</script>
</head>
<body>
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
<div id="fileControl"></div><br/>
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
<input type="button" value="전체 다운로드" onclick="control.download();"/>
<input type="button" value="n개선택 후 downloadAndOpen" onclick="control.downloadAndOpen();"/>
</body>
</html>
|
||||
57
src/main/webapp/innorix_2/gnexam/debugDropZone.html
Normal file
@ -0,0 +1,57 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
|
||||
isDebugDropZone: true //드랍존 영역 표시
|
||||
});
|
||||
|
||||
/*
|
||||
isDebugDropZone (※ Agent 모드 전용 옵션)
|
||||
- true (파일을 드랍존으로 드래그하면 드랍존이 검은색으로 표시)
|
||||
*/
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
|
||||
var files = JSON.stringify(f);
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||
innoJquery('form#f_write').submit();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
<p>설정된 드랍존 영역을 확인하는 방법 - 파일을 드래그하여 드랍존 영역을 확인할 수 있습니다.<p>
|
||||
|
||||
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||
test1 : <input type="text" name="test1" />
|
||||
</form><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
71
src/main/webapp/innorix_2/gnexam/deleteFileInfo.html
Normal file
@ -0,0 +1,71 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="http://code.jquery.com/jquery-latest.min.js" charset="UTF-8"></script>
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
var fileArray = new Array();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
uploadUrl: './upload.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
|
||||
var files = JSON.stringify(f);
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
|
||||
$('#f_write').submit(); // deleteServer.jsp로 넘어가 삭제된 파일정보가 보여집니다.
|
||||
|
||||
/*innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||
innoJquery('form#f_write').submit();*/
|
||||
});
|
||||
};
|
||||
|
||||
// 선택삭제
|
||||
function deleteTest(){
|
||||
var fileInfo = control.getSelectedFiles(); //선택된파일 정보
|
||||
var arrId = new Array();
|
||||
var arrName = new Array();
|
||||
var arrSize = new Array();
|
||||
for(var i=0; i<fileInfo.length; i++){
|
||||
arrId.push(fileInfo[i].id);
|
||||
arrName.push(fileInfo[i].printFileName);
|
||||
arrSize.push(fileInfo[i].fileSize);
|
||||
$('#f_write').append('<input type="hidden" name="_innorix_deleted_id" id="_innorix_deleted_id" value=\'' + arrId[i] + '\' />');
|
||||
$('#f_write').append('<input type="hidden" name="_innorix_deleted_name" id="_innorix_deleted_name" value=\'' + arrName[i] + '\' />');
|
||||
$('#f_write').append('<input type="hidden" name="_innorix_deleted_size" id="_innorix_deleted_size" value=\'' + arrSize[i] + '\' />');
|
||||
}
|
||||
control.removeSelectedFiles(); //선택된파일삭제
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
<p>삭제한 파일정보를 서버에 출력 - 삭제한 파일정보를 확인할 수 있습니다. 선택삭제 후 업로드를 진행해주세요.</p>
|
||||
|
||||
<form action="./deleteServer.jsp" id="f_write" name="f_write" method="post">
|
||||
test1 : <input type="text" name="test1" />
|
||||
</form><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
<input type="button" value="선택삭제" onclick="deleteTest();"/>
|
||||
</body>
|
||||
</html>
|
||||
19
src/main/webapp/innorix_2/gnexam/deleteServer.jsp
Normal file
@ -0,0 +1,19 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||
<%@page import="java.io.File" %>
|
||||
<%
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
String[] strDeletedID = request.getParameterValues("_innorix_deleted_id"); // 삭제된 파일ID
|
||||
String[] strDeletedName = request.getParameterValues("_innorix_deleted_name"); // 삭제된 파일이름
|
||||
String[] strDeletedSize = request.getParameterValues("_innorix_deleted_size"); // 삭제된 파일용량
|
||||
for(int i=0; i<strDeletedID.length; i++){
|
||||
System.out.println("삭제된 "+i+"번째 id= "+strDeletedID[i]);
|
||||
System.out.println("삭제된 "+i+"번째 name= "+strDeletedName[i]);
|
||||
System.out.println("삭제된 "+i+"번째 size= "+strDeletedSize[i]);
|
||||
|
||||
out.println("삭제된 " + i + "번째 id= " + strDeletedID[i] + "<br />");
|
||||
out.println("삭제된 " + i + "번째 name= " + strDeletedName[i] + "<br />");
|
||||
out.println("삭제된 " + i + "번째 size= " + strDeletedSize[i] + "<br />");
|
||||
}
|
||||
%>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
88
src/main/webapp/innorix_2/gnexam/download.html
Normal file
@ -0,0 +1,88 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
innorix.setLanguage('ko');
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html' // Agent 설치 페이지
|
||||
});
|
||||
|
||||
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP Brochure.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP パンフレット.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||
}]);
|
||||
});
|
||||
|
||||
control.on('downloadComplete', function (p) { // 다운로드 완료
|
||||
console.log(p);
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
|
||||
|
||||
|
||||
console.log(control.getDownloadFiles());
|
||||
var r = "";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].filePath;
|
||||
}
|
||||
console.log(r);
|
||||
});
|
||||
|
||||
|
||||
control.on('onDblClickRows', function(p) { // onSelectRows파일선택시
|
||||
control.downloadAndOpen();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
function getFileCount(){
|
||||
var fileCount = control.getFileCount();
|
||||
alert("allFileCount" + "\n" + fileCount);
|
||||
}
|
||||
|
||||
//n건 선택 후 downloadAndOpen()
|
||||
function downOpen(){
|
||||
var fileInfos = control.getSelectedFiles();
|
||||
console.log(fileInfos);
|
||||
control.unselectAllFiles();
|
||||
|
||||
for (var i=0; i<fileInfos.length; i++) {
|
||||
control.addSelectFilesById(fileInfos[i].rowID);
|
||||
control.downloadAndOpen();
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
<input type="button" value="getFileCount" onClick="getFileCount();"/>
|
||||
<input type="button" value="실행" onclick="downOpen();"/>
|
||||
</body>
|
||||
</html>
|
||||
143
src/main/webapp/innorix_2/gnexam/download.jsp
Normal file
@ -0,0 +1,143 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||
<%@ page import="java.io.*" %>
|
||||
|
||||
<%
|
||||
out.clear();
|
||||
out = pageContext.pushBody();
|
||||
|
||||
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||
|
||||
/*
|
||||
filePath
|
||||
파일이 저장된 스토리지 전체경로
|
||||
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||
윈도우 - C:/storage/path1/path2/data
|
||||
유닉스 - /storage/path1/path2/data
|
||||
*/
|
||||
|
||||
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||
String szStartOffset = request.getParameter("_StartOffset");
|
||||
String szEndOffset = request.getParameter("_EndOffset");
|
||||
|
||||
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||
String fileID = request.getParameter("fileID");
|
||||
String fileName = request.getParameter("fileName");
|
||||
String sysFileName = new String();
|
||||
String orgFileName = new String();
|
||||
|
||||
if (fileID != null) {
|
||||
if (fileID.equals("1")) {
|
||||
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||
}
|
||||
|
||||
if (fileID.equals("2")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP Brochure.pdf";
|
||||
}
|
||||
|
||||
if (fileID.equals("3")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||
}
|
||||
}
|
||||
|
||||
if (fileName != null) {
|
||||
sysFileName = "data/" + fileName;
|
||||
orgFileName = fileName;
|
||||
}
|
||||
|
||||
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
|
||||
File file = new File(filePath + sysFileName);
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||
|
||||
long startOffset = 0;
|
||||
long endOffset = 0;
|
||||
|
||||
if (szStartOffset != null) {
|
||||
startOffset = Long.parseLong(szStartOffset);
|
||||
}
|
||||
|
||||
if (szEndOffset != null) {
|
||||
endOffset = Long.parseLong(szEndOffset);
|
||||
}
|
||||
|
||||
long contentLength = 0;
|
||||
|
||||
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||
contentLength = endOffset - startOffset + 1;
|
||||
} else { // html 일반 다운로드 요청시
|
||||
contentLength = file.length();
|
||||
}
|
||||
|
||||
response.setHeader("Content-Length", "" + contentLength);
|
||||
|
||||
byte b[] = new byte[8192];
|
||||
BufferedInputStream input = null;
|
||||
BufferedOutputStream output = null;
|
||||
|
||||
try {
|
||||
input = new BufferedInputStream(new FileInputStream(file));
|
||||
output = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
int read = 0;
|
||||
|
||||
if (startOffset != 0) {
|
||||
long n = input.skip(startOffset);
|
||||
if (n == -1) read = -1;
|
||||
}
|
||||
|
||||
if(contentLength > 0) {
|
||||
while (contentLength > 0) {
|
||||
if(contentLength < 8192) {
|
||||
b = new byte[(int)contentLength];
|
||||
}
|
||||
|
||||
read = input.read(b);
|
||||
|
||||
if(read == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
output.write(b, 0, read);
|
||||
contentLength = contentLength - read;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("fileID \t: " + fileID);
|
||||
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||
System.out.println("totalLength \t: " + file.length() );
|
||||
System.out.println("startOffset \t: " + startOffset);
|
||||
System.out.println("endOffset \t: " + endOffset);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(output != null) {
|
||||
output.flush();
|
||||
output.close();
|
||||
}
|
||||
|
||||
if(input != null) {
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private String delimiterReplace(String fullDir)
|
||||
{
|
||||
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||
|
||||
return ret2;
|
||||
}
|
||||
%>
|
||||
@ -0,0 +1,76 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
innorix.setLanguage('ko');
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './uploadSession.jsp', // 업로드 URL
|
||||
agent: false
|
||||
});
|
||||
|
||||
// 로딩 완료
|
||||
control.on('loadComplete', function (p) {
|
||||
control.setCookie("JSESSIONID=<%=session.getId()%>"); //Agent모드 시 세션 유지
|
||||
});
|
||||
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
|
||||
console.log(p);
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
var fileArray = new Array();
|
||||
var f = p.files;
|
||||
|
||||
console.log(p.uniqueId);
|
||||
|
||||
|
||||
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
console.log(f[i].uniqueId);
|
||||
var fileObj = new Object();
|
||||
fileObj.printFileName = f[i].clientFileName;
|
||||
fileObj.fileSize = f[i].fileSize;
|
||||
fileObj.downloadUrl = urlBase + "downloadDeleteSession.jsp?uniqueId=" + f[i].uniqueId + "&fileName=" + f[i].clientFileName;
|
||||
fileObj.serverFilePath = f[i].serverFilePath;
|
||||
fileObj.rootName = f[i].rootName;
|
||||
fileArray.push(fileObj);
|
||||
|
||||
}
|
||||
|
||||
control.removeAllFiles(); // 리스트 컨트롤에서 파일을 삭제
|
||||
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="폴더추가" onclick="control.openFolderDialog();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
186
src/main/webapp/innorix_2/gnexam/downloadComplete.jsp
Normal file
@ -0,0 +1,186 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||
<%@ page import="com.innorix.transfer.InnorixTransfer" %>
|
||||
<%@ page import="org.json.JSONArray" %>
|
||||
<%@ page import="org.json.JSONObject" %>
|
||||
<%@ page import="java.io.*" %>
|
||||
|
||||
<%
|
||||
out.clear();
|
||||
out = pageContext.pushBody();
|
||||
|
||||
String method = request.getMethod();
|
||||
|
||||
/*
|
||||
파일 다운로드 완료 시 받은 정보 출력을 위해 아래와 같이 구성.
|
||||
다운로드 시에는 GET / 다운로드 완료 시에는 POST 동사로 분리하여 구성.
|
||||
*/
|
||||
|
||||
if (method.equals("POST"))
|
||||
{
|
||||
InnorixTransfer innorixTransfer = new InnorixTransfer(request, response);
|
||||
|
||||
String _action = innorixTransfer.getParameter("_action");
|
||||
innorixTransfer.Save();
|
||||
|
||||
if (_action.equals("downloadCompleted"))
|
||||
{
|
||||
String fileInfo = innorixTransfer.getParameter("_fileInfoList");
|
||||
JSONArray jsonFileInfoList = new JSONArray(fileInfo);
|
||||
for (int index = 0; index < jsonFileInfoList.length(); ++index) {
|
||||
JSONObject jsonFileInfo = jsonFileInfoList.getJSONObject(index);
|
||||
String fileName = jsonFileInfo.getString("fileName");
|
||||
String downloadFileName = jsonFileInfo.getString("downloadFileName");
|
||||
String downloadFilePath = jsonFileInfo.getString("downloadFilePath");
|
||||
int fileSize = jsonFileInfo.getInt("fileSize");
|
||||
String subFolder = jsonFileInfo.getString("subFolder");
|
||||
String fileId = jsonFileInfo.getString("fileId");
|
||||
boolean isFolder = jsonFileInfo.getBoolean("isFolder");
|
||||
|
||||
System.out.println("-----downloadCompleted-------");
|
||||
System.out.println("fileName : " + fileName );
|
||||
System.out.println("downloadFileName : " + downloadFileName );
|
||||
System.out.println("downloadFilePath : " + downloadFilePath );
|
||||
System.out.println("fileSize : " + fileSize );
|
||||
System.out.println("subFolder : " + subFolder );
|
||||
System.out.println("fileId : " + fileId );
|
||||
System.out.println("isFolder : " + isFolder );
|
||||
}
|
||||
}
|
||||
}else if (method.equals("GET"))
|
||||
{
|
||||
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||
|
||||
/*
|
||||
filePath
|
||||
파일이 저장된 스토리지 전체경로
|
||||
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||
윈도우 - C:/storage/path1/path2/data
|
||||
유닉스 - /storage/path1/path2/data
|
||||
*/
|
||||
|
||||
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||
String szStartOffset = request.getParameter("_StartOffset");
|
||||
String szEndOffset = request.getParameter("_EndOffset");
|
||||
|
||||
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||
String fileID = request.getParameter("fileID");
|
||||
String fileName = request.getParameter("fileName");
|
||||
String sysFileName = new String();
|
||||
String orgFileName = new String();
|
||||
|
||||
if (fileID != null) {
|
||||
if (fileID.equals("1")) {
|
||||
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||
}
|
||||
|
||||
if (fileID.equals("2")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP Brochure.pdf";
|
||||
}
|
||||
|
||||
if (fileID.equals("3")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||
}
|
||||
}
|
||||
|
||||
if (fileName != null) {
|
||||
sysFileName = "data/" + fileName;
|
||||
orgFileName = "data/" + fileName;
|
||||
}
|
||||
|
||||
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
|
||||
File file = new File(filePath + sysFileName);
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||
|
||||
long startOffset = 0;
|
||||
long endOffset = 0;
|
||||
|
||||
if (szStartOffset != null) {
|
||||
startOffset = Long.parseLong(szStartOffset);
|
||||
}
|
||||
|
||||
if (szEndOffset != null) {
|
||||
endOffset = Long.parseLong(szEndOffset);
|
||||
}
|
||||
|
||||
long contentLength = 0;
|
||||
|
||||
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||
contentLength = endOffset - startOffset + 1;
|
||||
} else { // html 일반 다운로드 요청시
|
||||
contentLength = file.length();
|
||||
}
|
||||
|
||||
response.setHeader("Content-Length", "" + contentLength);
|
||||
|
||||
byte b[] = new byte[8192];
|
||||
BufferedInputStream input = null;
|
||||
BufferedOutputStream output = null;
|
||||
|
||||
try {
|
||||
input = new BufferedInputStream(new FileInputStream(file));
|
||||
output = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
int read = 0;
|
||||
|
||||
if (startOffset != 0) {
|
||||
long n = input.skip(startOffset);
|
||||
if (n == -1) read = -1;
|
||||
}
|
||||
|
||||
if(contentLength > 0) {
|
||||
while (contentLength > 0) {
|
||||
if(contentLength < 8192) {
|
||||
b = new byte[(int)contentLength];
|
||||
}
|
||||
|
||||
read = input.read(b);
|
||||
|
||||
if(read == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
output.write(b, 0, read);
|
||||
contentLength = contentLength - read;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("fileID \t: " + fileID);
|
||||
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||
System.out.println("totalLength \t: " + file.length() );
|
||||
System.out.println("startOffset \t: " + startOffset);
|
||||
System.out.println("endOffset \t: " + endOffset);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(output != null) {
|
||||
output.flush();
|
||||
output.close();
|
||||
}
|
||||
|
||||
if(input != null) {
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
<%!
|
||||
private String delimiterReplace(String fullDir)
|
||||
{
|
||||
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||
|
||||
return ret2;
|
||||
}
|
||||
%>
|
||||
69
src/main/webapp/innorix_2/gnexam/downloadCompleted.html
Normal file
@ -0,0 +1,69 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
|
||||
/*
|
||||
다운로드 완료 시, 완료된 파일 목록을 일괄적으로 서버단에서 액션 이벤트를 통해 전달할 수 있는 예제
|
||||
서버단에 완료 이벤트를 구성하기 위해 downloadCompletedEvent 옵션을 지정해준다.
|
||||
downloadCompletedEvent : {
|
||||
'use' : true, // 사용여부 boolean 타입
|
||||
'url' : './downloadCompleted.jsp' // 다운로드 완료 후 파일 목록을 넘겨 받을 jsp
|
||||
}
|
||||
|
||||
* 정상적으로 작동하지 않는다면 InnorixJAVA.jar 파일 버전 확인이 필요합니다.
|
||||
* InnorixJAVA-r1529.jar부터 사용 가능
|
||||
*/
|
||||
|
||||
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'download', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
downloadCompletedEvent: {
|
||||
'use': true,
|
||||
'url': './downloadComplete.jsp'
|
||||
}
|
||||
});
|
||||
|
||||
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
|
||||
control.setCookie("JSESSIONID=<%=session.getId()%>"); //Agent모드 시 세션 유지
|
||||
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadComplete.jsp?fileID=1"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP Brochure.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadComplete.jsp?fileID=2"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP パンフレット.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadComplete.jsp?fileID=3"
|
||||
}]);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
79
src/main/webapp/innorix_2/gnexam/downloadCustomError.html
Normal file
@ -0,0 +1,79 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
innorix.setLanguage('ko'); // 한/영설정 [en,ko]
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
agent : true, // Agent 모드 사용
|
||||
|
||||
retryCount: 1, // 재전송 횟수
|
||||
retryDelay: 1, // 재전송 간격(sec)
|
||||
maximumErrorCount: 0 // 최대 에러 허용 횟수
|
||||
});
|
||||
|
||||
/*
|
||||
파일 전송 간 오류 발생 시 재전송 시도 횟수 및 간격에 대한 설정을 해줍니다.
|
||||
미설정 시 무제한으로 재전송을 시도하게 됩니다.
|
||||
- 관련 예제 [전송 오류 시 전송 간격 및 횟수 설정]참고
|
||||
*/
|
||||
|
||||
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadCustomError.jsp?fileID=1"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP Brochure.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadCustomError.jsp?fileID=2"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP パンフレット.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadCustomError.jsp?fileID=3"
|
||||
}]);
|
||||
});
|
||||
|
||||
//다운로드 에러 이벤트 (※ Agent 모드 전용)
|
||||
control.on('downloadError', function (p) {
|
||||
control.closeTransferWindow(); //전송창 바로 닫힘
|
||||
|
||||
alert("파일 다운로드 중 오류가 발생하였습니다.");
|
||||
console.log(p);
|
||||
|
||||
console.log('---- Download Error Event ----');
|
||||
var f = p.files;
|
||||
for(var i=0; i<f.length; i++){
|
||||
console.log("fileName:" + f[i].fileName);
|
||||
console.log("errorCode:" + f[i].errorCode);
|
||||
console.log("errorMessage:" + f[i].errorMessage);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br />
|
||||
<p>* 2번째 / 3번째 파일을 클릭하여 다운로드 시 downloadError 확인 가능합니다. </p>
|
||||
<p>* 1번째 파일 클릭 시 정상 다운로드 </p>
|
||||
<div id="fileControl"></div><br/>
|
||||
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
178
src/main/webapp/innorix_2/gnexam/downloadCustomError.jsp
Normal file
@ -0,0 +1,178 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@page import="com.innorix.transfer.InnorixCustomError"%>
|
||||
|
||||
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||
<%@ page import="java.io.*" %>
|
||||
|
||||
<%
|
||||
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||
|
||||
/*
|
||||
filePath
|
||||
파일이 저장된 스토리지 전체경로
|
||||
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||
윈도우 - C:/storage/path1/path2/data
|
||||
유닉스 - /storage/path1/path2/data
|
||||
*/
|
||||
|
||||
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||
String szStartOffset = request.getParameter("_StartOffset");
|
||||
String szEndOffset = request.getParameter("_EndOffset");
|
||||
|
||||
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||
String fileID = request.getParameter("fileID");
|
||||
String fileName = request.getParameter("fileName");
|
||||
String sysFileName = new String();
|
||||
String orgFileName = new String();
|
||||
|
||||
if (fileID != null) {
|
||||
if (fileID.equals("1")) {
|
||||
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||
}
|
||||
|
||||
if (fileID.equals("2")) {
|
||||
// sysFileName = "sample-file.pdf";
|
||||
sysFileName = "sample-file.app"; // ※ (오류) 실제 없는 파일
|
||||
orgFileName = "INNORIX WP Brochure.pdf";
|
||||
}
|
||||
|
||||
if (fileID.equals("3")) {
|
||||
// sysFileName = "sample-file.pdf";
|
||||
sysFileName = "sample-file.app"; // ※ (오류) 실제 없는 파일
|
||||
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||
}
|
||||
}
|
||||
|
||||
if (fileName != null) {
|
||||
sysFileName = "data/" + fileName;
|
||||
orgFileName = fileName;
|
||||
}
|
||||
|
||||
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
|
||||
File file = new File(filePath + sysFileName);
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||
|
||||
long startOffset = 0;
|
||||
long endOffset = 0;
|
||||
|
||||
if (szStartOffset != null) {
|
||||
startOffset = Long.parseLong(szStartOffset);
|
||||
}
|
||||
|
||||
if (szEndOffset != null) {
|
||||
endOffset = Long.parseLong(szEndOffset);
|
||||
}
|
||||
|
||||
long contentLength = 0;
|
||||
|
||||
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||
contentLength = endOffset - startOffset + 1;
|
||||
} else { // html 일반 다운로드 요청시
|
||||
contentLength = file.length();
|
||||
}
|
||||
|
||||
|
||||
byte b[] = new byte[8192];
|
||||
BufferedInputStream input = null;
|
||||
BufferedOutputStream output = null;
|
||||
|
||||
try {
|
||||
out.clear();
|
||||
out=pageContext.pushBody();
|
||||
|
||||
input = new BufferedInputStream(new FileInputStream(file));
|
||||
output = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
response.setHeader("Content-Length", "" + contentLength);
|
||||
|
||||
int read = 0;
|
||||
|
||||
if (startOffset != 0) {
|
||||
long n = input.skip(startOffset);
|
||||
if (n == -1) read = -1;
|
||||
}
|
||||
|
||||
|
||||
if(contentLength > 0) {
|
||||
while (contentLength > 0) {
|
||||
if(contentLength < 8192) {
|
||||
b = new byte[(int)contentLength];
|
||||
}
|
||||
|
||||
read = input.read(b);
|
||||
|
||||
if(read == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
output.write(b, 0, read);
|
||||
contentLength = contentLength - read;
|
||||
|
||||
|
||||
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("fileID \t: " + fileID);
|
||||
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||
System.out.println("totalLength \t: " + file.length() );
|
||||
System.out.println("contentLength \t: "+contentLength);
|
||||
System.out.println("startOffset \t: " + startOffset);
|
||||
System.out.println("read \t: "+read);
|
||||
System.out.println("endOffset \t: " + endOffset);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
/*
|
||||
downloadCustomError
|
||||
에러코드, 에러메시지, 에러타이틀 설정
|
||||
|
||||
customError.set(Error Code, Error Message, Error Title, retry); // 커스텀 에러 설정
|
||||
* Error Code 설정 시 1000번대로 설정하는 것을 권장합니다.
|
||||
* 너무 크거나 너무 작을 경우 다른 코드들과의 충돌로 정상 작동이 되지 않을 수 있습니다.
|
||||
|
||||
customError.run(); // 커스텀 에러 실행
|
||||
*/
|
||||
|
||||
response.setStatus(404);
|
||||
InnorixCustomError customError = new InnorixCustomError(response);
|
||||
customError.set("1004", "Download Error", "File Download Error", false);
|
||||
|
||||
// output이 getOutputStream을 이용하고 있을 시 output을 이용해서 커스텀 에러를 전송
|
||||
if (output != null){
|
||||
output.write(customError.runAction().getBytes("UTF-8"));
|
||||
}else{
|
||||
customError.run();
|
||||
}
|
||||
|
||||
} finally {
|
||||
if(output != null) {
|
||||
output.flush();
|
||||
output.close();
|
||||
}
|
||||
|
||||
if(input != null) {
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private String delimiterReplace(String fullDir)
|
||||
{
|
||||
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||
|
||||
return ret2;
|
||||
}
|
||||
%>
|
||||
55
src/main/webapp/innorix_2/gnexam/downloadDelay.html
Normal file
@ -0,0 +1,55 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
|
||||
downloadDelay: 1000 // ms 단위 다운로드 딜레이 설정 | 기본 : 200
|
||||
});
|
||||
/*
|
||||
downloadDelay
|
||||
- 다운로드 딜레이 설정 (기본값 : 0.2초)
|
||||
빠르고 반복되게 다운로드 요청이 이루어질 때, 브라우저 자체에서 악성 접근으로 감지하여
|
||||
차단되어 다운로드가 정상적으로 진행되지 않을 수 있습니다.
|
||||
해당 경우 downloadDelay 옵션을 통해 딜레이 시간을 보다 길게 설정하여 조치할 수 있습니다.
|
||||
*/
|
||||
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP Brochure.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP パンフレット.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||
}]);
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
172
src/main/webapp/innorix_2/gnexam/downloadDeleteSession.jsp
Normal file
@ -0,0 +1,172 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@page import="com.innorix.transfer.InnorixCustomValue"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixTransfer" %>
|
||||
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||
<%@ page import="org.json.JSONArray" %>
|
||||
<%@ page import="org.json.JSONObject" %>
|
||||
<%@ page import="java.io.*" %>
|
||||
|
||||
<%
|
||||
request.setCharacterEncoding("utf-8");
|
||||
|
||||
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||
/*
|
||||
filePath
|
||||
파일이 저장된 스토리지 전체경로
|
||||
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||
윈도우 - C:/storage/path1/path2/data
|
||||
유닉스 - /storage/path1/path2/data
|
||||
*/
|
||||
|
||||
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||
String szStartOffset = request.getParameter("_StartOffset");
|
||||
String szEndOffset = request.getParameter("_EndOffset");
|
||||
|
||||
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||
String getuniqueId = request.getParameter("uniqueId"); //유니크 아이디
|
||||
String fileName = request.getParameter("fileName");
|
||||
|
||||
String html5 = request.getParameter("_Html5");
|
||||
|
||||
String sysFileName = new String();
|
||||
String orgFileName = new String();
|
||||
|
||||
String fileFullPath = (String)session.getAttribute(getuniqueId); //파일 절대 경로 취득
|
||||
session.setAttribute(getuniqueId, fileFullPath);
|
||||
|
||||
if (fileName != null) {
|
||||
orgFileName = fileName;
|
||||
}
|
||||
|
||||
File file = null;
|
||||
|
||||
if (fileFullPath != null){
|
||||
file = new File(fileFullPath);
|
||||
}
|
||||
|
||||
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||
|
||||
long startOffset = 0;
|
||||
long endOffset = 0;
|
||||
|
||||
if (szStartOffset != null) {
|
||||
startOffset = Long.parseLong(szStartOffset);
|
||||
}
|
||||
|
||||
if (szEndOffset != null) {
|
||||
endOffset = Long.parseLong(szEndOffset);
|
||||
}
|
||||
|
||||
long contentLength = 0;
|
||||
|
||||
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||
contentLength = endOffset - startOffset + 1;
|
||||
} else { // html 일반 다운로드 요청시
|
||||
contentLength = file.length();
|
||||
}
|
||||
|
||||
response.setHeader("Content-Length", "" + contentLength);
|
||||
|
||||
byte b[] = new byte[8192];
|
||||
BufferedInputStream input = null;
|
||||
BufferedOutputStream output = null;
|
||||
try {
|
||||
out.clear();
|
||||
out=pageContext.pushBody();
|
||||
input = new BufferedInputStream(new FileInputStream(file));
|
||||
output = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
int read = 0;
|
||||
|
||||
if (startOffset != 0) {
|
||||
long n = input.skip(startOffset);
|
||||
if (n == -1) read = -1;
|
||||
}
|
||||
|
||||
if(contentLength > 0) {
|
||||
while (contentLength > 0) {
|
||||
if(contentLength < 8192) {
|
||||
b = new byte[(int)contentLength];
|
||||
}
|
||||
|
||||
read = input.read(b);
|
||||
|
||||
if(read == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
output.write(b, 0, read);
|
||||
contentLength = contentLength - read;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("uniqueId \t: " + getuniqueId);
|
||||
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||
System.out.println("totalLength \t: " + file.length() );
|
||||
System.out.println("startOffset \t: " + startOffset);
|
||||
System.out.println("endOffset \t: " + endOffset);
|
||||
System.out.println("_Html5 \t : " + html5);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(output != null) {
|
||||
|
||||
output.flush();
|
||||
output.close();
|
||||
}
|
||||
|
||||
if(input != null) {
|
||||
input.close();
|
||||
}
|
||||
|
||||
if("true".equals(html5)){ //html5 모드 일때
|
||||
session.removeAttribute(getuniqueId); //세션 삭제
|
||||
File f = new File(fileFullPath); //파일 경로
|
||||
System.out.println(f);
|
||||
if(f.exists()){
|
||||
if(f.delete()){
|
||||
System.out.println("파일삭제 성공");
|
||||
|
||||
}else{
|
||||
System.out.println("파일삭제 실패");
|
||||
}
|
||||
}else{
|
||||
System.out.println("파일 없음");
|
||||
}
|
||||
|
||||
}else{ //Agent 모드 일때
|
||||
session.removeAttribute(getuniqueId);
|
||||
File f = new File(fileFullPath);
|
||||
System.out.println(f);
|
||||
if(f.exists()){
|
||||
if(f.delete()){
|
||||
System.out.println("파일삭제 성공");
|
||||
}else{
|
||||
System.out.println("파일삭제 실패");
|
||||
}
|
||||
}else{
|
||||
System.out.println("파일 없음");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%>
|
||||
|
||||
<%!
|
||||
private String delimiterReplace(String fullDir)
|
||||
{
|
||||
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||
|
||||
return ret2;
|
||||
}
|
||||
%>
|
||||
55
src/main/webapp/innorix_2/gnexam/downloadIntegrity.html
Normal file
@ -0,0 +1,55 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
agent: true, // true : Agent 설치형 모드 사용, false : HTML5 모드 사용
|
||||
|
||||
downloadIntegrity: true // 다운로드 이중 무결성
|
||||
});
|
||||
|
||||
/*
|
||||
downloadIntegrity (※ Agent 모드 전용 옵션)
|
||||
- 다운로드 간 파일 해시 값을 이용한 이중 무결성 체크
|
||||
- 이중 무결성 로직을 추가하지 않았을 경우에 비해 다운로드 속도가 저하됩니다.
|
||||
*/
|
||||
|
||||
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadIntegrity.jsp?fileID=1"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP Brochure.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadIntegrity.jsp?fileID=2"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP パンフレット.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadIntegrity.jsp?fileID=3"
|
||||
}]);
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
177
src/main/webapp/innorix_2/gnexam/downloadIntegrity.jsp
Normal file
@ -0,0 +1,177 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||
<%-- 1. Integrity 패키지 추가 --%>
|
||||
<%@ page import="com.innorix.integrity.Integrity" %>
|
||||
<%@ page import="java.io.*" %>
|
||||
|
||||
<%
|
||||
out.clear();
|
||||
out = pageContext.pushBody();
|
||||
|
||||
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||
|
||||
/*
|
||||
filePath
|
||||
파일이 저장된 스토리지 전체경로
|
||||
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||
윈도우 - C:/storage/path1/path2/data
|
||||
유닉스 - /storage/path1/path2/data
|
||||
*/
|
||||
|
||||
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||
String szStartOffset = request.getParameter("_StartOffset");
|
||||
String szEndOffset = request.getParameter("_EndOffset");
|
||||
|
||||
String szIntegrity = request.getParameter("_Integrity"); // 파라미터를 통해 이중 무결성 여부 확인
|
||||
|
||||
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||
String fileID = request.getParameter("fileID");
|
||||
String fileName = request.getParameter("fileName");
|
||||
String sysFileName = new String();
|
||||
String orgFileName = new String();
|
||||
|
||||
/*
|
||||
다운로드 이중 무결성 (※ Agent 모드 전용 옵션)
|
||||
'_Integity' 파라미터를 확인해서 이중 무결성 여부 확인
|
||||
이중 무결성 로직을 추가하지 않았을 경우에 비해 다운로드 속도가 저하됩니다.
|
||||
*/
|
||||
boolean isIntegrity = false;
|
||||
if (szIntegrity != null && szIntegrity.equalsIgnoreCase("true")) {
|
||||
System.out.println("szIntegrity :"+szIntegrity);
|
||||
isIntegrity = true;
|
||||
}
|
||||
|
||||
|
||||
if (fileID != null) {
|
||||
if (fileID.equals("1")) {
|
||||
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||
}
|
||||
|
||||
if (fileID.equals("2")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP Brochure.pdf";
|
||||
}
|
||||
|
||||
if (fileID.equals("3")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||
}
|
||||
}
|
||||
|
||||
if (fileName != null) {
|
||||
sysFileName = "data/" + fileName;
|
||||
orgFileName = "data/" + fileName;
|
||||
}
|
||||
|
||||
long startOffset = 0;
|
||||
long endOffset = 0;
|
||||
|
||||
if (szStartOffset != null) {
|
||||
startOffset = Long.parseLong(szStartOffset);
|
||||
}
|
||||
|
||||
if (szEndOffset != null) {
|
||||
endOffset = Long.parseLong(szEndOffset);
|
||||
}
|
||||
|
||||
// 응답 데이터 수정
|
||||
if (isIntegrity) {
|
||||
Integrity integrity = new Integrity();
|
||||
String md5 = new String();
|
||||
try {
|
||||
// getMD5FromFileSlice() 메소드 리턴 값을 response에 write 해줍니다.
|
||||
md5 = integrity.getMD5FromFileSlice(filePath + sysFileName, startOffset, endOffset);
|
||||
}
|
||||
catch(Exception e) {
|
||||
}
|
||||
|
||||
response.setStatus(200);
|
||||
response.getWriter().write(md5);
|
||||
response.getWriter().flush();
|
||||
response.getWriter().close();
|
||||
return ;
|
||||
}
|
||||
|
||||
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
|
||||
File file = new File(filePath + sysFileName);
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||
|
||||
long contentLength = 0;
|
||||
|
||||
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||
contentLength = endOffset - startOffset + 1;
|
||||
} else { // html 일반 다운로드 요청시
|
||||
contentLength = file.length();
|
||||
}
|
||||
|
||||
response.setHeader("Content-Length", "" + contentLength);
|
||||
|
||||
byte b[] = new byte[8192];
|
||||
BufferedInputStream input = null;
|
||||
BufferedOutputStream output = null;
|
||||
|
||||
try {
|
||||
input = new BufferedInputStream(new FileInputStream(file));
|
||||
output = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
int read = 0;
|
||||
|
||||
if (startOffset != 0) {
|
||||
long n = input.skip(startOffset);
|
||||
if (n == -1) read = -1;
|
||||
}
|
||||
|
||||
if(contentLength > 0) {
|
||||
while (contentLength > 0) {
|
||||
if(contentLength < 8192) {
|
||||
b = new byte[(int)contentLength];
|
||||
}
|
||||
|
||||
read = input.read(b);
|
||||
|
||||
if(read == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
output.write(b, 0, read);
|
||||
contentLength = contentLength - read;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("fileID \t: " + fileID);
|
||||
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||
System.out.println("totalLength \t: " + file.length() );
|
||||
System.out.println("startOffset \t: " + startOffset);
|
||||
System.out.println("endOffset \t: " + endOffset);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(output != null) {
|
||||
output.flush();
|
||||
output.close();
|
||||
}
|
||||
|
||||
if(input != null) {
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private String delimiterReplace(String fullDir)
|
||||
{
|
||||
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||
|
||||
return ret2;
|
||||
}
|
||||
%>
|
||||
51
src/main/webapp/innorix_2/gnexam/downloadPath.html
Normal file
@ -0,0 +1,51 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
innorix.setLanguage('ko');
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
agent : true, // true : Agent 설치형 모드 사용, false : HTML5 모드 사용
|
||||
downloadPath: "C:\Users\home\Desktop", // 기본 다운로드 경로 설정
|
||||
transferStart : {"download":"auto"}, // 다운로드 자동 시작
|
||||
});
|
||||
|
||||
/*
|
||||
※ transferStart (전송 자동시작 유무)
|
||||
- 기본값 transferStart : { "upload":"auto", "download": "manual"}
|
||||
- auto : 자동으로 전송시작
|
||||
- manual : 사용자 확인 후 전송
|
||||
*/
|
||||
|
||||
// 로딩 완료 이벤트
|
||||
control.on('loadComplete', function (p) {
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||
}]);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<br/>
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
101
src/main/webapp/innorix_2/gnexam/dynamicCreate.html
Normal file
@ -0,0 +1,101 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control_array = [] //멀티컨트롤을 담을 배열 선언
|
||||
var controlFlag = 0; //컨트롤 동적 생성 시, 개별 구분을 위한 플래그 초기화
|
||||
var controlTotal = new Object(); //전체 업로드를 위한 히든 컨트롤 Object 선언
|
||||
|
||||
window.onload = function() {
|
||||
controlTotal = innorix.create({ // 전체 업로드를 위한 컨트롤 생성
|
||||
el: '#fileControlTotal', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
agent: true, // true : Agent 설치형 모드 사용, false : HTML5 모드 사용
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
});
|
||||
|
||||
// 전체 업로드 완료 이벤트
|
||||
controlTotal.on('uploadComplete', function(p){
|
||||
console.log(p);
|
||||
});
|
||||
};
|
||||
|
||||
// 컨트롤 추가 생성
|
||||
function fnControlCreate(){
|
||||
var controlName = "fileControl"+controlFlag; //컨트롤 고유 ID 구성
|
||||
var newDiv = document.createElement('div'); // div 동적 생성
|
||||
newDiv.setAttribute('id', controlName); // 생성한 div에 id지정
|
||||
document.body.appendChild(newDiv);
|
||||
|
||||
var attachBtn = document.createElement('button'); //div와 연동할 파일찾기 버튼 추가
|
||||
var label = document.createTextNode('파일선택');
|
||||
attachBtn.appendChild(label);
|
||||
attachBtn.addEventListener('click', function(){ //버튼에 파일찾기 매서드 연동
|
||||
attachFile(controlName)
|
||||
});
|
||||
document.body.appendChild(attachBtn);
|
||||
|
||||
var uploadBtn = document.createElement('button'); //div와 연동할 업로드 버튼 추가
|
||||
var label = document.createTextNode('개별업로드');
|
||||
uploadBtn.appendChild(label);
|
||||
uploadBtn.addEventListener('click', function(){ // 버튼에 업로드 매서드 연동
|
||||
uploadFile(controlName)
|
||||
});
|
||||
document.body.appendChild(uploadBtn);
|
||||
|
||||
|
||||
|
||||
control = innorix.create({ // 컨트롤 생성
|
||||
el: "#"+controlName, // 개별 Element ID 구성
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
agent: true,
|
||||
width: 500,
|
||||
height: 100,
|
||||
maxFileSize: 1024*1024
|
||||
});
|
||||
|
||||
// 컨트롤 첨부 에러 이벤트 추가
|
||||
control.on('addFileError', function(p){
|
||||
console.log(p);
|
||||
});
|
||||
|
||||
control_array[controlName] = control; //생성된 컨트롤을 배열에 추가
|
||||
|
||||
// 첨부 기능 구성
|
||||
function attachFile(controlName){
|
||||
control_array[controlName].openFileDialog();
|
||||
};
|
||||
// 업로드 기능 구성
|
||||
function uploadFile(controlName){
|
||||
control_array[controlName].upload();
|
||||
};
|
||||
|
||||
controlFlag = controlFlag+1; // 플래그 구성
|
||||
}
|
||||
|
||||
// 전체 업로드
|
||||
function totalUpload(){
|
||||
for(var i=0; i<controlFlag; i++){
|
||||
var controlName = "fileControl"+i;
|
||||
controlTotal.addFiles(control_array[controlName].getAllFiles());
|
||||
}
|
||||
controlTotal.upload();
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<p>동적으로 여러개의 컨트롤 생성 후 통합 업로드</p>
|
||||
<input type="button" value="컨트롤 생성" onclick="fnControlCreate();"/>
|
||||
|
||||
<div id="fileControlTotal" style="display:none"></div><br/>
|
||||
<input type="button" value="전체 업로드" onclick="totalUpload();"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
99
src/main/webapp/innorix_2/gnexam/errorRetryCount.html
Normal file
@ -0,0 +1,99 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
innorix.setLanguage('ko'); // 한/영설정 [en,ko]
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
transferMode : 'download', // 다운로드 모드 설정
|
||||
agent : true, // Agent 모드 사용
|
||||
|
||||
retryCount: 2, // 재전송 횟수
|
||||
retryDelay: 2, // 재전송 간격(sec)
|
||||
maximumErrorCount: 2 // 최대 에러 허용 횟수
|
||||
});
|
||||
|
||||
/*
|
||||
오류 발생 시 재전송을 시도할 횟수 설정
|
||||
|
||||
※ retryCount나 retryDelay는 내부에서 처리되는 재시도이기에 별도의 로그 및 이벤트 등으로 캐치 되지 않습니다.
|
||||
|
||||
retryCount (※ Agent 모드 전용 옵션)
|
||||
- 기본값 : 무제한
|
||||
- 전송 내부 쓰레드 재시도 횟수. 지정된 횟수만큼 내부 쓰레드의 재전송을 진행 후, Error로 상태를 반영
|
||||
즉, 전송에 문제가 있을 시 에러라고 판별하기 전까지 진행할 재전송 횟수
|
||||
|
||||
retryDelay (※ Agent 모드 전용 옵션)
|
||||
- 기본값 : 3
|
||||
- 전송 내부 쓰레드 재시도 간격으로, 몇 초마다 재시도 할 것인지를 정의
|
||||
|
||||
maximumErrorCount (※ Agent 모드 전용 옵션)
|
||||
- 기본값 : 무제한
|
||||
- 최대 에러 출력 갯수. retryCount에 따라 재시도 후 에러로 상태기록이 될때 ErrorCount가 1씩 증가
|
||||
|
||||
|
||||
[ 진행 예시 ]
|
||||
전송 ※※ --2초간격--재전송(1회) ※※ --2초간격--재전송(2회) ※※ 에러카운트(1회-downloadError 캐치)
|
||||
전송 ※※ --2초간격--재전송(1회) ※※ --2초간격--재전송(2회) ※※ 에러카운트(2회-downloadError 캐치)
|
||||
전송 ※※ --2초간격--재전송(1회) ※※ --2초간격--재전송(2회) ※※ 에러카운트(3회-downloadError 캐치) => maximumErrorCount 2회를 초과하여 전송중단.
|
||||
|
||||
[ 진행 예시 기호 풀이 ]
|
||||
오류 : ※※
|
||||
retryCount : 재전송(n회)
|
||||
retryDelay : --n초간격--
|
||||
maximumErrorCount : 에러카운트(n회)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadErr.jsp?fileID=1" //오류 발생을 위해 downloadErr.jsp(존재하지않는파일)설정
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP Brochure.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadErr.jsp?fileID=2" //오류 발생을 위해 downloadErr.jsp(존재하지않는파일)설정
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP パンフレット.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadErr.jsp?fileID=3" //오류 발생을 위해 downloadErr.jsp(존재하지않는파일)설정
|
||||
}]);
|
||||
});
|
||||
|
||||
//다운로드 에러 이벤트 (Agent 모드 전용)
|
||||
control.on('downloadError', function (p) {
|
||||
console.log(p);
|
||||
|
||||
var f = p.files;
|
||||
for(var i=0; i<f.length; i++){
|
||||
console.log("파일이름: " + f[i].fileName +"\n에러코드: " + f[i].errorCode);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
70
src/main/webapp/innorix_2/gnexam/folderCombine.html
Normal file
@ -0,0 +1,70 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
|
||||
folderIntact: true, // 폴더 첨부
|
||||
showFolderItems: true, // 폴더 구조의 리스트 출력
|
||||
showFolderItemsTree: true // 폴더 트리구조의 리스트 출력
|
||||
});
|
||||
|
||||
/*
|
||||
folderIntact (※ Agent 모드 전용 옵션)
|
||||
- 폴더첨부유무
|
||||
|
||||
showFolderItems (※ Agent 모드 전용 옵션)
|
||||
- 폴더 구조의 리스트 출력 여부
|
||||
|
||||
showFolderItemsTree (※ Agent 모드 전용 옵션)
|
||||
- 폴더트리 구조 리스트 출력 여부
|
||||
*/
|
||||
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
var fileArray = new Array();
|
||||
var f = p.files;
|
||||
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
var fileObj = new Object();
|
||||
fileObj.printFileName = f[i].clientFileName;
|
||||
fileObj.fileSize = f[i].fileSize;
|
||||
console.log('fileObj.rootName : '+f[i].rootName);
|
||||
|
||||
//폴더 정보인 rootName과 "/" 추가
|
||||
fileObj.rootName = f[i].rootName;
|
||||
fileObj.downloadUrl = urlBase + "folderCombine.jsp?rootName=" +f[i].rootName+"&fileName="+f[i].serverFileName;
|
||||
|
||||
fileArray.push(fileObj);
|
||||
}
|
||||
console.log(fileArray);
|
||||
control.removeAllFiles(); // 리스트 컨트롤에서 파일을 삭제
|
||||
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
<input type="button" value="폴더추가" onclick="control.openFolderDialog();"/> |
|
||||
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
148
src/main/webapp/innorix_2/gnexam/folderCombine.jsp
Normal file
@ -0,0 +1,148 @@
|
||||
<%@page import="com.innorix.transfer.InnorixCustomError"%>
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||
<%@ page import="java.io.*" %>
|
||||
|
||||
<%
|
||||
out.clear();
|
||||
out = pageContext.pushBody();
|
||||
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1) + "data/";
|
||||
// String filePath ="C:/Users/007/innorix/innorix/src/main/webapp/innorix/exam/data/";
|
||||
/*
|
||||
filePath
|
||||
파일이 저장된 스토리지 전체경로
|
||||
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||
윈도우 - C:/storage/path1/path2/data
|
||||
유닉스 - /storage/path1/path2/data
|
||||
*/
|
||||
|
||||
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||
String szStartOffset = request.getParameter("_StartOffset");
|
||||
String szEndOffset = request.getParameter("_EndOffset");
|
||||
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||
String fileID = request.getParameter("fileID");
|
||||
String fileName = request.getParameter("fileName");//FileName 파라메터 값
|
||||
String rootName = request.getParameter("rootName");//rootName 파라메터 값
|
||||
|
||||
|
||||
String sysFileName = new String();
|
||||
String orgFileName = new String();
|
||||
if (fileID != null) {
|
||||
if (fileID.equals("1")) {
|
||||
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||
}
|
||||
|
||||
if (fileID.equals("2")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP Brochure.pdf";
|
||||
}
|
||||
|
||||
if (fileID.equals("3")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||
}
|
||||
}
|
||||
|
||||
if (fileName != null) {
|
||||
sysFileName = rootName +"/" + fileName;
|
||||
orgFileName = fileName;
|
||||
}
|
||||
|
||||
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
|
||||
File file = new File(filePath + sysFileName);
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||
|
||||
long startOffset = 0;
|
||||
long endOffset = 0;
|
||||
|
||||
if (szStartOffset != null) {
|
||||
startOffset = Long.parseLong(szStartOffset);
|
||||
}
|
||||
|
||||
if (szEndOffset != null) {
|
||||
endOffset = Long.parseLong(szEndOffset);
|
||||
}
|
||||
|
||||
long contentLength = 0;
|
||||
|
||||
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||
contentLength = endOffset - startOffset + 1;
|
||||
} else { // html 일반 다운로드 요청시
|
||||
contentLength = file.length();
|
||||
}
|
||||
|
||||
response.setHeader("Content-Length", "" + contentLength);
|
||||
|
||||
byte b[] = new byte[8192];
|
||||
BufferedInputStream input = null;
|
||||
BufferedOutputStream output = null;
|
||||
try {
|
||||
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||
|
||||
input = new BufferedInputStream(new FileInputStream(file));
|
||||
output = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
int read = 0;
|
||||
|
||||
|
||||
if (startOffset != 0) {
|
||||
long n = input.skip(startOffset);
|
||||
if (n == -1) read = -1;
|
||||
}
|
||||
|
||||
if(contentLength > 0) {
|
||||
while (contentLength > 0) {
|
||||
if(contentLength < 8192) {
|
||||
b = new byte[(int)contentLength];
|
||||
}
|
||||
|
||||
read = input.read(b);
|
||||
|
||||
if(read == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
output.write(b, 0, read);
|
||||
contentLength = contentLength - read;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("fileID \t: " + fileID);
|
||||
System.out.println("fileName \t: " + fileName);
|
||||
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||
System.out.println("totalLength \t: " + file.length() );
|
||||
System.out.println("startOffset \t: " + startOffset);
|
||||
System.out.println("endOffset \t: " + endOffset);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(output != null) {
|
||||
output.flush();
|
||||
output.close();
|
||||
}
|
||||
|
||||
if(input != null) {
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private String delimiterReplace(String fullDir)
|
||||
{
|
||||
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||
|
||||
return ret2;
|
||||
}
|
||||
%>
|
||||
97
src/main/webapp/innorix_2/gnexam/folderDownload.html
Normal file
@ -0,0 +1,97 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
agent:true,
|
||||
folderIntact: true, //폴더첨부 유무
|
||||
showFolderItems: true, //폴더구조의 리스트 출력 여부
|
||||
showFolderItemsTree: true // 폴더 트리구조의 리스트 출력
|
||||
});
|
||||
|
||||
/*
|
||||
- 폴더 구조는 Agent 모드 전용 옵션 입니다.
|
||||
- FolderTest라는 폴더를 /innorix/gnexam/data 폴더 내에 두고 제작한 예제입니다.
|
||||
- FolderTest/folder_depth1/folder_depth2/folder_depth3 구조이며 folder_depth3은 빈 폴더입니다.
|
||||
- 해당 예제는 참고용으로 해당 파일을 참고하여 개발환경에 맞게 개발 진행해주시면 됩니다.
|
||||
*/
|
||||
|
||||
//컨트롤 로딩 완료 이벤트
|
||||
control.on('loadComplete', function (p) {
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
|
||||
var rootName_1="FolderTest";
|
||||
var rootName_2=rootName_1+"/folder_depth1";
|
||||
var rootName_3=rootName_2+"/folder_depth2";
|
||||
|
||||
/*
|
||||
- 폴더 경로를 따로 변수 안에 집어 넣지 않고 downloadUrl내 rootName 값에 직접 집어넣어주셔도 됩니다.
|
||||
*/
|
||||
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "test1.txt",
|
||||
// fileSize:36,
|
||||
downloadUrl: urlBase + "folderDownload.jsp?rootName="+rootName_1+"&fileName=test1.txt",
|
||||
rootName : rootName_1,
|
||||
isFile:true,
|
||||
isFolder:false
|
||||
/*
|
||||
- presetDownloadFiles내에 다운로드 파일 구성 시 필요한 값들을 넣어줍니다. (ex : printFileNames, fileSize, downloadUrl)
|
||||
- printFileName : 다운로드 할 파일의 이름
|
||||
- fileSize: 다운로드 할 파일의 사이즈
|
||||
(fileSize를 미작성 시 서버의 downloadUrl(downloadFolder.jsp)에 접속하여 해당 파일의 실제 사이즈를 알아옵니다.
|
||||
※ fileSize 미작성 시 서버에 접속하여 Request Method "HEAD"에 파일정보가 담겨오게됩니다. 먼저 방화벽에서 해당 메소드허용을 해주어야 합니다.)
|
||||
- downloadUrl : 파일 다운로드 진행 할 url, 폴더 경로는 rootName 값으로 서버 파일 이름은 fileName 값으로 각각 넣어줍니다.
|
||||
- isFile : 파일일 경우에는 true / 폴더일 경우에는 false로 설정해줘야 한다. 미설정 시 빈폴더일 경우 파일로 처리 됨.
|
||||
- isFolder : 위 isFile과 동일한 사유로 폴더일 경우에는 true / 파일일 경우에는 false로 설정해줘야 한다.
|
||||
*/
|
||||
},
|
||||
{
|
||||
printFileName: "test2.txt",
|
||||
downloadUrl: urlBase + "folderDownload.jsp?rootName="+rootName_2+"&fileName=test2.txt",
|
||||
// fileSize:39,
|
||||
rootName : rootName_2,
|
||||
isFile:true,
|
||||
isFolder:false
|
||||
},
|
||||
{
|
||||
printFileName: "test3.txt",
|
||||
downloadUrl: urlBase + "folderDownload.jsp?rootName="+rootName_3+"&fileName=test3.txt",
|
||||
// fileSize:11,
|
||||
rootName : rootName_3,
|
||||
isFile:true,
|
||||
isFolder:false
|
||||
},
|
||||
{
|
||||
printFileName: "folder_depth3",
|
||||
downloadUrl: urlBase + "folderDownload.jsp?rootName="+rootName_3+"&fileName=",
|
||||
fileSize:0,
|
||||
rootName : rootName_3,
|
||||
isFile:false,
|
||||
isFolder:true
|
||||
}
|
||||
]);
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
144
src/main/webapp/innorix_2/gnexam/folderDownload.jsp
Normal file
@ -0,0 +1,144 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixDownload" %>
|
||||
<%@ page import="java.io.*" %>
|
||||
|
||||
<%
|
||||
out.clear();
|
||||
out = pageContext.pushBody();
|
||||
|
||||
String saveDir = delimiterReplace(request.getRealPath(request.getServletPath()));
|
||||
String filePath = saveDir.substring(0, saveDir.lastIndexOf("/") + 1);
|
||||
|
||||
/*
|
||||
filePath
|
||||
파일이 저장된 스토리지 전체경로
|
||||
디렉토리 구분은 윈도우, 유닉스 모두 "/" 문자 사용
|
||||
윈도우 - C:/storage/path1/path2/data
|
||||
유닉스 - /storage/path1/path2/data
|
||||
*/
|
||||
|
||||
// downloadType : "stream" 설정시 자동 전달되는 GET Param 값
|
||||
String szStartOffset = request.getParameter("_StartOffset");
|
||||
String szEndOffset = request.getParameter("_EndOffset");
|
||||
|
||||
// 파일 스트림 데이터 참조용 GET Param 값, 파라메터 명은 자유 형식
|
||||
String fileID = request.getParameter("fileID");
|
||||
String fileName = request.getParameter("fileName");
|
||||
String rootName = request.getParameter("rootName");
|
||||
String sysFileName = new String();
|
||||
String orgFileName = new String();
|
||||
|
||||
if (fileID != null) {
|
||||
if (fileID.equals("1")) {
|
||||
sysFileName = "sample-file.pdf"; // 시스템 저장 파일명
|
||||
orgFileName = "INNORIX WP 브로셔.pdf"; // 원본 파일명
|
||||
}
|
||||
|
||||
if (fileID.equals("2")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP Brochure.pdf";
|
||||
}
|
||||
|
||||
if (fileID.equals("3")) {
|
||||
sysFileName = "sample-file.pdf";
|
||||
orgFileName = "INNORIX WP パンフレット.pdf";
|
||||
}
|
||||
}
|
||||
|
||||
if (fileName != null) {
|
||||
sysFileName = "data/"+rootName+"/" + fileName;
|
||||
orgFileName = fileName;
|
||||
}
|
||||
|
||||
// 파일명 깨짐대응 문자열 인코딩 처리
|
||||
orgFileName = java.net.URLEncoder.encode(orgFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
|
||||
File file = new File(filePath + sysFileName);
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + orgFileName +"\"");
|
||||
|
||||
long startOffset = 0;
|
||||
long endOffset = 0;
|
||||
|
||||
if (szStartOffset != null) {
|
||||
startOffset = Long.parseLong(szStartOffset);
|
||||
}
|
||||
|
||||
if (szEndOffset != null) {
|
||||
endOffset = Long.parseLong(szEndOffset);
|
||||
}
|
||||
|
||||
long contentLength = 0;
|
||||
|
||||
if(szStartOffset != null || szEndOffset != null) { // 컨트롤 다운로드 요청시
|
||||
contentLength = endOffset - startOffset + 1;
|
||||
} else { // html 일반 다운로드 요청시
|
||||
contentLength = file.length();
|
||||
}
|
||||
|
||||
response.setHeader("Content-Length", "" + contentLength);
|
||||
|
||||
byte b[] = new byte[8192];
|
||||
BufferedInputStream input = null;
|
||||
BufferedOutputStream output = null;
|
||||
|
||||
try {
|
||||
input = new BufferedInputStream(new FileInputStream(file));
|
||||
output = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
int read = 0;
|
||||
|
||||
if (startOffset != 0) {
|
||||
long n = input.skip(startOffset);
|
||||
if (n == -1) read = -1;
|
||||
}
|
||||
|
||||
if(contentLength > 0) {
|
||||
while (contentLength > 0) {
|
||||
if(contentLength < 8192) {
|
||||
b = new byte[(int)contentLength];
|
||||
}
|
||||
|
||||
read = input.read(b);
|
||||
|
||||
if(read == -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
output.write(b, 0, read);
|
||||
contentLength = contentLength - read;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("fileID \t: " + fileID);
|
||||
System.out.println("sysFilePath \t: " + filePath + sysFileName);
|
||||
System.out.println("orgFileName \t: " + java.net.URLDecoder.decode(orgFileName, "UTF-8"));
|
||||
System.out.println("totalLength \t: " + file.length() );
|
||||
System.out.println("startOffset \t: " + startOffset);
|
||||
System.out.println("endOffset \t: " + endOffset);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(output != null) {
|
||||
output.flush();
|
||||
output.close();
|
||||
}
|
||||
|
||||
if(input != null) {
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
%>
|
||||
|
||||
<%!
|
||||
private String delimiterReplace(String fullDir)
|
||||
{
|
||||
String ret1 = fullDir.replaceAll("\\\\+", "/");
|
||||
String ret2 = ret1.replaceAll("\\/+", "/");
|
||||
|
||||
return ret2;
|
||||
}
|
||||
%>
|
||||
58
src/main/webapp/innorix_2/gnexam/folderIntact.html
Normal file
@ -0,0 +1,58 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './uploadNotFolder.jsp', // 업로드 URL
|
||||
folderIntact: false //폴더첨부 유무
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
folderIntact : 폴더 첨부 가능 여부 (※ Agent 모드 전용 옵션)
|
||||
|
||||
- folderIntact : true // 폴더 첨부 가능
|
||||
- folderIntact : false // 폴더 첨부 불가능
|
||||
|
||||
※ folderIntact : false로 지정하여 UI단에서 첨부가 안되게 하여도 서버에서의 파일 저장은 컨트롤 리스트 내 보여지는 대로가 아닌, 가지고 있는 값을 기준으로 저장합니다.
|
||||
폴더 구조 대로가 아닌 '파일만' 저장하려고 하는 경우 jsp 단에서 처리를 해줘야 합니다.
|
||||
*/
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
|
||||
var files = JSON.stringify(f);
|
||||
console.log(files);
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||
// innoJquery('form#f_write').submit();
|
||||
});
|
||||
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="폴더추가" onclick="control.openFolderDialog();"/> |
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
49
src/main/webapp/innorix_2/gnexam/hideServerPathInfo.html
Normal file
@ -0,0 +1,49 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './hideServerPathInfo.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
|
||||
var files = JSON.stringify(f);
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||
//innoJquery('form#f_write').submit();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||
test1 : <input type="text" name="test1" />
|
||||
</form><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
71
src/main/webapp/innorix_2/gnexam/hideServerPathInfo.jsp
Normal file
@ -0,0 +1,71 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||
<%-- File import --%>
|
||||
<%@page import="java.io.File"%>
|
||||
|
||||
<%
|
||||
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||
if ("POST".equals(request.getMethod()))
|
||||
{
|
||||
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||
int maxPostSize = 2147482624; // bytes
|
||||
|
||||
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||
|
||||
/*
|
||||
전달되는 _action Param 정보
|
||||
speedCheck : 전송속도 측정
|
||||
getServerInfo : 서버정보 확인
|
||||
getFileInfo : 파일정보 확인
|
||||
attachFile : 파일전송 진행
|
||||
attachFileCompleted : 파일전송 완료
|
||||
*/
|
||||
|
||||
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||
String _type = uploader.getParameter("type"); // 커스텀 정의 POST Param 1
|
||||
String _part = uploader.getParameter("part"); // 커스텀 정의 POST Param 2
|
||||
String _transferId = uploader.getParameter("_transferId"); // TransferId
|
||||
|
||||
/*
|
||||
업로드 간 메타정보 상 노출되는 서버 경로를 숨기기 위한 방법
|
||||
( 업로드 완료 시 클라이언트에 서버에 저장된 파일의 절대 경로가 노출되기 때문에 보안 상 노출이 안 되도록 설정 )
|
||||
uploader.setHideServerPathInfo(true);
|
||||
- uploader.run() 이전에 설정
|
||||
- 해당 설정 시 파일 전송 간 발생되는 통신 구간에서는 서버 경로 정보를 주고 받지 않기 위해
|
||||
InnorixUplaod 클래스를 객체화 할 때 지정해주는 directory 값을 고정으로 업로드하며, setDirectory와 함께 사용할 수 없음
|
||||
*/
|
||||
|
||||
uploader.setHideServerPathInfo(true); //업로드 서버경로 숨김처리
|
||||
String _run_retval = uploader.run();
|
||||
|
||||
// 개별파일 업로드 완료
|
||||
if("attachFileCompleted".equals(_action)) {
|
||||
|
||||
System.out.println("========== uploader.isUploadDone() " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("_orig_filename \t = " + _orig_filename); // 원본 파일명
|
||||
System.out.println("_new_filename \t = " + _new_filename); // 저장 파일명
|
||||
|
||||
/* 업로드 서버 경로 숨김처리 시 저장경로 확인 방법 */
|
||||
System.out.println("_filepath \t = " + _filepath); // 파일 저장경로 (업로드 서버 경로 숨김처리하여 빈값으로 출력)
|
||||
String strDir = uploader.getDirectory(); // 서버에 저장되는 폴더경로
|
||||
System.out.println("strDir \t = " + strDir);
|
||||
String strSrvFilePath = strDir.concat(File.separator).concat(_new_filename);
|
||||
System.out.println("strSrvFilePath \t = " + strSrvFilePath); //서버에 저장된 파일 위치
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// CORS 관련 헤더 추가
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||
%>
|
||||
88
src/main/webapp/innorix_2/gnexam/html5ImageUpload.html
Normal file
@ -0,0 +1,88 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
innorix.setLanguage('ko');
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'upload', // 업로드, 다운로드 혼합사용
|
||||
agent : false,
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
allowExtension : ["png", "jpg", "jpeg"],
|
||||
showPreviewImage: true, // 이미지 미리보기
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
|
||||
var files = JSON.stringify(f);
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||
//innoJquery('form#f_write').submit();
|
||||
});
|
||||
|
||||
// 파일 선택 시
|
||||
control.on('onSelectRows', function (p) {
|
||||
console.log(p);
|
||||
console.log('---------------------------');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function imageUpload(){
|
||||
control.appendThumbnailProperty("ALL", 300, 300, "FIX");
|
||||
|
||||
control.upload();
|
||||
}
|
||||
|
||||
/*
|
||||
이미지 미리보기
|
||||
- 옵션 : showPreviewImage: true
|
||||
|
||||
- 썸네일 생성(리사이징) : control.appendThumbnailProperty((1), (2), (3), (4));
|
||||
(1) 리사이징을 진행할 원본 이미지 인덱스 Number를 입력해주시거나 ALL을 입력받습니다.
|
||||
ex: control.appendThumnailProperty(1, 300, 300, "VERTICAL");
|
||||
(2) 가로 픽셀 사이즈 (Number)
|
||||
(3) 세로 픽셀 사이즈 (Number)
|
||||
(4) 리사이징을 진행할 가로세로 기준
|
||||
VERTICAL : 세로축 기준 리사이징
|
||||
HORIZONTAL : 가로축 기준 리사이징
|
||||
FIX : 설정한 사이즈에 맞게 리사이징(비율무시)
|
||||
|
||||
- 워터마크 추가
|
||||
(1) 워터마크를 적용할 원본 파일 인덱스 Number를 입력해주시거나 ALL을 입력받습니다.
|
||||
ex : control.appendWatermarkProperty(2, "innorix_logo.png", "LEFT|MIDDLE")
|
||||
(2) 워터마크 이미지 URL
|
||||
(3) 워터마크를 적용할 위치 ("횡축|종축") ("가로|세로")
|
||||
가로 기준 위치 : "LEFT" / "RIGHT" / "CENTER"
|
||||
세로 기준 위치 : "TOP" / "BOTTOM" / "MIDDLE"
|
||||
*/
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<form action="resultImg.jsp" id="f_write" name="f_write" method="post">
|
||||
test1 : <input type="text" name="test1" />
|
||||
</form><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="imageUpload();"/>
|
||||
</body>
|
||||
</html>
|
||||
114
src/main/webapp/innorix_2/gnexam/html5PreviewImgAll.html
Normal file
@ -0,0 +1,114 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-latest.min.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
innorix.setLanguage('ko');
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'upload', // 업로드, 다운로드 혼합사용
|
||||
agent : false, // Html5모드 (무설치형)
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
allowExtension : ["png", "jpg", "jpeg"],
|
||||
showPreviewImage: true, // 이미지 미리보기
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
});
|
||||
|
||||
// 파일 첨부시 에러
|
||||
control.on('addFileError', function (p) {
|
||||
alert(p[0].message + "\n " + p[0].type);
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
|
||||
// 파일 선택 시
|
||||
control.on('onSelectRows', function (p) {
|
||||
console.log(p);
|
||||
|
||||
if(p[0].printFileName.includes(".png") || p[0].printFileName.includes(".jpg")){
|
||||
console.log(p[0].rowID);
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
// 미리보기 (이미지 전체)
|
||||
function fnShowPreviewAll(){
|
||||
var f = control.getAllFiles(); // 첨부한 전체 파일 정보
|
||||
console.log(f);
|
||||
|
||||
var previewAllZone = $("#previewAllZone"); // 이미지 출력 영역
|
||||
var imageCount = 0; // 이미지 로딩 카운터
|
||||
var totalImages = 0; // 총 이미지 수
|
||||
|
||||
for(var i=0; i<f.length; i++){
|
||||
if(f[i].printFileName.includes(".png") || f[i].printFileName.includes(".jpg")){ // png, jpg 이미지 파일만 구분
|
||||
totalImages++; // 총 이미지 수 증가
|
||||
var fileInfo = control.getFileById(f[i].rowID);
|
||||
|
||||
var blobSrc = URL.createObjectURL(fileInfo.file); // blob 형태의 이미지 파일 링크 생성
|
||||
// 이미지 출력 예시 <img src="blob:http://도메인/랜덤id">
|
||||
|
||||
var imgTag = document.createElement('img');
|
||||
|
||||
// 이미지 로딩 완료 이벤트 처리
|
||||
imgTag.onload = function() {
|
||||
imageCount++;
|
||||
if (imageCount === totalImages) { // 모든 이미지 로딩 완료
|
||||
$("#previewAllZone").show();
|
||||
|
||||
|
||||
for (var j = 0; j < totalImages; j++) {
|
||||
URL.revokeObjectURL(blobSrc); // 모든 이미지 로딩 완료 후 메모리에서 해제
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
imgTag.src = blobSrc; // 이미지 태그에 blob링크 속성 추가
|
||||
console.log(imgTag);
|
||||
previewAllZone.append(imgTag); // 이미지 출력 영역에 append
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 닫기
|
||||
function fnClose(){
|
||||
$("#previewAllZone").empty();
|
||||
$("#previewAllZone").hide();
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<style>
|
||||
#previewAllZone{display:none; width:800px; height:400px; border:2px solid #666; background-color:#f2f2f2;}
|
||||
#previewAllZone > img{max-width: 200px; max-height: 200px; display:inline-block;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
|
||||
<input type="button" id="previewAllBtn" data-rowid="" value="미리보기(전체)" onclick="fnShowPreviewAll();"/>
|
||||
<div id="previewAllZone" onclick="fnClose();"></div>
|
||||
</body>
|
||||
</html>
|
||||
15
src/main/webapp/innorix_2/gnexam/iframe.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script src="../jquery-3.5.1.min.js"></script>
|
||||
<title>Insert title here</title>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="http://localhost:4040/innorix/gnexam0/uploadIframe.html" style="width:600px; height:400px">
|
||||
|
||||
</iframe>
|
||||
</body>
|
||||
</html>
|
||||
BIN
src/main/webapp/innorix_2/gnexam/img/agent.png
Normal file
|
After Width: | Height: | Size: 586 B |
BIN
src/main/webapp/innorix_2/gnexam/img/close-blue.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/main/webapp/innorix_2/gnexam/img/code.png
Normal file
|
After Width: | Height: | Size: 603 B |
BIN
src/main/webapp/innorix_2/gnexam/img/dropzone.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
src/main/webapp/innorix_2/gnexam/img/favicon.ico
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
src/main/webapp/innorix_2/gnexam/img/gnlogo.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
src/main/webapp/innorix_2/gnexam/img/gnlogo_w_png.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src/main/webapp/innorix_2/gnexam/img/html5.png
Normal file
|
After Width: | Height: | Size: 441 B |
|
After Width: | Height: | Size: 2.1 KiB |
BIN
src/main/webapp/innorix_2/gnexam/img/move-blue.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
src/main/webapp/innorix_2/gnexam/img/notice.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
src/main/webapp/innorix_2/gnexam/img/pdf.png
Normal file
|
After Width: | Height: | Size: 591 B |
BIN
src/main/webapp/innorix_2/gnexam/img/top_btn.jpg
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
68
src/main/webapp/innorix_2/gnexam/installCheckPage.html
Normal file
@ -0,0 +1,68 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
|
||||
var winInstallFileURL = "../install/INNORIX-Agent.exe";
|
||||
var macInstallFileURL = "../install/INNORIX-Agent.pkg";
|
||||
var linuxX64InstallFileURL = "../install/INNORIX-Agent.bin";
|
||||
var linuxX86InstallFileURL = "../install/INNORIX-Agent.bin";
|
||||
|
||||
window.onload = function () {
|
||||
innorix.checkAgentInstalled(function (result) {
|
||||
if (!result) {
|
||||
console.log(result)
|
||||
if (confirm("에이전트 설치가 안됐습니다 설치 하시겠습니까?")) {
|
||||
agent = true;
|
||||
if (navigator.platform == "Win32") {
|
||||
location.href = winInstallFileURL;
|
||||
} else if (navigator.platform == "Win64") {
|
||||
location.href = winInstallFileURL;
|
||||
} else if (navigator.platform == "Linux x86_64") {
|
||||
location.href = linuxX64InstallFileURL;
|
||||
} else if (navigator.platform == "Linux i686") {
|
||||
location.href = linuxX86InstallFileURL;
|
||||
} else {
|
||||
location.href = macInstallFileURL;
|
||||
}
|
||||
} else {
|
||||
|
||||
return null
|
||||
}
|
||||
} else {
|
||||
console.log(result)
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
agent: true,
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||
test1 : <input type="text" name="test1" />
|
||||
</form><br />
|
||||
|
||||
<div id="fileControl"></div><br />
|
||||
|
||||
<input type="button" value="설치 확인" onclick="" />
|
||||
<input type="button" value="컨트롤 생성" onclick="controlCreate();" />
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
85
src/main/webapp/innorix_2/gnexam/installPopup.html
Normal file
@ -0,0 +1,85 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
innorix.setLanguage('ko');
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
installUrl: '../install/install2.html', // Agent 설치 페이지
|
||||
|
||||
installPopupWindow: true, // Agent설치 시 다른 페이지로 이동하지 않고 팝업창으로 띄우기 (※브라우저에서 팝업 허용을 해주어야합니다.)
|
||||
installPopupWindowHeight: 400, // 출력되는 팝업창 높이
|
||||
installPopupWindowWidth: 500, // 출력되는 팝업창 폭
|
||||
installPopupWindowLeft: 100, // 출력되는 팝업창 장축 기준 위치
|
||||
installPopupWindowTop: 50 // 출력되는 팝업창 상단 기준 위치
|
||||
});
|
||||
|
||||
/*
|
||||
installPopupWindow (※ Agent 모드 전용 옵션)
|
||||
- false (기본값, 기존페이지에서 출력)
|
||||
- true (설치페이지가 팝업으로 출력)
|
||||
*/
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
|
||||
var files = JSON.stringify(f);
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||
innoJquery('form#f_write').submit();
|
||||
});
|
||||
};
|
||||
|
||||
// 팝업창 종료시점 감지하기
|
||||
var g_oWindow = null;
|
||||
var g_oInterval = null;
|
||||
var popup = function() {
|
||||
g_oWindow = window.open('http://localhost:8118/innorixjsp/innorix/install/install2.html', 'agent install');
|
||||
// 0.5초 마다 감지
|
||||
g_oInterval = window.setInterval(function() {
|
||||
try {
|
||||
console.log('00000000');
|
||||
// 창이 꺼졌는지 판단
|
||||
if( g_oWindow == null || g_oWindow.closed ) {
|
||||
window.clearInterval(g_oInterval);
|
||||
g_oWindow = null;
|
||||
//opener.parent.location.reload();
|
||||
location.reload();
|
||||
// Todo....
|
||||
//.....
|
||||
alert('창 close');
|
||||
}
|
||||
} catch (e) { }
|
||||
}, 500);
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||
test1 : <input type="text" name="test1" />
|
||||
</form><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
67
src/main/webapp/innorix_2/gnexam/isTempFileSize.html
Normal file
@ -0,0 +1,67 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
|
||||
agent : true // Agent 모드 사용
|
||||
});
|
||||
|
||||
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885, // 실제 파일 사이즈
|
||||
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP Brochure.pdf",
|
||||
fileSize: 143, // 가상의 파일 사이즈
|
||||
isTempFileSize : true,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP パンフレット.pdf",
|
||||
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||
}]);
|
||||
});
|
||||
/*
|
||||
|
||||
isTempFileSize (※ Agent 모드 전용 옵션)
|
||||
|
||||
- presetDownloadFiles 구성 시 fileSize를 미작성 시 서버의 downloadUrl(download.jsp)에 접속하여 해당 파일의 실제 사이즈를 알아옵니다.
|
||||
실제파일사이즈과 다르게 작성 시 다운로드가 정상적으로 진행되지 않습니다.
|
||||
이때 isTempFileSize 옵션을 통해 가상의 파일사이즈를 작성하여도 정상 다운로드 되게 합니다.
|
||||
(※ fileSize 미작성 시 서버에 접속하여 Request Method "HEAD"에 파일정보가 담겨오게됩니다. 먼저 방화벽에서 해당 메소드허용을 해주어야 합니다.)
|
||||
|
||||
- 선언된 파일 사이즈가 실제 파일 사이즈가 아닌 가상 파일 사이즈임을 선언하는 것으로
|
||||
잘못 입력된 다운로드 fileSize를 무시하고, 요청하는 downloadUrl에서 던져주는 데이터만큼 전송이 진행됩니다.
|
||||
이에 분할 전송이 불가능하며, 고속전송 및 이어받기, 에러 시 중간지점에서부터의 재시도 등 부가기능이 제한됩니다.
|
||||
|
||||
*/
|
||||
|
||||
control.on('downloadCancel', function (p) {
|
||||
alert("다운로드가 취소되었습니다.");
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
54
src/main/webapp/innorix_2/gnexam/pdfPreview.html
Normal file
@ -0,0 +1,54 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
|
||||
var control = new Object();
|
||||
window.onload = function () {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
showPreviewPdf: true,
|
||||
uploadUrl: './upload.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
alert("업로드가 완료 되었습니다.\n다운로드 가능하게 재구성 합니다.");
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
var fileArray = new Array();
|
||||
var f = p.files;
|
||||
|
||||
for (var i = 0; i < f.length; i++) {
|
||||
var fileObj = new Object();
|
||||
fileObj.printFileName = f[i].clientFileName;
|
||||
fileObj.fileSize = f[i].fileSize;
|
||||
fileObj.downloadUrl = urlBase + "download.jsp?fileName=" + f[i].serverFileName;
|
||||
fileArray.push(fileObj);
|
||||
}
|
||||
console.log(fileArray);
|
||||
control.removeAllFiles(); // 리스트 컨트롤에서 파일을 삭제
|
||||
control.presetDownloadFiles(fileArray); // 다운로드 목록을 구성
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br />
|
||||
|
||||
<input type="button" value="파일추가" onclick="control.openFileDialog();" />
|
||||
<input type="button" value="업로드" onclick="control.upload();" /> |
|
||||
<input type="button" value="선택파일 다운로드" onclick="control.downloadSelectedFiles();" />
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();" />
|
||||
</body>
|
||||
|
||||
</html>
|
||||
74
src/main/webapp/innorix_2/gnexam/postData.html
Normal file
@ -0,0 +1,74 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
transferMode: 'upload', // 업로드, 다운로드 혼합사용
|
||||
uploadUrl: './postData.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
};
|
||||
|
||||
// 업로드
|
||||
function upload() {
|
||||
var fileInfo = control.getAllFiles(); // 모든 파일 정보 출력
|
||||
if (fileInfo.length == 0 ) { // 파일 개수가 0 이면 return
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
커스텀 포스트 데이터
|
||||
- 파일 전송 시 임의의 데이터를 함께 전송하여 서버에서 처리할 수 있도록 구성
|
||||
- 임의의 데이터는 한 전송 트랙잭션 당 또는 개별 파일마다 추가가 가능
|
||||
|
||||
control.setPostData(postObj); // 트랜잭션 별 postData
|
||||
control.setFilePostDataByIndex(i, postObj); // 파일 별 postData
|
||||
*/
|
||||
|
||||
// 트랜잭션 별 업로드시 함께 전달될 POST Param 추가
|
||||
var postObj1 = new Object(); // postdata 를 전달할 object 객체 생성
|
||||
var paramVal = "Transaction";
|
||||
postObj1.transParam1 = paramVal; // 임의의 텍스트 할당
|
||||
postObj1.transParam2 = fileInfo[0].mode; // 전송모드 할당
|
||||
control.setPostData(postObj1); // 트랜잭션 별 postdata로 값 저장
|
||||
|
||||
|
||||
// 파일 별 업로드시 함께 전달될 POST Param 추가
|
||||
for (i=0; i<fileInfo.length; i++){
|
||||
var postObj2 = new Object(); // 파일별 postdata를 전달할 object 객체 생성
|
||||
postObj2.fileParam1 = fileInfo[i].fileSize; // 각 파일 index의 fileSize 할당
|
||||
postObj2.fileParam2 = fileInfo[i].printFileName; // 각 파일 index의 printFileName 할당
|
||||
control.setFilePostDataByIndex(i, postObj2); // 파일별 postdata로 값 저장
|
||||
}
|
||||
|
||||
control.upload(); // 파일 업로드 시작
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="upload();"/>
|
||||
<input type="button" value="업로드2" onclick="control.upload();"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
56
src/main/webapp/innorix_2/gnexam/postData.jsp
Normal file
@ -0,0 +1,56 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||
|
||||
<%
|
||||
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||
if ("POST".equals(request.getMethod()))
|
||||
{
|
||||
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||
int maxPostSize = 2147482624; // bytes
|
||||
|
||||
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||
|
||||
/*
|
||||
전달되는 _action Param 정보
|
||||
speedCheck : 전송속도 측정
|
||||
getServerInfo : 서버정보 확인
|
||||
getFileInfo : 파일정보 확인
|
||||
attachFile : 파일전송 진행
|
||||
attachFileCompleted : 파일전송 완료
|
||||
*/
|
||||
|
||||
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||
|
||||
String fileParam1 = uploader.getParameter("fileParam1"); // 파일 별 커스텀 정의 POST Param 1
|
||||
String fileParam2 = uploader.getParameter("fileParam2"); // 파일 별 커스텀 정의 POST Param 2
|
||||
String transParam1 = uploader.getParameter("transParam1"); // 전송 별 커스텀 정의 POST Param 3
|
||||
String transParam2 = uploader.getParameter("transParam2"); // 전송 별 커스텀 정의 POST Param 4
|
||||
|
||||
String _run_retval = uploader.run();
|
||||
|
||||
// 개별파일 업로드 완료
|
||||
if("attachFileCompleted".equals(_action)) {
|
||||
System.out.println("========== innorix transfer " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("_action \t = " + _action);
|
||||
System.out.println("트랜잭션별 \t transParam1 : " + transParam1 + ", transParam2 : " + transParam2);
|
||||
System.out.println("파일별 \t fileParam1 : " + fileParam1 + ", fileParam2 : " + fileParam2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// CORS 관련 헤더 추가
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||
%>
|
||||
18
src/main/webapp/innorix_2/gnexam/result.jsp
Normal file
@ -0,0 +1,18 @@
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<%
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
java.util.Enumeration names = request.getParameterNames();
|
||||
|
||||
while (names.hasMoreElements()) {
|
||||
String name = (String)names.nextElement();
|
||||
String values[] = request.getParameterValues(name);
|
||||
|
||||
if (values != null) {
|
||||
for (int i=0; i< values.length; i++) {
|
||||
System.out.println ( i + ". " + name + " = " + values[i]);
|
||||
out.println ( i + ". " + name + " = " + values[i] + "<br />");
|
||||
}
|
||||
}
|
||||
}
|
||||
%>
|
||||
BIN
src/main/webapp/innorix_2/gnexam/sample-file.pdf
Normal file
96
src/main/webapp/innorix_2/gnexam/setAddFilePolicy.html
Normal file
@ -0,0 +1,96 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
//innorix.setLanguage("ko");
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
/**
|
||||
allowExtension: { // 정의된 확장자 파일만 추가 - 그룹화방식 { "그룹명" : [허용확장자] }
|
||||
"Image files (*.jpg, *.png)" : ["jpg", "png"],
|
||||
"Pdf files (*.pdf)" : ["pdf"]
|
||||
},
|
||||
**/
|
||||
limitExtension: ["exe"], // 정의된 확장자 파일을 제외
|
||||
});
|
||||
|
||||
/*
|
||||
※ 파일 첨부 정책 설정
|
||||
|
||||
01. addDuplicateFile
|
||||
- 중복파일 추가 유무
|
||||
02. maxFileCont
|
||||
- 첨부 파일 개수 제한
|
||||
03. maxTotalSize
|
||||
- 첨부 전체 파일 사이즈 제한
|
||||
04. allowExtension
|
||||
- 정의된 확장자 파일만 추가
|
||||
- limitExtension과 동일 확장자 정책 지정 시, limitExtension을 우선 적용
|
||||
05. limitExtension
|
||||
- 정의된 확장자 파일을 제외
|
||||
06. maxFileSize
|
||||
- 개별 파일의 사이즈 제한
|
||||
*/
|
||||
|
||||
// 파일 첨부시 에러
|
||||
control.on('addFileError', function (p) {
|
||||
|
||||
console.log(p);
|
||||
console.log(p[0].type); // 위반된 정책 명
|
||||
console.log(p[0].message); // 위반 메세지
|
||||
|
||||
alert(p[0].type + "\n" + p[0].message);
|
||||
|
||||
/*
|
||||
이노릭스 기본메세지가아닌 다른 메세지를 출력하는 방법
|
||||
if(p[0].type == "allowExtension") {
|
||||
alert("확장자 제한");
|
||||
} else if(p[0].type == "maxFileCount") {
|
||||
alert("첨부 파일 개수 제한");
|
||||
} else if(p[0].type == "maxTotalSize") {
|
||||
alert("전체 파일 사이즈 제한");
|
||||
} else if(p[0].type == "limitExtension") {
|
||||
alert("확장자 제한");
|
||||
} else if(p[0].type == "addDuplicateFile") {
|
||||
alert("중복파일 제한");
|
||||
} else if(p[0].type == "maxFileSize") {
|
||||
alert("개별 파일 사이즈 제한");
|
||||
}
|
||||
|
||||
*/
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
57
src/main/webapp/innorix_2/gnexam/setDownloadDelay.html
Normal file
@ -0,0 +1,57 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
agent: false, // true : Agent 설치형 모드 사용, false : HTML5 모드 사용
|
||||
|
||||
downloadDelay: 1000 // ms 단위 다운로드 딜레이 설정 | 기본 : 200
|
||||
});
|
||||
/*
|
||||
downloadDelay
|
||||
- 다운로드 딜레이 설정 (기본값 : 0.2초)
|
||||
빠르고 반복되게 다운로드 요청이 이루어질 때, 브라우저 자체에서 악성 접근으로 감지하여
|
||||
차단되어 다운로드가 정상적으로 진행되지 않을 수 있습니다.
|
||||
해당 경우 downloadDelay 옵션을 통해 딜레이 시간을 보다 길게 설정하여 조치할 수 있습니다.
|
||||
*/
|
||||
|
||||
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP Brochure.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP パンフレット.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||
}]);
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
72
src/main/webapp/innorix_2/gnexam/setDownloadPath.html
Normal file
@ -0,0 +1,72 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
innorix.setLanguage('ko');
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
transferStart : {"download":"auto"}, //
|
||||
agent : true, // true : Agent 설치형 모드 사용, false : HTML5 모드 사용
|
||||
});
|
||||
|
||||
/*
|
||||
※ transferStart (전송 자동시작 유무)
|
||||
- 기본값 transferStart : { "upload":"auto", "download": "manual"}
|
||||
- auto : 자동으로 전송시작
|
||||
- manual : 사용자 확인 후 전송
|
||||
*/
|
||||
|
||||
// 현재 사용자 다운로드 경로 가져오기 - ※ 기본경로는 C:\Users\사용자\Downloads 로 설정되어 있습니다.
|
||||
control.getDownloadPath(function(response) {
|
||||
console.log("현재 경로 : "+response);
|
||||
document.getElementById("downloadPath").innerHTML=response;
|
||||
});
|
||||
|
||||
// 로딩 완료 이벤트
|
||||
control.on('loadComplete', function (p) {
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||
}]);
|
||||
});
|
||||
|
||||
// 다운로드 완료 이벤트 - ※ Agent 모드 전용 옵션
|
||||
control.on('downloadComplete', function (p) {
|
||||
alert('다운로드 완료');
|
||||
control.openDownloadFolder(); // 다운로드 완료 후 다운로드 폴더 열기
|
||||
});
|
||||
};
|
||||
|
||||
// 경로변경
|
||||
function changePath(){
|
||||
control.setDownloadPath(function(response){ //경로선택 다이얼로그 출력, 선택한 경로는 response로 리턴
|
||||
if (response.result==true){ //response가 유효한 경우, 해당 경로로 다운로드 진행
|
||||
document.getElementById("downloadPath").innerHTML=response.value;
|
||||
}else {
|
||||
console.log("경로 변경 안함");
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../index.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div>현재 다운로드 경로 : <span id="downloadPath"></span> <input type="button" value="경로변경" onclick="changePath();"/></div>
|
||||
<br/>
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
98
src/main/webapp/innorix_2/gnexam/setErrorRetry.html
Normal file
@ -0,0 +1,98 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
transferMode : 'download', // 다운로드 모드 설정
|
||||
agent : true, // Agent 모드 사용
|
||||
|
||||
retryCount: 2, // 재전송 횟수
|
||||
retryDelay: 1, // 재전송 간격(sec)
|
||||
maximumErrorCount: 2 // 최대 에러 허용 횟수
|
||||
});
|
||||
|
||||
/*
|
||||
오류 발생 시 재전송을 시도할 횟수 설정
|
||||
|
||||
※ retryCount나 retryDelay는 내부에서 처리되는 재시도이기에 별도의 로그 및 이벤트 등으로 캐치 되지 않습니다.
|
||||
|
||||
retryCount (※ Agent 모드 전용 옵션)
|
||||
- 기본값 : 무제한
|
||||
- 전송 내부 쓰레드 재시도 횟수. 지정된 횟수만큼 내부 쓰레드의 재전송을 진행 후, Error로 상태를 반영
|
||||
즉, 전송에 문제가 있을 시 에러라고 판별하기 전까지 진행할 재전송 횟수
|
||||
|
||||
retryDelay (※ Agent 모드 전용 옵션)
|
||||
- 기본값 : 3
|
||||
- 전송 내부 쓰레드 재시도 간격으로, 몇 초마다 재시도 할 것인지를 정의
|
||||
|
||||
maximumErrorCount (※ Agent 모드 전용 옵션)
|
||||
- 기본값 : 무제한
|
||||
- 최대 에러 출력 갯수. retryCount에 따라 재시도 후 에러로 상태기록이 될때 ErrorCount가 1씩 증가
|
||||
|
||||
|
||||
[ 진행 예시 ]
|
||||
전송 ※※ --1초간격--재전송(1회) ※※ --1초간격--재전송(2회) ※※ 에러카운트(1회-downloadError 캐치)
|
||||
전송 ※※ --1초간격--재전송(1회) ※※ --1초간격--재전송(2회) ※※ 에러카운트(2회-downloadError 캐치)
|
||||
전송 ※※ --1초간격--재전송(1회) ※※ --1초간격--재전송(2회) ※※ 에러카운트(3회-downloadError 캐치) => maximumErrorCount 2회를 초과하여 전송중단.
|
||||
|
||||
[ 진행 예시 기호 풀이 ]
|
||||
오류 : ※※
|
||||
retryCount : 재전송(n회)
|
||||
retryDelay : --n초간격--
|
||||
maximumErrorCount : 에러카운트(n회)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
control.on('loadComplete', function (p) { // 다운로드 파일 추가
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
|
||||
control.presetDownloadFiles(
|
||||
[{
|
||||
printFileName: "INNORIX WP 브로셔.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadErr.jsp?fileID=1" //오류 발생을 위해 존재하지않는 경로로(downloadErr.jsp)설정
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP Brochure.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadErr.jsp?fileID=2" //오류 발생을 위해 존재하지않는 경로로(downloadErr.jsp)설정
|
||||
},
|
||||
{
|
||||
printFileName: "INNORIX WP パンフレット.pdf",
|
||||
fileSize: 1433885,
|
||||
downloadUrl: urlBase + "downloadErr.jsp?fileID=3" //오류 발생을 위해 존재하지않는 경로로(downloadErr.jsp)설정
|
||||
}]);
|
||||
});
|
||||
|
||||
// 다운로드 에러 이벤트 (Agent 모드 전용)
|
||||
control.on('downloadError', function (p) {
|
||||
console.log(p);
|
||||
|
||||
var f = p.files;
|
||||
for(var i=0; i<f.length; i++){
|
||||
alert("파일이름: " + f[i].fileName +"\n에러코드: " + f[i].errorCode);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="선택 다운로드" onclick="control.downloadSelectedFiles();"/>
|
||||
<input type="button" value="전체 다운로드" onclick="control.download();"/>
|
||||
</body>
|
||||
</html>
|
||||
69
src/main/webapp/innorix_2/gnexam/setFolderTreeItems.html
Normal file
@ -0,0 +1,69 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
folderIntact: true, //폴더첨부 유무
|
||||
showFolderItems: true, // 폴더 트리구조 열린채로 첨부 여부
|
||||
showFolderItmesTree: true // 폴더 구조 열고 닫기 기능
|
||||
});
|
||||
|
||||
/*
|
||||
showFolderItemsTree (※ Agent 모드 전용 옵션)
|
||||
- 폴더 트리구조 열고 닫기 가능
|
||||
- 폴더 내부의 아이템을 볼 수 있도록 허용 하는 옵션
|
||||
- true로 설정 시 폴더 아이콘 클릭 시 폴더 구조가 펼쳐지나, false로 설정 시 폴더 아이콘 클릭 시 폴더 구조 변화 없음
|
||||
- 폴더 명 클릭이 아닌 '폴더 아이콘'을 클릭 하여야 한다.
|
||||
|
||||
showFolderItems (※ Agent 모드 전용 옵션)
|
||||
- 폴더 트리구조 열린채로 첨부
|
||||
- 처음 로드 시 폴더를 펼친 상태로 보여주는 옵션
|
||||
- 해당 옵션 사용 시 showFolderItemsTree 옵션을 꼭 true 지정하고 사용하여야 한다.
|
||||
- showFolderItemsTree 옵션 false로 지정 후 해당 옵션 true로 지정 후 페이지 로드 시 폴더만 보이고 폴더 구조는 볼 수 없음
|
||||
|
||||
**
|
||||
showFolderItemsTree : true / showFolderItems : true = 폴더 첨부 시 폴더 구조가 펼쳐져서 보여짐
|
||||
showFolderItemsTree : true / showFolderItmes : false = 폴더 첨부 시폴더구조가 펼쳐져서 보이지는 않지만, 폴더 아이콘 클릭 시 폴더 구조가 펼쳐져서 보여짐
|
||||
showFolderItemsTree : false / showFolderItems : true = 폴더 첨부 시 폴더 구조가 펼쳐져서 보이지 않으며, 폴더 아이콘 클릭 시에도 폴더 구조가 펼쳐지지 않는다.
|
||||
showFolderItemsTree : false / showFolderItmes : false = 폴더 구조 안 보인다.
|
||||
*/
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
|
||||
var files = JSON.stringify(f);
|
||||
console.log(files);
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||
// innoJquery('form#f_write').submit();
|
||||
});
|
||||
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="폴더추가" onclick="control.openFolderDialog();"/> |
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
106
src/main/webapp/innorix_2/gnexam/setFuncBtn.html
Normal file
@ -0,0 +1,106 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control01 = new Object();
|
||||
var control02 = new Object();
|
||||
var control03 = new Object();
|
||||
var control04 = new Object();
|
||||
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 01 생성
|
||||
control01 = innorix.create({
|
||||
el: '#fileControl01', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
width: 450, // 컨트롤 너비 지정
|
||||
height: 80, // 컨트롤 높이 지정
|
||||
|
||||
showSelectBox : true, // 선택박스 출력
|
||||
showFuncBtn : ["move","remove"] // 이동, 삭제 버튼 출력
|
||||
});
|
||||
|
||||
// 파일전송 컨트롤 02 생성
|
||||
control02 = innorix.create({
|
||||
el: '#fileControl02', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
width: 450, // 컨트롤 너비 지정
|
||||
height: 80, // 컨트롤 높이 지정
|
||||
|
||||
showSelectBox : false, // 선택박스 미출력
|
||||
showFuncBtn : ["move","remove"] // 이동, 삭제 버튼 출력
|
||||
});
|
||||
|
||||
// 파일전송 컨트롤 03 생성
|
||||
control03 = innorix.create({
|
||||
el: '#fileControl03', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
width: 450, // 컨트롤 너비 지정
|
||||
height: 80, // 컨트롤 높이 지정
|
||||
|
||||
showSelectBox : true, // 선택박스 출력
|
||||
showFuncBtn : ["remove"] // 삭제 버튼 출력
|
||||
});
|
||||
|
||||
// 파일전송 컨트롤 04 생성
|
||||
control04 = innorix.create({
|
||||
el: '#fileControl04', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
width: 450, // 컨트롤 너비 지정
|
||||
height: 80, // 컨트롤 높이 지정
|
||||
|
||||
showSelectBox : false, // 선택박스 미출력
|
||||
showFuncBtn : [] // 이동, 삭제 버튼 미출력
|
||||
});
|
||||
|
||||
/*
|
||||
※ 컨트롤 파일목록의 기능버튼 제어
|
||||
|
||||
showSelectBox (선택박스 출력 여부)
|
||||
- 기본값 : true
|
||||
showFuncBtn (이동, 삭제 버튼 출력 여부)
|
||||
- 기본값 : ["move","remove"]
|
||||
|
||||
*/
|
||||
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<br/>
|
||||
<p>control01 - 모든 버튼 출력(기본)</p>
|
||||
<div id="fileControl01"></div><br/>
|
||||
<input type="button" value="단일 파일 추가" onclick="control01.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control01.upload();"/>
|
||||
|
||||
<br/>
|
||||
<p>control02 - 선택박스 미출력, 이동,삭제 출력</p>
|
||||
<div id="fileControl02"></div><br/>
|
||||
<input type="button" value="단일 파일 추가" onclick="control02.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control02.upload();"/>
|
||||
|
||||
<br/>
|
||||
<p>control03 - 선택박스 출력, 삭제 출력</p>
|
||||
<div id="fileControl03"></div><br/>
|
||||
<input type="button" value="단일 파일 추가" onclick="control03.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control03.upload();"/>
|
||||
|
||||
<br/>
|
||||
<p>control04 - 모든 버튼 미출력</p>
|
||||
<div id="fileControl04"></div><br/>
|
||||
<input type="button" value="단일 파일 추가" onclick="control04.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control04.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
50
src/main/webapp/innorix_2/gnexam/setHideServerPathInfo.html
Normal file
@ -0,0 +1,50 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './setHideServerPathInfo.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
|
||||
var files = JSON.stringify(f);
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||
//innoJquery('form#f_write').submit();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||
test1 : <input type="text" name="test1" />
|
||||
</form><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||
71
src/main/webapp/innorix_2/gnexam/setHideServerPathInfo.jsp
Normal file
@ -0,0 +1,71 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||
<%-- File import --%>
|
||||
<%@page import="java.io.File"%>
|
||||
|
||||
<%
|
||||
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||
if ("POST".equals(request.getMethod()))
|
||||
{
|
||||
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||
int maxPostSize = 2147482624; // bytes
|
||||
|
||||
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||
|
||||
/*
|
||||
전달되는 _action Param 정보
|
||||
speedCheck : 전송속도 측정
|
||||
getServerInfo : 서버정보 확인
|
||||
getFileInfo : 파일정보 확인
|
||||
attachFile : 파일전송 진행
|
||||
attachFileCompleted : 파일전송 완료
|
||||
*/
|
||||
|
||||
String _action = uploader.getParameter("_action"); // 동작 플래그
|
||||
String _orig_filename = uploader.getParameter("_orig_filename"); // 원본 파일명
|
||||
String _new_filename = uploader.getParameter("_new_filename"); // 저장 파일명
|
||||
String _filesize = uploader.getParameter("_filesize"); // 파일 사이즈
|
||||
String _start_offset = uploader.getParameter("_start_offset"); // 파일저장 시작지점
|
||||
String _end_offset = uploader.getParameter("_end_offset"); // 파일저장 종료지점
|
||||
String _filepath = uploader.getParameter("_filepath"); // 파일 저장경로
|
||||
String _el = uploader.getParameter("el"); // 컨트롤 엘리먼트 ID
|
||||
String _type = uploader.getParameter("type"); // 커스텀 정의 POST Param 1
|
||||
String _part = uploader.getParameter("part"); // 커스텀 정의 POST Param 2
|
||||
String _transferId = uploader.getParameter("_transferId"); // TransferId
|
||||
|
||||
/*
|
||||
업로드 간 메타정보 상 노출되는 서버 경로를 숨기기 위한 방법
|
||||
( 업로드 완료 시 클라이언트에 서버에 저장된 파일의 절대 경로가 노출되기 때문에 보안 상 노출이 안 되도록 설정 )
|
||||
uploader.setHideServerPathInfo(true);
|
||||
- uploader.run() 이전에 설정
|
||||
- 해당 설정 시 파일 전송 간 발생되는 통신 구간에서는 서버 경로 정보를 주고 받지 않기 위해
|
||||
InnorixUplaod 클래스를 객체화 할 때 지정해주는 directory 값을 고정으로 업로드하며, setDirectory와 함께 사용할 수 없음
|
||||
*/
|
||||
|
||||
uploader.setHideServerPathInfo(true); //업로드 서버경로 숨김처리
|
||||
String _run_retval = uploader.run();
|
||||
|
||||
// 개별파일 업로드 완료
|
||||
if("attachFileCompleted".equals(_action)) {
|
||||
|
||||
System.out.println("========== uploader.isUploadDone() " + System.currentTimeMillis() + " ==========");
|
||||
System.out.println("_orig_filename \t = " + _orig_filename); // 원본 파일명
|
||||
System.out.println("_new_filename \t = " + _new_filename); // 저장 파일명
|
||||
|
||||
/* 업로드 서버 경로 숨김처리 시 저장경로 확인 방법 */
|
||||
System.out.println("_filepath \t = " + _filepath); // 파일 저장경로 (업로드 서버 경로 숨김처리하여 빈값으로 출력)
|
||||
String strDir = uploader.getDirectory(); // 서버에 저장되는 폴더경로
|
||||
System.out.println("strDir \t = " + strDir);
|
||||
String strSrvFilePath = strDir.concat(File.separator).concat(_new_filename);
|
||||
System.out.println("strSrvFilePath \t = " + strSrvFilePath); //서버에 저장된 파일 위치
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// CORS 관련 헤더 추가
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
|
||||
response.setHeader("Access-Control-Allow-Headers", "Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type");
|
||||
%>
|
||||
75
src/main/webapp/innorix_2/gnexam/setLanguage.html
Normal file
@ -0,0 +1,75 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
/*
|
||||
방법 1 )
|
||||
innorix.setLanguage('ko'); // 한/영설정 [en,ko]
|
||||
*/
|
||||
innorix.setLanguage('ko');
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
progressTitle: '파일 전송 창 제목', // 전송창 타이틀 출력 문구, 기본값 : WP
|
||||
uploadUrl: './upload.jsp' // 업로드 URL
|
||||
|
||||
//, controlLang: 'ko' // 방법 2 ) 한글 출력, 기본값 : en
|
||||
});
|
||||
|
||||
/*
|
||||
INNORIX WP는 영어 메시지를 기본으로 출력하며 설정을 통해 한글로 출력이 가능하게 됩니다.
|
||||
두 방법 중 선택해서 적용하시면 되겠습니다. 방법 1을 권장드립니다.
|
||||
|
||||
방법 1 ) 컨트롤 생성 전에(innorix.create전에) 선언해주어야 합니다.
|
||||
innorix.setLanguage
|
||||
- innorix.setLanguage('ko'); (한글출력)
|
||||
- innorix.setLanguage('en'); (영문출력)
|
||||
|
||||
방법 2 )
|
||||
controlLang
|
||||
- 'en' (기본값, 영문출력)
|
||||
- 'ko' (한글출력)
|
||||
*/
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
|
||||
console.log(p.files);
|
||||
var f = p.files;
|
||||
var r = "Upload complete\n\n";
|
||||
for (var i = 0; i < f.length; i++ ) {
|
||||
r += f[i].controlId + " " + f[i].clientFileName + " " + f[i].fileSize + "\n";
|
||||
}
|
||||
alert(r);
|
||||
|
||||
var files = JSON.stringify(f);
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
innoJquery('form#f_write').append('<input type="hidden" name="files" id="files" value=\'' + files + '\' />');
|
||||
//innoJquery('form#f_write').submit();
|
||||
});
|
||||
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<form action="result.jsp" id="f_write" name="f_write" method="post">
|
||||
test1 : <input type="text" name="test1" />
|
||||
</form><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<input type="button" value="멀티 파일 추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="단일 파일 추가" onclick="control.openFileDialogSingle();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
46
src/main/webapp/innorix_2/gnexam/setOption.html
Normal file
@ -0,0 +1,46 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<link rel="stylesheet" href="../innorix.css">
|
||||
<script src="../innorix.js"></script>
|
||||
<script>
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '../install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: './upload.jsp', // 업로드 URL
|
||||
width: 400, // 컨트롤 박스 너비
|
||||
height: 200 // 컨트롤 박스 높이
|
||||
});
|
||||
|
||||
// 파일 첨부시 에러
|
||||
control.on('addFileError', function (p) {
|
||||
alert(p[0].type + "\n" + p[0].message);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function setOption1(){
|
||||
var option1 = {
|
||||
width: 600, // 컨트롤 박스 너비
|
||||
height: 400, // 컨트롤 박스 높이
|
||||
limitExtension: ['exe','pdf'] // 확장자 제한
|
||||
};
|
||||
control.setOption(option1);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a href="../gnIndex.html">← 예제 목록</a><br /><br />
|
||||
|
||||
<div id="fileControl"></div><br/>
|
||||
<input type="button" value="옵션 변경" onclick="setOption1();"/>
|
||||
|
||||
<input type="button" value="파일추가" onclick="control.openFileDialog();"/>
|
||||
<input type="button" value="업로드" onclick="control.upload();"/>
|
||||
</body>
|
||||
</html>
|
||||