Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.xmlrpc.webserver
Class ServletWebServer

    java.lang.Object
      org.apache.xmlrpc.webserver.WebServer
          org.apache.xmlrpc.webserver.ServletWebServer

All Implemented Interfaces:
  java.lang.Runnable

    public class ServletWebServer

extends WebServer

This is a subclass of the `WebServer`, which offers a minimal servlet API. It is recommended to use this class, rather than the `WebServer`, because it offers you a smooth migration path to a full blown servlet engine.

Use of the `ServletWebServer` goes like this: First of all, create a servlet. It may be an instance of `XmlRpcServlet` or a subclass thereof. Note, that servlets are stateless: One servlet may be used by multiple threads (aka requests) concurrently. In other words, the servlet must not have any instance variables, other than those which are read only after the servlets initialization.

The XmlRpcServlet is by default using a property file named `org/apache/xmlrpc/server/webserver/XmlRpcServlet.properties`. See the `PropertyHandlerMapping` for details on the property file.

       final int port = 8088;

       XmlRpcServlet servlet = new XmlRpcServlet();
       ServletWebServer webServer = new ServletWebServer(servlet, port);
       webServer.start();

Nested Class Summary
`static class` | `ServletWebServer.Exception` This exception is thrown by the request handling classes, advising the server, that it should return an error response.

Field Summary

Fields inherited from class org.apache.xmlrpc.webserver.WebServer
`accept, deny, server, serverSocket`

Constructor Summary
`ServletWebServer(HttpServlet pServlet, int pPort)` Creates a new instance, which is listening on all local IP addresses and the given port.
`ServletWebServer(HttpServlet pServlet, int pPort, java.net.InetAddress pAddr)` Creates a new instance, which is listening on the given IP address and the given port.

Method Summary
`protected ThreadPool.Task` | `newTask(WebServer pWebServer, XmlRpcStreamServer pXmlRpcServer, java.net.Socket pSocket)`

Methods inherited from class org.apache.xmlrpc.webserver.WebServer
`acceptClient, allowConnection, createServerSocket, denyClient, getPort, getXmlRpcServer, isParanoid, log, log, newThreadPool, newXmlRpcStreamServer, run, setParanoid, shutdown, start`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ServletWebServer

    public ServletWebServer(HttpServlet pServlet,
                            int pPort)
                     throws ServletException

  Creates a new instance, which is listening on all local IP addresses and the given port.

  Parameters:
    `pServlet` - The servlet, which is handling requests.
    `pPort` - The servers port number; 0 for a random port being choosen.
  Throws:
    `ServletException` - Initializing the servlet failed.

### ServletWebServer

    public ServletWebServer(HttpServlet pServlet,
                            int pPort,
                            java.net.InetAddress pAddr)
                     throws ServletException

  Creates a new instance, which is listening on the given IP address and the given port.

  Parameters:
    `pServlet` - The servlet, which is handling requests.
    `pPort` - The servers port number; 0 for a random port being choosen.
    `pAddr` - The servers IP address.
  Throws:
    `ServletException` - Initializing the servlet failed.

Method Detail

### newTask

    protected ThreadPool.Task newTask(WebServer pWebServer,
                                      XmlRpcStreamServer pXmlRpcServer,
                                      java.net.Socket pSocket)
                               throws java.io.IOException

  Overrides:
    `newTask` in class `WebServer`
  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.