upload.jsp 4.18 KB
<%@page import="it.softecspa.portal.ApplicationClusterInfo"%>
<%@page import="it.softecspa.portal.Parameters"%>
<%
	Parameters parameters = Parameters.getInstance();
	String url = request.getScheme()+"://"+parameters.getChannelInfo().getDomainName();
	
	url += parameters.getChannelInfo().getPortHTTP()+parameters.getChannelInfo().getContextName()+"/proxy-services/statement?upload";
%>
<html>
<head>
	<title>Upload file</title>
	<meta http-equiv="expires" content="-1">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<script>
		function sendData() {
			var xmlhttp;
			
			if (window.XMLHttpRequest) {
				xmlhttp = new XMLHttpRequest();
			} else if (window.ActiveXObject) {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			
  			//document.dati.risposta.value="Elaborazione in corso....";
			
  			xmlhttp.open("POST", "<%=url%>", false);
  			xmlhttp.setRequestHeader("X-username", document.dati.FIELD_USERNAME.value);
  			xmlhttp.setRequestHeader("X-password", document.dati.FIELD_PASSWORD.value);
  			//
  			xmlhttp.setRequestHeader("X-path", document.dati.FIELD_PATH.value);
  			xmlhttp.setRequestHeader("X-fileName", document.dati.FIELD_FILENAME.value);
  			xmlhttp.setRequestHeader("X-bufferLenght", document.dati.FIELD_BUFFER.value);
  			if (document.dati.FIELD_OVERWRITE.checked) {
  				xmlhttp.setRequestHeader("X-overwrite", document.dati.FIELD_OVERWRITE.value);
  			}
  			if (document.dati.FIELD_APPEND.checked) {
  	  			xmlhttp.setRequestHeader("X-append", document.dati.FIELD_APPEND.value);
  			}
  			xmlhttp.send(document.dati.FIELD_REQUEST.value);
  			
  			
  			var risposta = xmlhttp.responseText;
  			document.dati.FIELD_RESPONSE.value=risposta;
		}
	</script>
	<style>
		.tabella {border:solid 1px #DDDDEE; color:#2b2b2b; }
		.cella {padding:5px;color:#2b2b2b; background-color:#DDDDEE; font-face:verdana; font-size:14px;}
		.cellaIntestazione {padding:5px;color:#2b2b2b; background-color:#DDDDEE; font-face:verdana; font-size:14px; font-weight:bold;}
	</style>
</head>
<body>
	<form name="dati">
		<table border="0" cellspacing="2" cellpadding="2" class="tabella">
			<tr><td colspan="2" class="cellaIntestazione">Simulazione traferimento file</td></tr>
			<tr>
				<td colspan="2" class="cella">
					<ul>
					<li>Incollare XML nella text area</li>
					<li>La login e la password devono essere quelle di un utente abilitato all'import dei dati (ad esempio un amministratore) </li>
					<li>Alla fine dell'importazione verrà visualizzato nell'area esito il risultato dell'importazione:</li>
					</ul>
				</td>
			</tr>
			<tr>
				<td class="cella">login</td>
				<td class="cella"><input name="FIELD_USERNAME" type="text"></td>
			</tr>
			<tr>
				<td class="cella">password</td>
				<td class="cella"><input name="FIELD_PASSWORD" type="password"></td>
			</tr>
			
			<tr>
				<td class="cella">path</td>
				<td class="cella"><input name="FIELD_PATH" type="text"></td>
			</tr>
			<tr>
				<td class="cella">fileName</td>
				<td class="cella"><input name="FIELD_FILENAME" type="text"></td>
			</tr>
			<tr>
				<td class="cella">overwrite</td>
				<td class="cella"><input name="FIELD_OVERWRITE" type="checkbox" value="true"></td>
			</tr>
			<tr>
				<td class="cella">append</td>
				<td class="cella"><input name="FIELD_APPEND" type="checkbox" value="true"></td>
			</tr>
			<tr>
				<td class="cella">bufferLength</td>
				<td class="cella"><input name="FIELD_BUFFER" type="text"></td>
			</tr>
			
			<tr>
				<td class="cella" colspan="2"><input type="button" value="Invia dati" onclick="sendData();"></td>
			</tr>
			<tr>
				<td colspan="2" class="cella">
					<div style="display: inline-block; vertical-align: top;">		
						<div style="display: inline-block; vertical-align: top;">	
							Invio<br>
							<textarea name="FIELD_REQUEST" cols="80" rows="40"></textarea>
						</div>
						<div style="display:inline-block; vertical-align: top;">	
							Esito<br>
							<textarea name="FIELD_RESPONSE" readonly="readonly" cols="50" rows="20"></textarea>
						</div>
					</div>
				</td>
			</tr>
		</table>
		
	</form>
</body>
</html>