Añado los fuentes de java
This commit is contained in:
@@ -0,0 +1,553 @@
|
||||
package com.tarisan.servlets;
|
||||
|
||||
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
|
||||
import com.tarisan.util.DES;
|
||||
|
||||
// import com.tarisan.persistencia.DataStore;
|
||||
// import com.tarisan.persistencia.PersistenciaParametros;
|
||||
// import com.tarisan.util.XML2PDF;
|
||||
//import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
// import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
// import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
// import java.io.PrintStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
|
||||
|
||||
// import java.util.Enumeration;
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.KeyManager;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSession;
|
||||
// import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
//import jakarta.servlet.ServletOutputStream;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
|
||||
// import org.apache.log4j.Logger;
|
||||
import com.tarisan.control.*;
|
||||
import com.tarisan.data.Usuario;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
public class resultados_analisis extends HttpServlet
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public void doPost(HttpServletRequest req, HttpServletResponse res)
|
||||
{
|
||||
HttpSession sesion = req.getSession(true);
|
||||
if ((sesion.isNew()) || (sesion.getAttribute("USUARIO") == null))
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Sesión invalidada");
|
||||
try {
|
||||
res.sendRedirect(req.getContextPath() + "/html/login.html");
|
||||
} catch (IOException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Sesión invalidada. Error: " + e.toString());
|
||||
}
|
||||
}
|
||||
/*for (Enumeration e = sesion.getAttributeNames(); e.hasMoreElements(); ) {
|
||||
String atrib = (String)e.nextElement();
|
||||
System.out.println("Nombre: " + atrib);
|
||||
System.out.println(". Valor: " + sesion.getAttribute(atrib) + ".");
|
||||
}*/
|
||||
//System.out.println("Médico: " + req.getParameter("solicitante"));
|
||||
|
||||
String peticion_izasa = new String();
|
||||
|
||||
String nombrePDF = "";
|
||||
String strMedico = ""+((Usuario)sesion.getAttribute("USUARIO")).getMedico();
|
||||
DES encrypter = new DES(strMedico);
|
||||
nombrePDF = req.getParameter("requestID");
|
||||
nombrePDF = encrypter.decrypt(nombrePDF);
|
||||
|
||||
try
|
||||
{
|
||||
if ((req.getParameter("borrarPDF")!=null) && (req.getParameter("borrarPDF").compareTo("1")==0)){ // Se ha pulsado en Regenenerar. Borramos el pdf
|
||||
/*File fichero = new File(ParametrosConfiguracion.ruta_pdf_resultados_analiticas + req.getParameter("requestID") + ".pdf");*/
|
||||
File fichero = new File(ParametrosConfiguracion.ruta_pdf_resultados_analiticas + nombrePDF + ".pdf");
|
||||
if(fichero.exists())
|
||||
{
|
||||
if (fichero.delete())
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "El fichero ha sido borrado satisfactoriamente: "+fichero);
|
||||
else
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "El fichero no puede ser borrado: "+fichero);
|
||||
}else{
|
||||
/*fichero = new File(ParametrosConfiguracion.ruta_pdf_resultados_analiticas + req.getParameter("requestID") + ".PDF");*/
|
||||
fichero = new File(ParametrosConfiguracion.ruta_pdf_resultados_analiticas + nombrePDF + ".PDF");
|
||||
if(fichero.exists())
|
||||
{
|
||||
if (fichero.delete())
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "El fichero ha sido borrado satisfactoriamente: "+fichero);
|
||||
else
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "El fichero no puede ser borrado: "+fichero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*String strSql = new String("select requestid from mg.request where requestlabel= " + req.getParameter("requestID"));*/
|
||||
String strSql = new String("select requestid from mg.request where requestlabel= " + nombrePDF);
|
||||
|
||||
//String strSql = new String("select requestid from mg.request where requestlabel= " + -5);
|
||||
Connection conexion_izasa = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
Statement st = conexion_izasa.prepareStatement(strSql);
|
||||
|
||||
ResultSet rs = st.executeQuery(strSql);
|
||||
|
||||
while (rs.next()) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 76");
|
||||
peticion_izasa = rs.getString("requestid");
|
||||
/*peticion_izasa = nombrePDF;*/
|
||||
/*System.out.println("requestid izasa = " + rs.getString("requestid"));
|
||||
System.out.println("peticion_izasa.length() = " + peticion_izasa.length());
|
||||
*/
|
||||
}
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion_izasa);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Error al obtener el requestid de izasa"+e.toString());
|
||||
System.out.println("Error al obtener el requestid de izasa: ");
|
||||
e.printStackTrace();
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//if (peticion_izasa.length() > 0) {
|
||||
/*String ruta = ParametrosConfiguracion.ruta_pdf_resultados;*/
|
||||
String ruta = ParametrosConfiguracion.ruta_pdf_resultados_analiticas;
|
||||
String sisop = System.getProperty("os.name");
|
||||
|
||||
String slash = "\\";
|
||||
if (sisop.contains("indows"))
|
||||
{
|
||||
slash = "\\";
|
||||
}
|
||||
else {
|
||||
slash = "/";
|
||||
}
|
||||
/*File pdf = new File(ruta + slash + req.getParameter("requestID") + ".pdf");*/
|
||||
File pdf = new File(ruta + slash + nombrePDF + ".pdf");
|
||||
if (!pdf.exists())
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.INFO, "El pdf no existe");
|
||||
/*PDF_izasa("https://192.168.2.102/modulab/servlet/GetPDFReportNoRedirectServlet?username=admin&password=service&requestID=" + peticion_izasa, "HTTPS", req.getParameter("requestID"));
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Llega a 101. Peticion_izasa="+peticion_izasa+"requestid = "+req.getParameter("requestID"));*/
|
||||
//PDF_izasa("https://192.168.2.102/modulab/servlet/GetPDFReportNoRedirectServlet?username=admin&password=service&requestID=" + peticion_izasa, "HTTPS", nombrePDF);
|
||||
|
||||
/*if (peticion_izasa.compareTo("")!=0){
|
||||
PDF_izasa("https://192.168.2.102/modulab/servlet/GetPDFReportNoRedirectServlet?username=admin&password=service&requestID=" + peticion_izasa, "HTTPS", nombrePDF);
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Peticion_izasa="+peticion_izasa+"requestid = "+nombrePDF);
|
||||
}else{
|
||||
PDF_megalab("http://192.168.2.104/Sigloweb?accion=informe&usr=admin&pass=aHzQ9wHJNA&xdemo4=" + nombrePDF, "HTTP", nombrePDF);
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Peticion_megalab="+nombrePDF+"requestid = "+nombrePDF);
|
||||
}*/
|
||||
PDF_megalab("http://192.168.2.104/Sigloweb?accion=informe&usr=admin&pass=aHzQ9wHJNA&xdemo4=" + nombrePDF, "HTTP", nombrePDF);
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Peticion_megalab="+nombrePDF+"requestid = "+nombrePDF);
|
||||
|
||||
//LogTarisan.logger.log(NivelLog.INFO, "Llega a 101. Peticion_izasa="+peticion_izasa+"requestid = "+nombrePDF);
|
||||
//https://192.168.2.102/modulab/servlet/GetPDFReportServlet?username=admin&password=service&requestID=" + String(requestID))
|
||||
//conexionPOST("https://192.168.2.102/modulab/servlet/GetXMLRequestServlet?username=admin&password=service&requestID=" + peticion_izasa, "HTTPS");
|
||||
//XML2PDF.transformar(peticion_izasa + ".xml", "resultados_izasa.xsl", req.getParameter("requestID") + ".pdf");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.INFO, "El pdf ya existe, no hay que crearlo: "+ruta + slash + nombrePDF + ".pdf");
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Vamos a mostrar el pdf");
|
||||
//ServletOutputStream stream = null;
|
||||
//BufferedInputStream buf = null;
|
||||
try {
|
||||
/*
|
||||
stream = res.getOutputStream();
|
||||
|
||||
res.setContentType("application/pdf");
|
||||
|
||||
res.setContentLength((int)pdf.length());
|
||||
FileInputStream input = new FileInputStream(pdf);
|
||||
buf = new BufferedInputStream(input);
|
||||
int readBytes = 0;
|
||||
|
||||
while ((readBytes = buf.read()) != -1) {
|
||||
stream.write(readBytes);
|
||||
}
|
||||
if (stream != null)
|
||||
stream.close();
|
||||
if (buf == null) return; buf.close();
|
||||
*/
|
||||
/*sesion.setAttribute("fichero", req.getParameter("requestID") + ".pdf");
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Setattribute.fichero: "+ req.getParameter("requestID") + ".pdf");*/
|
||||
sesion.setAttribute("fichero", nombrePDF + ".pdf");
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Setattribute.fichero: "+ nombrePDF + ".pdf");
|
||||
/*res.sendRedirect(req.getContextPath()+"/jsp/ver_pdf.jsp");*/
|
||||
/*String rutaPDF = "";
|
||||
rutaPDF = ParametrosConfiguracion.ruta_pdf_resultados_analiticas + req.getParameter("requestID") + ".pdf"; */
|
||||
/*req.getRequestDispatcher("/servlet/GestorPacientes?OPCION=34&nombrePDF="+req.getParameter("requestID") + ".pdf&tipo=1").forward(req, res);*/
|
||||
|
||||
/* String nombrePDF = "";
|
||||
String strMedico = ""+((Usuario)sesion.getAttribute("USUARIO")).getMedico();
|
||||
DES encrypter = new DES(strMedico);
|
||||
nombrePDF = req.getParameter("requestID");
|
||||
nombrePDF = encrypter.encrypt(nombrePDF); */
|
||||
|
||||
req.getRequestDispatcher("/servlet/GestorPacientes?OPCION=34&nombrePDF="+req.getParameter("requestID") + "&tipo=1").forward(req, res);
|
||||
/*req.getRequestDispatcher("/servlet/GestorPacientes?OPCION=34&nombrePDF="+nombrePDF + "&tipo=1").forward(req, res);*/
|
||||
}
|
||||
catch (Exception ioe) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Error al generar el pdf "+ ioe.toString());
|
||||
System.out.println("Error al generar el PDF" + ioe.toString());
|
||||
}
|
||||
/* }
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
ServletOutputStream stream = null;
|
||||
BufferedInputStream buf = null;
|
||||
stream = res.getOutputStream();
|
||||
res.setContentType("text/html");
|
||||
String contenido = new String();
|
||||
contenido = "<head><title>No hay resultados</title></head><body><div align=\"center\">No se han encontrado resultados para la petición indicada </div></body>";
|
||||
res.setContentLength(contenido.length());
|
||||
stream.write(contenido.getBytes());
|
||||
stream.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Error al devolver el html sin resultados " + e.toString());
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public static void conexionPOST(String request, String protocolo, String ruta)
|
||||
{
|
||||
BufferedReader rd = null;
|
||||
try
|
||||
{
|
||||
URL url = new URL(request);
|
||||
if (protocolo.equals("HTTPS")) {
|
||||
url = new URL(request);
|
||||
HttpsURLConnection.setFollowRedirects(true);
|
||||
HttpsURLConnection conn1 = (HttpsURLConnection)url.openConnection();
|
||||
conn1.setDoOutput(true);
|
||||
conn1.setHostnameVerifier(new NullHostnameVerifier());
|
||||
conn1.setInstanceFollowRedirects(true);
|
||||
OutputStream os = conn1.getOutputStream();
|
||||
os.write(1);
|
||||
os.close();
|
||||
rd = new BufferedReader(new InputStreamReader(conn1.getInputStream()));
|
||||
|
||||
String requestID = new String();
|
||||
requestID = request.substring(request.lastIndexOf("requestID=") + 10);
|
||||
|
||||
String sisop = System.getProperty("os.name");
|
||||
|
||||
String slash = "\\";
|
||||
if (sisop.contains("indows"))
|
||||
{
|
||||
slash = "\\";
|
||||
}
|
||||
else {
|
||||
slash = "/";
|
||||
}
|
||||
|
||||
FileOutputStream fileOutput = new FileOutputStream(ruta + slash + requestID + ".xml");
|
||||
BufferedOutputStream bufferedOutput = new BufferedOutputStream(fileOutput);
|
||||
byte[] array = new byte[1000];
|
||||
int leidos = conn1.getInputStream().read(array);
|
||||
while (leidos > 0)
|
||||
{
|
||||
bufferedOutput.write(array, 0, leidos);
|
||||
leidos = conn1.getInputStream().read(array);
|
||||
}
|
||||
bufferedOutput.close();
|
||||
System.out.println("Se ha generado el xml en: " + ruta + slash + requestID + ".xml");
|
||||
} else {
|
||||
URLConnection conn1 = url.openConnection();
|
||||
rd = new BufferedReader(new InputStreamReader(conn1.getInputStream()));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Fallo en web request, " + e.toString());
|
||||
|
||||
if (rd != null)
|
||||
try {
|
||||
rd.close();
|
||||
} catch (IOException ex) {
|
||||
System.out.println("Problema al cerrar el objeto lector");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (rd != null)
|
||||
try {
|
||||
rd.close();
|
||||
} catch (IOException ex) {
|
||||
System.out.println("Problema al cerrar el objeto lector");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void conexionPOST(String request, String protocolo)
|
||||
{
|
||||
BufferedReader rd = null;
|
||||
try
|
||||
{
|
||||
URL url = new URL(request);
|
||||
if (protocolo.equals("HTTPS")) {
|
||||
url = new URL(request);
|
||||
HttpsURLConnection.setFollowRedirects(true);
|
||||
HttpsURLConnection conn1 = (HttpsURLConnection)url.openConnection();
|
||||
conn1.setDoOutput(true);
|
||||
conn1.setHostnameVerifier(new NullHostnameVerifier());
|
||||
conn1.setInstanceFollowRedirects(true);
|
||||
OutputStream os = conn1.getOutputStream();
|
||||
os.write(1);
|
||||
os.close();
|
||||
rd = new BufferedReader(new InputStreamReader(conn1.getInputStream()));
|
||||
|
||||
String requestID = new String();
|
||||
requestID = request.substring(request.lastIndexOf("requestID=") + 10);
|
||||
|
||||
String ruta = LogTarisan.getPathFichero();
|
||||
|
||||
String sisop = System.getProperty("os.name");
|
||||
String slash = "\\";
|
||||
if (sisop.contains("indows"))
|
||||
{
|
||||
slash = "\\";
|
||||
}
|
||||
else {
|
||||
slash = "/";
|
||||
}
|
||||
|
||||
FileOutputStream fileOutput = new FileOutputStream(ruta + slash + requestID + ".xml");
|
||||
BufferedOutputStream bufferedOutput = new BufferedOutputStream(fileOutput);
|
||||
byte[] array = new byte[1000];
|
||||
int leidos = conn1.getInputStream().read(array);
|
||||
while (leidos > 0)
|
||||
{
|
||||
bufferedOutput.write(array, 0, leidos);
|
||||
leidos = conn1.getInputStream().read(array);
|
||||
}
|
||||
bufferedOutput.close();
|
||||
} else {
|
||||
URLConnection conn1 = url.openConnection();
|
||||
rd = new BufferedReader(new InputStreamReader(conn1.getInputStream()));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("Fallo en web request, " + e.toString());
|
||||
|
||||
if (rd != null)
|
||||
try {
|
||||
rd.close();
|
||||
} catch (IOException ex) {
|
||||
System.out.println("Problema al cerrar el objeto lector");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (rd != null)
|
||||
try {
|
||||
rd.close();
|
||||
} catch (IOException ex) {
|
||||
System.out.println("Problema al cerrar el objeto lector");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class DefaultTrustManager implements X509TrustManager {
|
||||
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {}
|
||||
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void PDF_izasa(String request, String protocolo, String peticion_tarisan)
|
||||
{
|
||||
BufferedReader rd = null;
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Entramos en PDF_izasa");
|
||||
try
|
||||
{
|
||||
URL url = new URL(request);
|
||||
if (protocolo.equals("HTTPS")) {
|
||||
url = new URL(request);
|
||||
|
||||
|
||||
/*TEST
|
||||
*
|
||||
*/
|
||||
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||
ctx.init(new KeyManager[0], new TrustManager[] {new DefaultTrustManager()}, new SecureRandom());
|
||||
SSLContext.setDefault(ctx);
|
||||
|
||||
/*
|
||||
* FIN TEST
|
||||
*/
|
||||
HttpsURLConnection.setFollowRedirects(true);
|
||||
HttpsURLConnection conn1 = (HttpsURLConnection)url.openConnection();
|
||||
conn1.setDoOutput(true);
|
||||
;
|
||||
conn1.setHostnameVerifier(new NullHostnameVerifier());
|
||||
conn1.setInstanceFollowRedirects(true);
|
||||
OutputStream os = conn1.getOutputStream();
|
||||
os.write(1);
|
||||
os.close();
|
||||
rd = new BufferedReader(new InputStreamReader(conn1.getInputStream()));
|
||||
|
||||
// String requestID = new String();
|
||||
// requestID = request.substring(request.lastIndexOf("requestID=") + 10);
|
||||
|
||||
/*String ruta = ParametrosConfiguracion.ruta_pdf_resultados;*/
|
||||
String ruta = ParametrosConfiguracion.ruta_pdf_resultados_analiticas;
|
||||
|
||||
String sisop = System.getProperty("os.name");
|
||||
String slash = "\\";
|
||||
if (sisop.contains("indows"))
|
||||
{
|
||||
slash = "\\";
|
||||
}
|
||||
else {
|
||||
slash = "/";
|
||||
}
|
||||
|
||||
FileOutputStream fileOutput = new FileOutputStream(ruta + slash + peticion_tarisan + ".pdf");
|
||||
BufferedOutputStream bufferedOutput = new BufferedOutputStream(fileOutput);
|
||||
byte[] array = new byte[1000];
|
||||
int leidos = conn1.getInputStream().read(array);
|
||||
while (leidos > 0)
|
||||
{
|
||||
bufferedOutput.write(array, 0, leidos);
|
||||
leidos = conn1.getInputStream().read(array);
|
||||
}
|
||||
bufferedOutput.close();
|
||||
} else {
|
||||
URLConnection conn1 = url.openConnection();
|
||||
rd = new BufferedReader(new InputStreamReader(conn1.getInputStream()));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Fallo en web request, " + e.toString());
|
||||
|
||||
if (rd != null)
|
||||
try {
|
||||
rd.close();
|
||||
} catch (IOException ex) {
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Problema al cerrar el objeto lector");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (rd != null)
|
||||
try {
|
||||
rd.close();
|
||||
} catch (IOException ex) {
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Problema al cerrar el objeto lector");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void PDF_megalab(String request, String protocolo, String peticion_tarisan)
|
||||
{
|
||||
BufferedReader rd = null;
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Entramos en PDF_megalab");
|
||||
try
|
||||
{
|
||||
URL url = new URL(request);
|
||||
|
||||
URLConnection conn1 = url.openConnection();
|
||||
rd = new BufferedReader(new InputStreamReader(conn1.getInputStream()));
|
||||
|
||||
String ruta = ParametrosConfiguracion.ruta_pdf_resultados_analiticas;
|
||||
|
||||
String sisop = System.getProperty("os.name");
|
||||
String slash = "\\";
|
||||
if (sisop.contains("indows"))
|
||||
{
|
||||
slash = "\\";
|
||||
}
|
||||
else {
|
||||
slash = "/";
|
||||
}
|
||||
|
||||
FileOutputStream fileOutput = new FileOutputStream(ruta + slash + peticion_tarisan + ".pdf");
|
||||
BufferedOutputStream bufferedOutput = new BufferedOutputStream(fileOutput);
|
||||
byte[] array = new byte[1000];
|
||||
int leidos = conn1.getInputStream().read(array);
|
||||
while (leidos > 0)
|
||||
{
|
||||
bufferedOutput.write(array, 0, leidos);
|
||||
leidos = conn1.getInputStream().read(array);
|
||||
}
|
||||
bufferedOutput.close();
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Fallo en web request, " + e.toString());
|
||||
|
||||
if (rd != null)
|
||||
try {
|
||||
rd.close();
|
||||
} catch (IOException ex) {
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Problema al cerrar el objeto lector");
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (rd != null)
|
||||
try {
|
||||
rd.close();
|
||||
} catch (IOException ex) {
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Problema al cerrar el objeto lector");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class NullHostnameVerifier
|
||||
implements HostnameVerifier
|
||||
{
|
||||
public boolean verify(String hostname, SSLSession session)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user