[
http://issues.apache.org/jira/browse/XMLRPC-117?page=comments#action_12437783 ]
Jimisola Laursen commented on XMLRPC-117:
-----------------------------------------
Jochen,
Tried my patch with Jetty 6.0.1 (due to JETTY-121) and we have a Catch 22
problem with my patch and the current workings of XmlRpcServlet.
A NPE will occur on XmlRpcServlet.setAuthenticationHandler:85:
server.setAuthenticationHandler(pHandler);
with the following code (slightly updated version of the test for XMLRPC-116 to
make use of JETTY-121):
org.mortbay.jetty.Server server = new org.mortbay.jetty.Server();
Connector connector = new SocketConnector();
connector.setPort(8080);
server.setConnectors(new Connector[]{connector});
Context root = new Context(server, "/", Context.SESSIONS);
XmlRpcServlet servlet = new XmlRpcServlet();
ServletHolder servletHolder = new ServletHolder(servlet);
servlet.setAuthenticationHandler(new MyAuthenticationHandler());
root.addServlet(servletHolder, "/RPC2/*");
servletHolder.setInitParameter("enabledForExtensions", "true");
servletHolder.setInitParameter("contentLengthOptional", "true");
server.setSendServerVersion(true);
server.start();
server.join();
The reason for this is XmlRpcServlet.server is not instansiated until init has
been invoked and Jetty doesn't invoke the init method until startup (i.e.
during doStart(...)). The following line is in XmlRpcServlet.init(...)
server = newXmlRpcServer(pConfig);
And even though the newXmlRpcServer takes ServletConfig it is not used:
protected XmlRpcServletServer newXmlRpcServer(ServletConfig pConfig)
throws XmlRpcException {
return new XmlRpcServletServer();
}
Also not that AuthenticationHandler, RequestProcessorFactoryFactory and
TypeConverterFactory must have been set prior to
newXmlRpcHandlerMapping/newPropertyHandlerMapping being called since the
XmlRpcHandlerMapping must use those explicitly configured.
So, to sum it up:
1) server has not been instansiated by init being called when the setters for
AuthenticationHandler, RequestProcessorFactoryFactory and TypeConverterFactory
are called
2) the XmlRpcServlet cannot call newXmlRpcHandlerMapping to set
XmlRpcHandlerMappingon the XmlRpcServletServer (server) until
AuthenticationHandler, RequestProcessorFactoryFactory and TypeConverterFactory
have had a chance to be configured
A simply workaround for 1) would be to outside the XMLRPC library when using
Jetty do:
1. context.start();
2. call setters on XmlRpcServlet
3. server.start();
Note: The problem specified in 2) still exists. A simple change would be to not
call newXmlRpcHandlerMapping until the first call to doPost(...).
> XmlRpcServlet should allow for usage of AuthenticationHandler,
> RequestProcessorFactoryFactory and TypeConverterFactory implementations to be
> configurable
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: XMLRPC-117
> URL: http://issues.apache.org/jira/browse/XMLRPC-117
> Project: XML-RPC
> Issue Type: Improvement
> Reporter: Jimisola Laursen
> Attachments: XMLRPC-117.diff
>
>
> The XmlRpcServlet should have setters for
> - AuthenticationHandler
> - RequestProcessorFactoryFactory
> - TypeConverterFactory
> and it shall use this accordingly.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira