Click
  1. Click
  2. CLK-539

TypeConverter without overriding ClickServlet?

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.0
    • Component/s: None
    • Labels:
      None

      Description

      Please move the TypeConverter out of the ClickServlet or change the API to be easier to use. Right now it requires to override the ClickServlet too .
      http://incubator.apache.org/click/docs/pages.html#page-param-auto-binding

      thanks,
      Joseph.

        Activity

        Hide
        Malcolm Edgar added a comment -

        Documentation patch applied Adrian,

        thanks Malcolm

        Show
        Malcolm Edgar added a comment - Documentation patch applied Adrian, thanks Malcolm
        Hide
        Adrian A. added a comment -

        Documentation update patch (3_-_doco_for...) for using a custom type converter (the old documentation was about extending click servlet - the new one shows how to use this new init parameter)

        Show
        Adrian A. added a comment - Documentation update patch (3_-_doco_for...) for using a custom type converter (the old documentation was about extending click servlet - the new one shows how to use this new init parameter)
        Hide
        Adrian A. added a comment -

        I also made a second version:
        2_not_working_TypeConverter_as_init-param.diff
        exactly the same way createConfigService() was made, i.e. by using:
        servletContext.getInitParameter() instead of directly calling getInitParameter(),
        and this is not working (at least on the containers I tested).
        So I think that defining custom service configuration in web.xml will
        not work in Click since servletContext.getInitParameter() does not return any init parameter.

        Show
        Adrian A. added a comment - I also made a second version: 2_ not_working _TypeConverter_as_init-param.diff exactly the same way createConfigService() was made, i.e. by using: servletContext.getInitParameter() instead of directly calling getInitParameter(), and this is not working (at least on the containers I tested). So I think that defining custom service configuration in web.xml will not work in Click since servletContext.getInitParameter() does not return any init parameter.
        Hide
        Adrian A. added a comment -

        This is a simple patch for this issue. It reads a "type-converter-class" at init. This way there's no need to subclass the ClickServlet.

        Show
        Adrian A. added a comment - This is a simple patch for this issue. It reads a "type-converter-class" at init. This way there's no need to subclass the ClickServlet.
        Hide
        Adrian A. added a comment -

        > Could you provide a patch for this.
        Joseph,
        no need to make yourself one because I already had this functionality around - see the patch 1. attached.

        Show
        Adrian A. added a comment - > Could you provide a patch for this. Joseph, no need to make yourself one because I already had this functionality around - see the patch 1. attached.
        Hide
        Malcolm Edgar added a comment - - edited

        +1

        I think adding an Servlet <init-parameter> to specify the type converter class would be a good idea. Could you provide a patch for this.

        thanks Malcolm Edgar

        Show
        Malcolm Edgar added a comment - - edited +1 I think adding an Servlet <init-parameter> to specify the type converter class would be a good idea. Could you provide a patch for this. thanks Malcolm Edgar

          People

          • Assignee:
            Malcolm Edgar
            Reporter:
            Joseph Schmidt
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development