You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlrpc-auto@ws.apache.org by "Jochen Wiedmann (JIRA)" <xm...@ws.apache.org> on 2008/08/05 16:50:44 UTC
[jira] Resolved: (XMLRPC-147) Capturing the client's IP address in
a handler does not work as advertised
[ https://issues.apache.org/jira/browse/XMLRPC-147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jochen Wiedmann resolved XMLRPC-147.
------------------------------------
Resolution: Fixed
Fix Version/s: 3.1.1
Assignee: Jochen Wiedmann
Fixed by adding a simplified version using a ThreadLocal.
> Capturing the client's IP address in a handler does not work as advertised
> --------------------------------------------------------------------------
>
> Key: XMLRPC-147
> URL: https://issues.apache.org/jira/browse/XMLRPC-147
> Project: XML-RPC
> Issue Type: Bug
> Components: Source
> Affects Versions: 3.1
> Environment: JDK 1.5.0_11 powered by Kubuntu 7.04 on an i686
> Reporter: Daniel Janus
> Assignee: Jochen Wiedmann
> Fix For: 3.1.1
>
>
> Below is a verbatim copy of an email I've sent to the xmlrpc-dev mailing 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.
> --- end of mail ---
> However, it is uncertain whether it is actually a bug in the FAQ or elsewhere.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.