ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nils_Kilden-Peder...@Countrywide.Com
Subject Re: jetty with XML-RPC
Date Thu, 17 Feb 2005 23:59:07 GMT
Here's a very simple example of how you can do it:

public final class XmlRpcServlet extends HttpServlet {
    private XmlRpcServer server = new XmlRpcServer();

    public void init() throws ServletException {
        // Add your handlers here:
        this.server.addHandler(whatever);
  }
 
    public void doPost(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
        byte[] result = this.server.execute(request.getInputStream());
        response.setContentType("text/xml");
        response.setContentLength(result.length);
        OutputStream out = response.getOutputStream(); 
        out.write(result);
        out.close();
    }
}


"Massive Boisson" <massive.boisson@gmail.com> wrote on 02/17/2005 03:52:07 
PM:

> I'd love to know what is +1 mean?
> 
> Anyway, thanks for the reply. After reading documentation some more,
> I guess this would make sense. And I could put the servlet into Jetty
> (I am trying to have it run all in on JVM).
> 
> But what I really cannot find answer to now is following:
> 
> Let's say I do this:
>  org.apache.xmlrpc.WebServer.addHandler("myHandler", myHandler);
> (I will try to start with webServer and only switch to XmlRpcServer &
> servlet once I start seeing problems)
> 
> 1. Now it opens a new thread for every incomming request? 
> --> (Yes it opens new thread for every incomming request)
> 2. But does it use one instance of myHandler, or does it create new 
instance 
> of myHandler for every request? 
> --> (It creates new instance of myHandler for every request)
> Am I right with my ansers.
> 
> Thankfully,
> 
> --MB
> 

Mime
View raw message