Return to Snippet

Revision: 28885
at August 23, 2010 17:12 by alejandrosuch


Updated Code
/** Add this to your web.xml
<servlet>
   <servlet-name>AutoRegisterServlet</servlet-name>
   <display-name>Axis Autoregister Servlet</display-name>
   <servlet-class>such.alejandro.ws.deploy.AutoDeploy</servlet-class>
   <load-on-startup>30</load-on-startup>
</servlet>
**/

package such.alejandro.ws.deploy;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.axis.transport.http.AutoRegisterServlet;
import org.xml.sax.SAXException;

public class AutoDeploy extends AutoRegisterServlet {
	private static final long serialVersionUID = 1L;
	private static final String[] SERVICIOS_WEB = { "/WEB-INF/ruta/hacia/deploy.wsdd" };

	public void init() throws ServletException {
		for (int i = 0; i < SERVICIOS_WEB.length; i++) {
			
			try {
				String nombreRecursoServicioWeb = SERVICIOS_WEB[i];
				String realPath = this.getServletContext().getRealPath(nombreRecursoServicioWeb);
				InputStream stream = new FileInputStream(realPath);
				try {
					this.registerStream(stream);
				} catch (SAXException e) {
					this.lanzarError(nombreRecursoServicioWeb, e);
				} catch (ParserConfigurationException e) {
					this.lanzarError(nombreRecursoServicioWeb, e);
				} catch (IOException e) {
					this.lanzarError(nombreRecursoServicioWeb, e);
				}
			} catch (FileNotFoundException e1) {
				e1.printStackTrace();
			}
		}

		try {
			this.applyAndSaveSettings();
		} catch (Exception e) {
			String strError = new String("Se ha producido un error al intentar guardar la configuraci���³n " + "de los servicios web registrados. Error:"+ e.getMessage());
			throw new ServletException(strError, e);
		}
	}

	private void lanzarError(String nombreRecurso, Exception e) throws ServletException {
		String strError = new String("Se ha producido un error al intentar registrar el servicio web {" + nombreRecurso + "}. Error: {" + e.getMessage() + "}");
		throw new ServletException(strError, e);
	}
}

Revision: 28884
at July 15, 2010 18:33 by alejandrosuch


Updated Code
/** Add this to your web.xml
<servlet>
   <servlet-name>AutoRegisterServlet</servlet-name>
   <display-name>Axis Autoregister Servlet</display-name>
   <servlet-class>com.cesser.ua.deploy.AutoDeploy</servlet-class>
   <load-on-startup>30</load-on-startup>
</servlet>
**/

package such.alejandro.ws.deploy;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.axis.transport.http.AutoRegisterServlet;
import org.xml.sax.SAXException;

public class AutoDeploy extends AutoRegisterServlet {
	private static final long serialVersionUID = 1L;
	private static final String[] SERVICIOS_WEB = { "/WEB-INF/ruta/hacia/deploy.wsdd" };

	public void init() throws ServletException {
		for (int i = 0; i < SERVICIOS_WEB.length; i++) {
			
			try {
				String nombreRecursoServicioWeb = SERVICIOS_WEB[i];
				String realPath = this.getServletContext().getRealPath(nombreRecursoServicioWeb);
				InputStream stream = new FileInputStream(realPath);
				try {
					this.registerStream(stream);
				} catch (SAXException e) {
					this.lanzarError(nombreRecursoServicioWeb, e);
				} catch (ParserConfigurationException e) {
					this.lanzarError(nombreRecursoServicioWeb, e);
				} catch (IOException e) {
					this.lanzarError(nombreRecursoServicioWeb, e);
				}
			} catch (FileNotFoundException e1) {
				e1.printStackTrace();
			}
		}

		try {
			this.applyAndSaveSettings();
		} catch (Exception e) {
			String strError = new String("Se ha producido un error al intentar guardar la configuraci�³n " + "de los servicios web registrados. Error:"+ e.getMessage());
			throw new ServletException(strError, e);
		}
	}

	private void lanzarError(String nombreRecurso, Exception e) throws ServletException {
		String strError = new String("Se ha producido un error al intentar registrar el servicio web {" + nombreRecurso + "}. Error: {" + e.getMessage() + "}");
		throw new ServletException(strError, e);
	}
}

Revision: 28883
at July 15, 2010 18:32 by alejandrosuch


Updated Code
/** Add this to your web.xml
<servlet>
   <servlet-name>AutoRegisterServlet</servlet-name>
   <display-name>Axis Autoregister Servlet</display-name>
   <servlet-class>com.cesser.ua.deploy.AutoDeploy</servlet-class>
   <load-on-startup>30</load-on-startup>
</servlet>
**/

package such.alejandro.ws.deploy;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.axis.transport.http.AutoRegisterServlet;
import org.xml.sax.SAXException;

public class AutoDeploy extends AutoRegisterServlet {
	private static final long serialVersionUID = 1L;
	private static final String[] SERVICIOS_WEB = { "/WEB-INF/ruta/hacia/deploy.wsdd" };

	public void init() throws ServletException {
		for (int i = 0; i < SERVICIOS_WEB.length; i++) {
			
			try {
				String nombreRecursoServicioWeb = SERVICIOS_WEB[i];
				String realPath = this.getServletContext().getRealPath(nombreRecursoServicioWeb);
				InputStream stream = new FileInputStream(realPath);
				try {
					this.registerStream(stream);
				} catch (SAXException e) {
					this.lanzarError(nombreRecursoServicioWeb, e);
				} catch (ParserConfigurationException e) {
					this.lanzarError(nombreRecursoServicioWeb, e);
				} catch (IOException e) {
					this.lanzarError(nombreRecursoServicioWeb, e);
				}
			} catch (FileNotFoundException e1) {
				e1.printStackTrace();
			}
		}

		try {
			this.applyAndSaveSettings();
		} catch (Exception e) {
			String strError = new String("Se ha producido un error al intentar guardar la configuración " + "de los servicios web registrados. Error:"+ e.getMessage());
			throw new ServletException(strError, e);
		}
	}

	private void lanzarError(String nombreRecurso, Exception e) throws ServletException {
		String strError = new String("Se ha producido un error al intentar registrar el servicio web {" + nombreRecurso + "}. Error: {" + e.getMessage() + "}");
		throw new ServletException(strError, e);
	}
}

Revision: 28882
at July 15, 2010 18:31 by alejandrosuch


Initial Code
/** Add this to your web.xml
<servlet>
   <servlet-name>AutoRegisterServlet</servlet-name>
   <display-name>Axis Autoregister Servlet</display-name>
   <servlet-class>com.cesser.ua.deploy.AutoDeploy</servlet-class>
   <load-on-startup>30</load-on-startup>
</servlet>
**/

package com.cesser.ua.deploy;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.xml.parsers.ParserConfigurationException;

import org.apache.axis.transport.http.AutoRegisterServlet;
import org.xml.sax.SAXException;

public class AutoDeploy extends AutoRegisterServlet {
	private static final long serialVersionUID = 1L;
	private static final String[] SERVICIOS_WEB = { "/WEB-INF/ruta/hacia/deploy.wsdd" };

	public void init() throws ServletException {
		for (int i = 0; i < SERVICIOS_WEB.length; i++) {
			
			try {
				String nombreRecursoServicioWeb = SERVICIOS_WEB[i];
				String realPath = this.getServletContext().getRealPath(nombreRecursoServicioWeb);
				InputStream stream = new FileInputStream(realPath);
				try {
					this.registerStream(stream);
				} catch (SAXException e) {
					this.lanzarError(nombreRecursoServicioWeb, e);
				} catch (ParserConfigurationException e) {
					this.lanzarError(nombreRecursoServicioWeb, e);
				} catch (IOException e) {
					this.lanzarError(nombreRecursoServicioWeb, e);
				}
			} catch (FileNotFoundException e1) {
				e1.printStackTrace();
			}
		}

		try {
			this.applyAndSaveSettings();
		} catch (Exception e) {
			String strError = new String("Se ha producido un error al intentar guardar la configuración " + "de los servicios web registrados. Error:"+ e.getMessage());
			throw new ServletException(strError, e);
		}
	}

	private void lanzarError(String nombreRecurso, Exception e) throws ServletException {
		String strError = new String("Se ha producido un error al intentar registrar el servicio web {" + nombreRecurso + "}. Error: {" + e.getMessage() + "}");
		throw new ServletException(strError, e);
	}
}

Initial URL


Initial Description


Initial Title
Axis service autodeploy servlet

Initial Tags


Initial Language
Java