Package org.apache.xmlrpc.webserver

Examples of org.apache.xmlrpc.webserver.WebServer


public class Server {
    private static final int port = 8080;

    public static void main(String[] args) throws Exception {
        WebServer webServer = new WebServer(port);

        XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();

        PropertyHandlerMapping phm = new PropertyHandlerMapping();
        /*
         * Load handler definitions from a property file.
         * The property file might look like:
         * Calculator=org.apache.xmlrpc.demo.Calculator
         * org.apache.xmlrpc.demo.proxy.Adder=org.apache.xmlrpc.demo.proxy.AdderImpl
         */
        phm.load(Thread.currentThread().getContextClassLoader(), "org/apache/xmlrpc/webserver/XmlRpcServlet.properties");

        /*
         * You may also provide the handler classes directly, like this:
         * phm.addHandler("Calculator", org.apache.xmlrpc.demo.Calculator.class);
         * phm.addHandler(org.apache.xmlrpc.demo.proxy.Adder.class.getName(), org.apache.xmlrpc.demo.proxy.AdderImpl.class);
         */
        xmlRpcServer.setHandlerMapping(phm);

        XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) xmlRpcServer.getConfig();
        serverConfig.setEnabledForExtensions(true);
        serverConfig.setContentLengthOptional(false);

        webServer.start();
    }
View Full Code Here


        }
       
    }
   
    private WebServer startXmlRpcWebServer () throws Exception {
        WebServer webServer = new WebServer(10301);       
        XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
        PropertyHandlerMapping phm = new PropertyHandlerMapping();
        phm.addHandler("Calculator", Calculator.class);
        phm.addHandler("EchoService", EchoService.class);
        xmlRpcServer.setHandlerMapping(phm);
       
        webServer.start();
        return webServer;
    }
View Full Code Here

        }
      }
    }
    try
    {
      webServer = new WebServer(port);

      Logger log = Logger.getLogger("org.apache.xmlrpc.server.XmlRpcStreamServer");
      log.addAppender(new ConsoleAppender(new SimpleLayout()));
      log.setLevel(Level.OFF);
View Full Code Here

  private XMLRPCServer()
  {
    System.out.println("XMLRPCServer:");
    try
    {
      _server = new WebServer(PowerPakConfig.XMLRPC_PORT, InetAddress.getByName(PowerPakConfig.XMLRPC_HOST));
      XmlRpcServer xmlServer = _server.getXmlRpcServer();
      PropertyHandlerMapping phm = new PropertyHandlerMapping();
      xmlServer.setHandlerMapping(phm);
      int numServices = 0;
      try
View Full Code Here

     */
    public PyUnitServer(PythonRunnerConfig config, ILaunch launch) throws IOException {
        initializeDispatches();
        port = SocketUtil.findUnusedLocalPorts(1)[0];
        SocketUtil.checkValidPort(port);
        this.webServer = new WebServer(port);
        XmlRpcServer serverToHandleRawInput = this.webServer.getXmlRpcServer();
        serverToHandleRawInput.setHandlerMapping(new XmlRpcHandlerMapping() {

            public XmlRpcHandler getHandler(String handlerName) throws XmlRpcNoSuchHandlerException, XmlRpcException {
                return handler;
View Full Code Here

    public RhinoConsoleMain() {
        this.rhinoInterpreter = new RhinoInterpreter();
    }

    public void startXmlRpcServer(int port) throws IOException {
        WebServer webServer = new WebServer(port);
        XmlRpcServer serverToHandleRawInput = webServer.getXmlRpcServer();

        final Map<String, XmlRpcHandler> nameToHandler = new HashMap<String, XmlRpcHandler>();
        nameToHandler.put("addExec", new AddExecXmlRpcHandler(this));
        nameToHandler.put("getCompletions", new GetCompletionsXmlRpcHandler(this));
        nameToHandler.put("getDescription", new GetDescriptionXmlRpcHandler(this));
        nameToHandler.put("close", new CloseXmlRpcHandler(webServer, this));
        nameToHandler.put("hello", new HelloXmlRpcHandler());

        serverToHandleRawInput.setHandlerMapping(new XmlRpcHandlerMapping() {

            public XmlRpcHandler getHandler(String handlerName) throws XmlRpcNoSuchHandlerException, XmlRpcException {
                XmlRpcHandler handler = nameToHandler.get(handlerName);
                if (handler != null) {
                    return handler;
                }
                throw new XmlRpcNoSuchHandlerException("No handler for method " + handlerName);
            }
        });

        webServer.start();
    }
View Full Code Here

        err = new ThreadStreamReader(process.getErrorStream());
        out = new ThreadStreamReader(process.getInputStream());
        err.start();
        out.start();

        this.webServer = new WebServer(client_port);
        XmlRpcServer serverToHandleRawInput = this.webServer.getXmlRpcServer();
        serverToHandleRawInput.setHandlerMapping(new XmlRpcHandlerMapping() {

            public XmlRpcHandler getHandler(String handlerName) throws XmlRpcNoSuchHandlerException, XmlRpcException {
                return new XmlRpcHandler() {
View Full Code Here

    private XmlRpcServer embeddedXmlRpcServer;
    private boolean running;
    private XmlRpcServerControlPanel controlPanel;
   
    public Server(XmlRpcServerControlPanel controlPanel) {
        this.embeddedWebServer = new WebServer(Server.port);
        this.embeddedXmlRpcServer = this.embeddedWebServer.getXmlRpcServer();
        this.running = false;
        this.controlPanel = controlPanel;
       
        PropertyHandlerMapping propertyHandlerMapping = new PropertyHandlerMapping();
View Full Code Here

        stdErrReader = new ThreadStreamReader(process.getErrorStream());
        stdOutReader.start();
        stdErrReader.start();

        //start the server that'll handle input requests
        this.webServer = new WebServer(clientPort);
        XmlRpcServer serverToHandleRawInput = this.webServer.getXmlRpcServer();
        serverToHandleRawInput.setHandlerMapping(new XmlRpcHandlerMapping() {

            public XmlRpcHandler getHandler(String handlerName) throws XmlRpcNoSuchHandlerException, XmlRpcException {
                return PydevConsoleCommunication.this;
View Full Code Here

        stdErrReader = new ThreadStreamReader(process.getErrorStream());
        stdOutReader.start();
        stdErrReader.start();

        //start the server that'll handle input requests
        this.webServer = new WebServer(clientPort);
        XmlRpcServer serverToHandleRawInput = this.webServer.getXmlRpcServer();
        serverToHandleRawInput.setHandlerMapping(new XmlRpcHandlerMapping() {

            public XmlRpcHandler getHandler(String handlerName) throws XmlRpcNoSuchHandlerException, XmlRpcException {
                return JSConsoleCommunication.this;
View Full Code Here

TOP

Related Classes of org.apache.xmlrpc.webserver.WebServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.