Fucking here is your help. :)

I took Hannes example which I found in CVS for the
project, and added a few lines to let it serve any
function in the neuroinfo class.

-Jim



// Copyright 1999 Hannes Wallnöfer, Raphael Spannocchi

// package helma.xmlrpc;


import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.Vector;

import org.apache.xmlrpc.*;

import mbf.neuroinfo.*;

/**
 * A prototype servlet to run XML-RPC. <p>
 * 
 * Note that some clients like the one in Frontier 5 and the first version of 
XmlRpcApplet 
 * had XML-RPC requests hard-coded to URI /RPC2. To work with these clients, you have 
 * to configure your servlet environment to respond to /RPC2. This has been fixed in 
the 
 * new version of the XmlRpcApplet.
 * 
 */

public class XmlRpcServlet extends HttpServlet
{
    XmlRpcServer xmlrpc;

    Neuroinfo itsNeuroinfo;

    public void init(ServletConfig config) throws ServletException 
    {
        // this is necessary before getServletContext() will work
        super.init(config);

        // what was that Database URL?
        //    it's set in the web.xml file for this web application.
        String dbURL = (String)getServletContext().getInitParameter("databaseURL");
        String dbDriver = 
(String)getServletContext().getInitParameter("databaseDriver");
        itsNeuroinfo = new Neuroinfo(dbURL, dbDriver);

        xmlrpc = new XmlRpcServer (); 
        xmlrpc.addHandler("neuroinfo", itsNeuroinfo);
    }

    public void doPost(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException  
    {
        byte[] result = xmlrpc.execute(req.getInputStream ());
        res.setContentType("text/xml");
        res.setContentLength(result.length);
        OutputStream output = res.getOutputStream();
        output.write(result);
        output.flush();
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException  
    {
        // Set the content type of the response
        response.setContentType("text/html");

        // Create a PrintWriter to write the response
        java.io.PrintWriter out =
        new java.io.PrintWriter(response.getOutputStream());

        // Print the HTML header
        out.println("<html>");
        out.println("<head>");
        out.println("<title>XMLRPC handler for Neuroinfo</title>");
        out.println("</head>");
        out.println("<body>");

        out.println("<h2>XMLRPC handler for Neuroinfo</h2>");

        out.println("</body>");
        out.println("</html>");
        out.flush();
    }

}


> -----Original Message-----
> From: Gereanu Raul [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, March 15, 2002 2:30 AM
> To: [EMAIL PROTECTED]
> Subject: Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Need an Servlet 
> Example - Fucking help
> 
> 
> I was hoping some help not  a message to get out from here. :-)
> ----- Original Message ----- 
> From: "Daniel Rall" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, March 14, 2002 7:17 PM
> Subject: Re: Help!!! Need an Servlet Example - Fucking help
> 
> 
> > "Gereanu Raul" <[EMAIL PROTECTED]> writes:
> > 
> > > It cames a lot of help. From everybody. I knew it before 
> I posting.
> > 
> > Please refrain from sending HTML email to the mailing lists.
> 
> 

Reply via email to