90 lines
2.8 KiB
Java
90 lines
2.8 KiB
Java
/**
|
|
* @(#) Start.java
|
|
*/
|
|
|
|
package com.tarisan.servlets;
|
|
|
|
import com.tarisan.control.ParametrosConfiguracion;
|
|
import com.tarisan.log.*;
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.io.PrintWriter;
|
|
import java.sql.*;
|
|
import java.util.Enumeration;
|
|
import java.util.Properties;
|
|
import jakarta.servlet.*;
|
|
import jakarta.servlet.http.*;
|
|
import com.tarisan.util.*;
|
|
|
|
/**
|
|
* Servlet de arranque de la aplicación Tarisan.
|
|
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
|
* @version 1.0, 24/09/2003
|
|
*/
|
|
public class Start extends HttpServlet
|
|
{
|
|
ServletContext sc = null;
|
|
|
|
/**
|
|
* Inicializa el servlet.
|
|
* @param config Entorno de configuración del servlet: objeto <code>ServletConfig</code>.
|
|
*/
|
|
public void init(ServletConfig config) throws ServletException
|
|
{
|
|
System.out.println("\n\n\n" );
|
|
System.out.println("**************************** TARISAN - Start.init() ****************************" );
|
|
sc = config.getServletContext();
|
|
System.out.println("Directorio de trabajo de Tarisan:" + sc.getRealPath("/"));
|
|
System.out.println("Ruta del log: " + LogTarisan.getPathFichero());
|
|
try
|
|
{
|
|
ParametrosConfiguracion.cargarPropiedades();
|
|
System.out.println(" Inicio OK de la aplicación Tarisan - Start.init().Parámetros configurados");
|
|
LogTarisan.logger.log(NivelLog.INFO, "Inicio OK de la aplicación Tarisan");
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
System.out.println(" Inicio KO de la aplicación Tarisan - Start.init().Exception: " + e);
|
|
LogTarisan.logger.log(NivelLog.ERROR, "Inicio KO de la aplicación Tarisan, Exception: " + e);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* Recepción del método GET requerida por un cliente.
|
|
* @param request Objeto <code>HttpServletRequest</code> enviado por el cliente.
|
|
* @param response Objeto <code>HttpServletResponse</code> que recibirá el cliente.
|
|
*/
|
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
|
{
|
|
LogTarisan.logger.log(NivelLog.INFO, "Start.doGet().INI");
|
|
|
|
response.setContentType("text/plain");
|
|
PrintWriter out = response.getWriter();
|
|
|
|
out.println ("Properties");
|
|
Properties props = System.getProperties();
|
|
Enumeration keys = props.keys();
|
|
while (keys.hasMoreElements())
|
|
{
|
|
Object key = keys.nextElement ();
|
|
out.println("key [" + key + "] element [" + props.get (key) + "]");
|
|
System.out.println("key [" + key + "] element [" + props.get (key) + "]");
|
|
}
|
|
|
|
out.println("Using classpath:");
|
|
out.println(System.getProperty("java.class.path").replace(File.pathSeparatorChar, '\n'));
|
|
|
|
out.println("ServletContext's realpath of \"/\":");
|
|
out.println("\t" + sc.getRealPath("/"));
|
|
|
|
out.println("Using userdir:");
|
|
out.println("\t" + System.getProperty("user.dir"));
|
|
|
|
out.flush();
|
|
LogTarisan.logger.log(NivelLog.INFO, "Start.doGet().FIN");
|
|
}
|
|
|
|
|
|
}
|