[ http://issues.apache.org/jira/browse/XMLRPC-125?page=all ]

Jimisola Laursen updated XMLRPC-125:
------------------------------------

    Attachment: XMLRPC-125.diff

1) changed instance variables to protected from private

2) added a method newPropertyHandlerMapping() (called A)


    protected PropertyHandlerMapping newPropertyHandlerMapping()
    {
        PropertyHandlerMapping mapping = new PropertyHandlerMapping();
        
        return mapping;
    }

    which is called by newPropertyHandlerMapping(URL url) (called B)

        protected PropertyHandlerMapping newPropertyHandlerMapping(URL url) 
throws IOException, XmlRpcException {
            PropertyHandlerMapping mapping = newPropertyHandlerMapping();


I don't really like the naming of the methods since they only differ by an 
argument. I'd prefer if:

  1. A was called newPropertyHandlerMapping(): since it merely creates a new 
instance
  2. B was called initPropertyHandlerMapping(URL url): since it initiates the 
mapping instance

but I don't want to break the API.

Don't know if this is the  best of solution. Perhaps a better solution would be 
to have a Factory class?
The factory class (HandlerMappingFactory) would go hand in hand with 
newPropertyHandlerMapping and initPropertyHandlerMapping(URL url).

public interface HandlerMappingFactory
{
    protected XmlrRpcHandlerMapping newXmlRpcHandlerMapping(URL url) throws 
IOException, XmlRpcException;
}

The factory class would be called from

XmlRpcServlet.newXmlRpcHandlerMapping: 
handlerMappingFactory.newXmlRpcHandlerMapping(url)

The XmlRpcServlet will per default use the PropertyHandlerMappingFactory 
implementation but this can be set using XmlRpcServlet.setHandlerMappingFactory.

Let me know if you want me to provide a patch for the factory solution.

> Ease extending XmlRpcServlet
> ----------------------------
>
>                 Key: XMLRPC-125
>                 URL: http://issues.apache.org/jira/browse/XMLRPC-125
>             Project: XML-RPC
>          Issue Type: Improvement
>          Components: Source
>    Affects Versions: 3.1
>            Reporter: Jimisola Laursen
>         Attachments: XMLRPC-125.diff
>
>
> Short story:  XmlRpcServlet is not easy to extend since 1) instance variables 
> are private and 2) newPropertyHandlerMapping(URL url) method that often needs 
> to be extended contains logic and potential bug fixes to risk to be missed.
> Long story: the long story is that two classes needs to be extended only to 
> be able to change what methods are to be registered in 
> AbstractReflectiveHandlerMapping.registerPublicMethods (this is done by 
> extending isHandlerMethod).
> I'd prefer a solution where AbstractReflectiveHandlerMapping nor 
> XmlRpcServlet needs to be extended.

-- 
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

        

Reply via email to