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 "F. Andy Seidl (JIRA)" <xm...@ws.apache.org> on 2008/07/25 06:41:31 UTC

[jira] Created: (XMLRPC-158) Solution provided in FAQ is wrong: How to I get the clients IP address in a handler?

Solution provided in FAQ is wrong:  How to I get the clients IP address in a handler?
-------------------------------------------------------------------------------------

                 Key: XMLRPC-158
                 URL: https://issues.apache.org/jira/browse/XMLRPC-158
             Project: XML-RPC
          Issue Type: Bug
            Reporter: F. Andy Seidl
            Priority: Minor


The code provided in the "How to I get the clients IP address in a handler?" does not work.  Specifically, the override of method newPropertyHandlerMapping(URL url) attempts to set a customized RequestSpecificProcessorFactoryFactory class but it does so too late for it to have any effect.

A correct (and cleaner) solution is to make use of the XmlRpcServlet.setRequestProcessorFactoryFactory() method which is intended for this purpose.  This can be done in the constructor of the derived class.  E.g.,:

public class MyXmlRpcServlet extends XmlRpcServlet
{
	public MyXmlRpcServlet()
	{
		RequestProcessorFactoryFactory factory = new RequestSpecificProcessorFactoryFactory()
		{
			protected Object getRequestProcessor(Class pClass, XmlRpcRequest pRequest) throws XmlRpcException
			{
				.
				.
				.
			}
		};

		setRequestProcessorFactoryFactory(factory);
	}
.
.
.
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (XMLRPC-158) Solution provided in FAQ is wrong: How to I get the clients IP address in a handler?

Posted by "Jochen Wiedmann (JIRA)" <xm...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/XMLRPC-158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12616827#action_12616827 ] 

Jochen Wiedmann commented on XMLRPC-158:
----------------------------------------

Could you provide a formal patch against faq.fml?


> Solution provided in FAQ is wrong:  How to I get the clients IP address in a handler?
> -------------------------------------------------------------------------------------
>
>                 Key: XMLRPC-158
>                 URL: https://issues.apache.org/jira/browse/XMLRPC-158
>             Project: XML-RPC
>          Issue Type: Bug
>            Reporter: F. Andy Seidl
>            Priority: Minor
>
> The code provided in the "How to I get the clients IP address in a handler?" does not work.  Specifically, the override of method newPropertyHandlerMapping(URL url) attempts to set a customized RequestSpecificProcessorFactoryFactory class but it does so too late for it to have any effect.
> A correct (and cleaner) solution is to make use of the XmlRpcServlet.setRequestProcessorFactoryFactory() method which is intended for this purpose.  This can be done in the constructor of the derived class.  E.g.,:
> public class MyXmlRpcServlet extends XmlRpcServlet
> {
> 	public MyXmlRpcServlet()
> 	{
> 		RequestProcessorFactoryFactory factory = new RequestSpecificProcessorFactoryFactory()
> 		{
> 			protected Object getRequestProcessor(Class pClass, XmlRpcRequest pRequest) throws XmlRpcException
> 			{
> 				.
> 				.
> 				.
> 			}
> 		};
> 		setRequestProcessorFactoryFactory(factory);
> 	}
> .
> .
> .
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (XMLRPC-158) Solution provided in FAQ is wrong: How to I get the clients IP address in a handler?

Posted by "Jochen Wiedmann (JIRA)" <xm...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/XMLRPC-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jochen Wiedmann resolved XMLRPC-158.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 3.1.1
         Assignee: Jochen Wiedmann

Thanks. In the end, I choosed a simpler solution, based on a ThreadLocal.


> Solution provided in FAQ is wrong:  How to I get the clients IP address in a handler?
> -------------------------------------------------------------------------------------
>
>                 Key: XMLRPC-158
>                 URL: https://issues.apache.org/jira/browse/XMLRPC-158
>             Project: XML-RPC
>          Issue Type: Bug
>            Reporter: F. Andy Seidl
>            Assignee: Jochen Wiedmann
>            Priority: Minor
>             Fix For: 3.1.1
>
>
> The code provided in the "How to I get the clients IP address in a handler?" does not work.  Specifically, the override of method newPropertyHandlerMapping(URL url) attempts to set a customized RequestSpecificProcessorFactoryFactory class but it does so too late for it to have any effect.
> A correct (and cleaner) solution is to make use of the XmlRpcServlet.setRequestProcessorFactoryFactory() method which is intended for this purpose.  This can be done in the constructor of the derived class.  E.g.,:
> public class MyXmlRpcServlet extends XmlRpcServlet
> {
> 	public MyXmlRpcServlet()
> 	{
> 		RequestProcessorFactoryFactory factory = new RequestSpecificProcessorFactoryFactory()
> 		{
> 			protected Object getRequestProcessor(Class pClass, XmlRpcRequest pRequest) throws XmlRpcException
> 			{
> 				.
> 				.
> 				.
> 			}
> 		};
> 		setRequestProcessorFactoryFactory(factory);
> 	}
> .
> .
> .
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.