<%@ page contentType="text/html; charset=UTF-8" %> <%@ page import="it.saga.pubblici.anagrafe.cieDaemon.*,java.lang.*,java.io.*"%> <%@ page import="java.net.URLDecoder"%> <%@ page import="java.util.Enumeration"%> <%@ page import="it.saga.library.logging.Log"%> <% String mode=request.getParameter("mode"); CIEDaemonThread cieDaemon=new CIEDaemonThread(); String result; if ("TEST".equalsIgnoreCase(mode)) { result=cieDaemon.testHTTPRequest(); } else { Log log = Log.getLog(CIEDaemonThread.class); String nomePostazione=request.getParameter("nomePostazione"); if (nomePostazione==null || nomePostazione.isEmpty()) { log.debug("CIEJSP : Postazione vuota, cerco nel parametro key"); nomePostazione=request.getParameter("key"); } log.debug("CIEJSP : Postazione : "+nomePostazione); InputStream r=request.getInputStream(); ByteArrayOutputStream baos=new ByteArrayOutputStream(); int size=0,chunk=0; byte[] buf=new byte[2048]; do { chunk=r.read(buf); if (chunk>0) { baos.write(buf,0,chunk); size+=chunk; } } while (chunk>0); if (log.isDebugEnabled()) { log.debug("CIEJSP : Letto stream di "+size+" bytes"); log.debug(new String(buf)); } result =cieDaemon.processHTTPRequest(baos.toByteArray(),nomePostazione); log.debug(result); } %> <%= result %>