upload.jsp 4.19 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 - test page</title>
	<meta http-equiv="expires" content="-1">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<style>
		HTML,BODY {
			margin-top: 5px;
			margin-left: 5px;
			margin-right: 5px;
			margin-bottom: 5px;
			/* http://www.google.com/fonts */
			font-family: 'Source Sans Pro', Frutiger, Arial, Helvetica, sans-serif; 
			/* font-family: Frutiger, Arial, Helvetica, sans-serif; */
			font-size: 14px;
			font-weight: 400;
			background-color: white;
			color: black;
			height: 100%
		}
		
		.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>
	<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>
	
</head>
<body>
	<form name="dati">
		<table border="0" cellspacing="1" cellpadding="1" class="tabella">
			<tr>
				<td class="cella" width="120px"><b>login</b></td>
				<td class="cella" ><input name="FIELD_USERNAME" type="text"></td>
			</tr>
			<tr>
				<td class="cella"><b>password</b></td>
				<td class="cella"><input name="FIELD_PASSWORD" type="password"></td>
			</tr>
			
			<tr>
				<td class="cella"><b>path</b></td>
				<td class="cella"><input name="FIELD_PATH" type="text"></td>
			</tr>
			<tr>
				<td class="cella"><b>fileName</b></td>
				<td class="cella"><input name="FIELD_FILENAME" type="text"></td>
			</tr>
			<tr>
				<td class="cella"><b>overwrite</b></td>
				<td class="cella"><input name="FIELD_OVERWRITE" type="checkbox" value="true"></td>
			</tr>
			<tr>
				<td class="cella"><b>append</b></td>
				<td class="cella"><input name="FIELD_APPEND" type="checkbox" value="true"></td>
			</tr>
			<tr>
				<td class="cella"><b>bufferLength</b></td>
				<td class="cella"><input name="FIELD_BUFFER" type="text"></td>
			</tr>
			
			<tr>
				<td class="cella" colspan="2"><input type="button" value="Upload" 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;">&nbsp;<b>Input</b><br>
							<textarea name="FIELD_REQUEST" cols="80" rows="40"></textarea>
						</div>
						<div style="display:inline-block; vertical-align: top;">&nbsp;<b>Response</b><br>
							<textarea name="FIELD_RESPONSE" readonly="readonly" cols="50" rows="20"></textarea>
						</div>
					</div>
				</td>
			</tr>
		</table>
	</form>
</body>
</html>