FileDocCategorySizeDatePackage
JettyAxisServer.javaAPI DocApache Axis 1.43826Sat Apr 22 18:57:28 BST 2006org.apache.axis.transport.http

JettyAxisServer

public class JettyAxisServer extends Object

Fields Summary
protected static Log
log
org.mortbay.http.HttpServer
server
Jetty HTTP Server *
org.mortbay.http.SocketListener
listener
Socket Listener *
org.mortbay.http.HttpContext
context
HTTP Context
Constructors Summary
public JettyAxisServer()


      
        // Create a context 
        context.setContextPath("/axis/*");
        server.addContext(context);
      
        // Create a servlet container
        ServletHandler servlets = new ServletHandler();
        context.addHandler(servlets);

        // Map a servlet onto the container
        servlets.addServlet("AdminServlet", "/servlet/AdminServlet",
                "org.apache.axis.transport.http.AdminServlet");
        servlets.addServlet("AxisServlet", "/servlet/AxisServlet",
                "org.apache.axis.transport.http.AxisServlet");
        servlets.addServlet("AxisServlet", "/services/*",
                "org.apache.axis.transport.http.AxisServlet");
        servlets.addServlet("AxisServlet", "*.jws",
                "org.apache.axis.transport.http.AxisServlet");
        context.addHandler(new ResourceHandler());
    
Methods Summary
public static voidmain(java.lang.String[] args)

        Options opts = null;
        try {
            opts = new Options(args);
        } catch (MalformedURLException e) {
            log.error(Messages.getMessage("malformedURLException00"), e);
            return;
        }
        JettyAxisServer server = new JettyAxisServer();
        server.setPort(opts.getPort());
        String dir = opts.isValueSet('d");
        if (dir == null) {
            // Serve static content from the context
            dir = System.getProperty("jetty.home", ".") + "/webapps/axis/";
        }
        server.setResourceBase(dir);
        
        // Start the http server
        try {
            server.start();
        } catch (Exception e) {
            log.error(Messages.getMessage("exception00"), e);
        }
    
public voidsetPort(int port)
Set the port

param
port

        listener.setPort(port);
        server.addListener(listener);
    
public voidsetResourceBase(java.lang.String dir)
Set the resource base

param
dir

        context.setResourceBase(dir);
    
public voidstart()
Start the server

throws
Exception

        server.start();
        log.info(
                Messages.getMessage("start00", "JettyAxisServer",
                        new Integer(listener.getServerSocket().getLocalPort()).toString()));