You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-dev@ws.apache.org by Daniel Janus <da...@sentivision.com> on 2007/09/04 18:48:43 UTC
Bug in FAQ for WS-XMLRPC 3.1
Hello list,
The FAQ as currently hosted at http://ws.apache.org/xmlrpc/faq.html
has an incorrect answer for server question 4: "How to I get the clients IP
address in a handler?" with respect to WS-XMLRPC 3.1.
The recommended solution is to override newPropertyHandlerMapping() in
XmlRpcServlet-derived subclasses, as follows:
protected PropertyHandlerMapping newPropertyHandlerMapping(URL url)
throws IOException, XmlRpcException
{
PropertyHandlerMapping mapping = super.newPropertyHandlerMapping(url);
RequestProcessorFactoryFactory factory =
new RequestSpecificProcessorFactoryFactory() {
protected Object getRequestProcessor(Class pClass,
XmlRpcRequest pRequest) throws XmlRpcException
{
RequestInitializableRequestProcessor proc =
(RequestInitializableRequestProcessor)
super.getRequestProcessor(pClass, pRequest);
proc.init((MyConfig) pRequest.getConfig());
return proc;
}
};
mapping.setRequestProcessorFactoryFactory(factory);
return mapping;
}
However, this does not work because (as I found out after several hours' worth
of digging through the code) the reflexive handler mapping is established
during the call to super.newPropertyHandlerMapping(), when the new factory is
not yet set up.
The solution is to re-establish the mappings after setting up the custom
request processor factory factory, by adding the following before
the return statement:
mapping.load(Thread.currentThread().getContextClassLoader(), url);
I would be grateful if the FAQ gets updated, so that other people can
avoid the confusion I'd stumbled over.
Sincerely,
--
Daniel Janus <da...@sentivision.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: xmlrpc-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: xmlrpc-dev-help@ws.apache.org
Re: Bug in FAQ for WS-XMLRPC 3.1
Posted by Alan Burlison <Al...@sun.com>.
Daniel Janus wrote:
>>> mapping.load(Thread.currentThread().getContextClassLoader(), url);
>> That sounds like a problem, which we should not simply handle by
>> changing the FAQ. Would you please be so kind to create a JIRA issue,
>> where we can continue the discussion?
>
> I've created issue XMLRPC-147:
>
> https://issues.apache.org/jira/browse/XMLRPC-147
I really can't believe that the multiple layers of hackery outlined in
the FAQ are needed to get what *should* be a fairly straightforward and
regularly-used bit of information - the client's address. And to add
insult to injury, it appears that the entry in the FAQ is *still* wrong
5 months after this was reported. Quite frankly, the API is an abysmal
mess - having to subclass implementation classes such as
XmlRpcHttpRequestConfigImpl is a pretty clear indication that the whole
thing is badly designed, and as for class names like
RequestProcessorFactoryFactory.RequestSpecificProcessorFactoryFactory,
if it wasn't in the docs I'd think it was someone trying to have a laugh.
--
Alan Burlison
--
---------------------------------------------------------------------
To unsubscribe, e-mail: xmlrpc-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: xmlrpc-dev-help@ws.apache.org
Re: Bug in FAQ for WS-XMLRPC 3.1
Posted by Daniel Janus <da...@sentivision.com>.
On Tuesday 04 September 2007 21:06:05 Jochen Wiedmann wrote:
> Hello, Daniel,
>
> On 9/4/07, Daniel Janus <da...@sentivision.com> wrote:
> > However, this does not work because (as I found out after several hours'
> > worth of digging through the code) the reflexive handler mapping is
> > established during the call to super.newPropertyHandlerMapping(), when
> > the new factory is not yet set up.
> >
> > The solution is to re-establish the mappings after setting up the custom
> > request processor factory factory, by adding the following before
> > the return statement:
> >
> > mapping.load(Thread.currentThread().getContextClassLoader(), url);
>
> That sounds like a problem, which we should not simply handle by
> changing the FAQ. Would you please be so kind to create a JIRA issue,
> where we can continue the discussion?
I've created issue XMLRPC-147:
https://issues.apache.org/jira/browse/XMLRPC-147
Sincerely,
--
Daniel Janus <da...@sentivision.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: xmlrpc-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: xmlrpc-dev-help@ws.apache.org
Re: Bug in FAQ for WS-XMLRPC 3.1
Posted by Jochen Wiedmann <jo...@gmail.com>.
Hello, Daniel,
On 9/4/07, Daniel Janus <da...@sentivision.com> wrote:
> However, this does not work because (as I found out after several hours' worth
> of digging through the code) the reflexive handler mapping is established
> during the call to super.newPropertyHandlerMapping(), when the new factory is
> not yet set up.
>
> The solution is to re-establish the mappings after setting up the custom
> request processor factory factory, by adding the following before
> the return statement:
>
> mapping.load(Thread.currentThread().getContextClassLoader(), url);
That sounds like a problem, which we should not simply handle by
changing the FAQ. Would you please be so kind to create a JIRA issue,
where we can continue the discussion?
Thanks,
Jochen
--
Look, that's why there's rules, understand? So that you think before
you break 'em.
-- (Terry Pratchett, Thief of Time)
---------------------------------------------------------------------
To unsubscribe, e-mail: xmlrpc-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: xmlrpc-dev-help@ws.apache.org