FileDocCategorySizeDatePackage
WSStartupServlet.javaAPI DocExample6618Tue May 29 16:57:12 BST 2007com.sun.xml.ws.transport.tcp.server.glassfish

WSStartupServlet

public final class WSStartupServlet extends HttpServlet implements ServletContextAttributeListener, ServletContextListener
author
JAX-WS team

Fields Summary
private static final Logger
logger
private static final String
JAXWS_RI_RUNTIME
private WSTCPLifeCycleModule
transportModule
private List
adapters
Constructors Summary
Methods Summary
public voidattributeAdded(javax.servlet.ServletContextAttributeEvent scab)

    
public voidattributeRemoved(javax.servlet.ServletContextAttributeEvent scab)

    
public voidattributeReplaced(javax.servlet.ServletContextAttributeEvent scab)

    
public voidcontextDestroyed(javax.servlet.ServletContextEvent contextEvent)

        logger.log(Level.FINE, "WSStartupServlet.contextDestroyed");
        if (transportModule != null && adapters != null) {
            transportModule.free(contextEvent.getServletContext().getContextPath(),
                    adapters);
        }
    
public voidcontextInitialized(javax.servlet.ServletContextEvent contextEvent)

        logger.log(Level.FINE, "WSStartupServlet.contextInitialized");
        final ServletContext servletContext = contextEvent.getServletContext();
        final TCPContext context = new TCPServletContext(servletContext);
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        if (classLoader == null) {
            classLoader = getClass().getClassLoader();
        }
        final ServletContainer container = new ServletContainer(servletContext);
        
        try {
            transportModule = WSTCPLifeCycleModule.getInstance();
            final DeploymentDescriptorParser<TCPAdapter> parser = new DeploymentDescriptorParser<TCPAdapter>(
                    classLoader, new TCPResourceLoader(context), container, TCPAdapter.FACTORY);
            final URL sunJaxWsXml = context.getResource(JAXWS_RI_RUNTIME);
            if(sunJaxWsXml==null)
                throw new WebServiceException(MessagesMessages.WSTCP_0014_NO_JAXWS_DESCRIPTOR());
            adapters = parser.parse(sunJaxWsXml.toExternalForm(), sunJaxWsXml.openStream());
            
            transportModule.register(servletContext.getContextPath(), adapters);
        } catch (Exception e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
            throw new IllegalStateException("listener.parsingFailed", e);
        }
    
protected voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)

    
protected voiddoPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)