Uploaded image for project: 'Click'
  1. Click
  2. CLK-599

Support private and protected bindable variables

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.0 RC1
    • Fix Version/s: 2.1.0
    • Component/s: core
    • Labels:
      None

      Description

      A common complaint against Apache Click is its use of public bindable variables.

      Would be good if Click supports binding of private and protected variables as well.

        Activity

        Hide
        medgar Malcolm Edgar added a comment -

        Have updated examples and documentation to use protected visibility bindable fields

        Show
        medgar Malcolm Edgar added a comment - Have updated examples and documentation to use protected visibility bindable fields
        Hide
        sabob Bob Schellink added a comment - - edited

        I received the following exception when trying to edit a customer in the advanced-table example:

        java.lang.IllegalAccessException: Class ognl.OgnlRuntime can not access a member of class org.apache.click.examples.page.EditCustomer with modifiers "protected"
        at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
        at java.lang.reflect.Field.doSecurityCheck(Field.java:960)
        at java.lang.reflect.Field.getFieldAccessor(Field.java:896)
        at java.lang.reflect.Field.set(Field.java:657)
        at ognl.OgnlRuntime.setFieldValue(OgnlRuntime.java:1154)
        at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:76)
        at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
        at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1670)
        at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
        at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
        at ognl.SimpleNode.setValue(SimpleNode.java:246)
        at ognl.Ognl.setValue(Ognl.java:476)
        at org.apache.click.util.PropertyUtils.setValueOgnl(PropertyUtils.java:170)
        at org.apache.click.ClickServlet.processPageRequestParams(ClickServlet.java:1167)
        at org.apache.click.ClickServlet.initPage(ClickServlet.java:1107)
        at org.apache.click.ClickServlet.createPage(ClickServlet.java:928)
        at org.apache.click.ClickServlet.handleRequest(ClickServlet.java:347)
        at org.apache.click.ClickServlet.doGet(ClickServlet.java:261)

        Show
        sabob Bob Schellink added a comment - - edited I received the following exception when trying to edit a customer in the advanced-table example: java.lang.IllegalAccessException: Class ognl.OgnlRuntime can not access a member of class org.apache.click.examples.page.EditCustomer with modifiers "protected" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65) at java.lang.reflect.Field.doSecurityCheck(Field.java:960) at java.lang.reflect.Field.getFieldAccessor(Field.java:896) at java.lang.reflect.Field.set(Field.java:657) at ognl.OgnlRuntime.setFieldValue(OgnlRuntime.java:1154) at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:76) at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1670) at ognl.ASTProperty.setValueBody(ASTProperty.java:101) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) at ognl.SimpleNode.setValue(SimpleNode.java:246) at ognl.Ognl.setValue(Ognl.java:476) at org.apache.click.util.PropertyUtils.setValueOgnl(PropertyUtils.java:170) at org.apache.click.ClickServlet.processPageRequestParams(ClickServlet.java:1167) at org.apache.click.ClickServlet.initPage(ClickServlet.java:1107) at org.apache.click.ClickServlet.createPage(ClickServlet.java:928) at org.apache.click.ClickServlet.handleRequest(ClickServlet.java:347) at org.apache.click.ClickServlet.doGet(ClickServlet.java:261)
        Hide
        sabob Bob Schellink added a comment -

        Fix checked in.

        @Malcolm, you might want to double check this fix for thread safety. You can view the changes here:

        http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/ClickServlet.java?r1=900775&r2=902382&diff_format=h

        I've also made a slight change to XmlConfigService to only load parent classes up to but excluding Page.class.

        http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java?r1=893922&r2=902382&diff_format=h

        Show
        sabob Bob Schellink added a comment - Fix checked in. @Malcolm, you might want to double check this fix for thread safety. You can view the changes here: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/ClickServlet.java?r1=900775&r2=902382&diff_format=h I've also made a slight change to XmlConfigService to only load parent classes up to but excluding Page.class. http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/service/XmlConfigService.java?r1=893922&r2=902382&diff_format=h
        Hide
        sabob Bob Schellink added a comment -

        fixed in trunk

        Show
        sabob Bob Schellink added a comment - fixed in trunk

          People

          • Assignee:
            medgar Malcolm Edgar
            Reporter:
            sabob Bob Schellink
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development