XML-RPC
  1. XML-RPC
  2. XMLRPC-116

XmlRpcServlet.init(...) should support init params using reflection and not only hardcoded support for the init param "enabledForExtensions"

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      XmlRpcServlet currently doesn't support any other init param other than "enabledForExtension" which means that people will have to subclass XmlRpcServlet if they want to set e.g. contentLengthOptional.

      After a discussion in xmlrpc-dev the following solution was decided upon:

      1. iterate over ServletConfig.getInitParameterNames
      2. foreach init param name check if there is a corresponding setter method (setter can only have one argument)
      3. convert init param value to the data type that the setters argument has

      Q: In step 3) what data types should be supported? byte, short, int, long, float, double and String?
      A: Should simply reuse code from the ReflectionUtils. (Don't remember the class name right now, but there is existing functionality, which is used by the AbstractReflectiveXmlRpcHandlerMapping.

      Q: What exception should be thrown (ServletException?) if no matching method can be found in step 2) or data type conversion fails in step 3)?
      A: A ServletException mapping the actual exception (for example
      IllegalArgumentException).

      1. XMLRPC-116.diff
        11 kB
        Jimisola Laursen
      2. XMLRPC-116.diff
        10 kB
        Jimisola Laursen
      3. test.zip
        10 kB
        Jimisola Laursen
      4. XMLRPC-116.diff
        15 kB
        Jimisola Laursen

        Activity

        Hide
        Jimisola Laursen added a comment -

        starting on a patch for this issue

        Show
        Jimisola Laursen added a comment - starting on a patch for this issue
        Hide
        Jimisola Laursen added a comment -

        Attaching patch as discussed.

        Added class ServletInitParamReflectionHelper to handle reflection code for servlet init params.

        Show
        Jimisola Laursen added a comment - Attaching patch as discussed. Added class ServletInitParamReflectionHelper to handle reflection code for servlet init params.
        Hide
        Jimisola Laursen added a comment -

        some test code for the provided patch (XMLRPC-116.diff )

        note: that setAuthenticationHandler etc cannot be tested using Jetty due to a bug that I reported (http://jira.codehaus.org/browse/JETTY-121)

        Show
        Jimisola Laursen added a comment - some test code for the provided patch ( XMLRPC-116 .diff ) note: that setAuthenticationHandler etc cannot be tested using Jetty due to a bug that I reported ( http://jira.codehaus.org/browse/JETTY-121 )
        Hide
        Jimisola Laursen added a comment -

        Should have mentioned this patch includes both patch for XMLRPC-117 and this issue.
        This was actually the first time I had multiple patches against trunk and I forgot to synchronize to latest revision again.

        Jochen, you figure it out

        Show
        Jimisola Laursen added a comment - Should have mentioned this patch includes both patch for XMLRPC-117 and this issue. This was actually the first time I had multiple patches against trunk and I forgot to synchronize to latest revision again. Jochen, you figure it out
        Hide
        Jochen Wiedmann added a comment -

        Jimisola, as you may have noted, I have applied a modified version of your patch for XMLRPC-117. In other words, this patch is no longer valid. Please be so kind to submit an updated version.

        Additionally, you might consider to configure the new servlet properties (as introduced with XMLRPC-117) via the reflection utilities.

        Show
        Jochen Wiedmann added a comment - Jimisola, as you may have noted, I have applied a modified version of your patch for XMLRPC-117 . In other words, this patch is no longer valid. Please be so kind to submit an updated version. Additionally, you might consider to configure the new servlet properties (as introduced with XMLRPC-117 ) via the reflection utilities.
        Hide
        Jimisola Laursen added a comment -

        updated patch since XMLRPC-117 patch was changed slightly

        Show
        Jimisola Laursen added a comment - updated patch since XMLRPC-117 patch was changed slightly
        Hide
        Jimisola Laursen added a comment -

        attached the wrong diff previously. this is the one to use

        Show
        Jimisola Laursen added a comment - attached the wrong diff previously. this is the one to use
        Hide
        Jochen Wiedmann added a comment -

        Applied, with minor changes.

        Show
        Jochen Wiedmann added a comment - Applied, with minor changes.
        Hide
        Jochen Wiedmann added a comment -

        Closing issues which have been released.

        Show
        Jochen Wiedmann added a comment - Closing issues which have been released.

          People

          • Assignee:
            Unassigned
            Reporter:
            Jimisola Laursen
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development