Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6137

ListenerInterfaceRequestHandler simplification

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 8.0.0-M1
    • Fix Version/s: 8.0.0-M1
    • Component/s: wicket
    • Labels:
      None

      Description

      Branch "request_listener_simplification" contains a proposal to simplify ListenerInterfaceRequestHandler.

      By limiting components and behaviors to implement a single callback only, we can remove the identifying part "I*Listener" from URLs.
      For page 0, renderCount 1 and behavior 2 the following componentInfos:

      0-1.ILinkListener-link
      0-1.ILinkListener.2-link
      0-IResourceListener-image
      0-IResourceListener.2-wmc

      ... become:

      0-1.-link
      0-1.2-link
      0--image
      0-.2-wmc

      This format could be further improved, suggestions are welcomed.

      This has the following advantages:

      • framework exposure in URLs is minimized
      • URLs get shorter
      • no need to register INTERFACE constants any longer
      • instead using of reflection ListenerInterfaceRequestHandler can call a single method on the component or behavior, which makes debugging easier.
      • a single interface for components or behavior is enough to be targeted by requests:
      	public interface IRequestListener extends IClusterable
      	{
      
      		/**
      		 * Does invocation of this listener render the page. 
      		 * 
      		 * @return default {@code true}, i.e. a {@link RenderPageRequestHandler} is scheduled after invocation 
      		 */
      		default boolean rendersPage()
      		{
      			return true;
      		}
      	
      		/**
      		 * Called when a request is received.
      		 */
      		void onRequest();
      	}
      

        Issue Links

          Activity

          Hide
          svenmeier Sven Meier added a comment -

          Many thanks for your feedback Pedro:

          • IRequestListener#onRequest() fits nicely with AjaxEventBehavior#onEvent() and AjaxFormSubmitBehavior#onSubmit(), so I don't think #listen() would be an improvement
          • I've tried adding the request as a parameter: only one implementing method benefited from the argument, all others are not interested in the request object
          • #canCallListener() has different arguments for components and behaviors :/. Furthermore a component can decide whether it wants to allow behaviors to receive requests, even if it doesn't implement IRequestListener itself. Thus I don't see how we pull this method into IRequestListener.
          Show
          svenmeier Sven Meier added a comment - Many thanks for your feedback Pedro: IRequestListener#onRequest() fits nicely with AjaxEventBehavior#onEvent() and AjaxFormSubmitBehavior#onSubmit(), so I don't think #listen() would be an improvement I've tried adding the request as a parameter: only one implementing method benefited from the argument, all others are not interested in the request object #canCallListener() has different arguments for components and behaviors :/. Furthermore a component can decide whether it wants to allow behaviors to receive requests, even if it doesn't implement IRequestListener itself. Thus I don't see how we pull this method into IRequestListener.
          Hide
          pedrosans Pedro Santos added a comment -

          Hi Sven, amazing work, thx. Just some ideas:

          • to simplify/reduce IRequestListener#onRequest to IRequestListener#listen
          • to add the request as a method parameter to IRequestListener#onRequest. e.g. onRequest(request) or listen(request)
          • to move Component#canCallListener to IRequestListener, so this flag can only be tested in meaningful places. The component doesn't listen to request, but it rather can listen to requests by implementing IRequestListener.
          Show
          pedrosans Pedro Santos added a comment - Hi Sven, amazing work, thx. Just some ideas: to simplify/reduce IRequestListener#onRequest to IRequestListener#listen to add the request as a method parameter to IRequestListener#onRequest. e.g. onRequest(request) or listen(request) to move Component#canCallListener to IRequestListener, so this flag can only be tested in meaningful places. The component doesn't listen to request, but it rather can listen to requests by implementing IRequestListener.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 5b37aedcb89b3c0a1976f4003ac4779e2f78963a in wicket's branch refs/heads/master from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=5b37aed ]

          WICKET-6137 renamed ..ListenerInterface.. methods to ..Listener..

          Show
          jira-bot ASF subversion and git services added a comment - Commit 5b37aedcb89b3c0a1976f4003ac4779e2f78963a in wicket's branch refs/heads/master from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=5b37aed ] WICKET-6137 renamed ..ListenerInterface.. methods to ..Listener..
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 9ec235f9f5c47112528cedcadb4cf5ae19172866 in wicket's branch refs/heads/master from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=9ec235f ]

          WICKET-6137 renamed BookmarkableListenerInterfaceRequestHandler to BookmarkableListenerRequestHandler

          Show
          jira-bot ASF subversion and git services added a comment - Commit 9ec235f9f5c47112528cedcadb4cf5ae19172866 in wicket's branch refs/heads/master from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=9ec235f ] WICKET-6137 renamed BookmarkableListenerInterfaceRequestHandler to BookmarkableListenerRequestHandler
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 8342e4ef9acd442ddfe7ad78d04838d17c1b9fec in wicket's branch refs/heads/master from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=8342e4e ]

          WICKET-6137 renamed ListenerInterfaceRequestHandler to ListenerRequestHandler

          there isn't a ..ListenerInterface any more

          Show
          jira-bot ASF subversion and git services added a comment - Commit 8342e4ef9acd442ddfe7ad78d04838d17c1b9fec in wicket's branch refs/heads/master from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=8342e4e ] WICKET-6137 renamed ListenerInterfaceRequestHandler to ListenerRequestHandler there isn't a ..ListenerInterface any more
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit b2e66340417e44677eb1e0cf39e2c3dd0687efc1 in wicket's branch refs/heads/master from Andrea Del Bene
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=b2e6634 ]

          Guide changed due to WICKET-6137

          Show
          jira-bot ASF subversion and git services added a comment - Commit b2e66340417e44677eb1e0cf39e2c3dd0687efc1 in wicket's branch refs/heads/master from Andrea Del Bene [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=b2e6634 ] Guide changed due to WICKET-6137
          Hide
          svenmeier Sven Meier added a comment -

          Merged into master. Possible further improvements:

          • better name for IRequestListener#rendersPage()
          • nicer encoding of pageId, renderCount and behaviorId (e.g. -0-1.1-) in URL
          Show
          svenmeier Sven Meier added a comment - Merged into master. Possible further improvements: better name for IRequestListener#rendersPage() nicer encoding of pageId, renderCount and behaviorId (e.g. -0-1.1-) in URL
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 3e6c0a819a98d4893434ed219186f945f8530352 in wicket's branch refs/heads/master from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=3e6c0a8 ]

          WICKET-6137 javadoc adjustments

          Show
          jira-bot ASF subversion and git services added a comment - Commit 3e6c0a819a98d4893434ed219186f945f8530352 in wicket's branch refs/heads/master from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=3e6c0a8 ] WICKET-6137 javadoc adjustments
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 69f4862756477ce78208cc1f09420884f262c6a1 in wicket's branch refs/heads/master from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=69f4862 ]

          WICKET-6137 don't render dot separator when no renderCount and no behaviorId

          Show
          jira-bot ASF subversion and git services added a comment - Commit 69f4862756477ce78208cc1f09420884f262c6a1 in wicket's branch refs/heads/master from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=69f4862 ] WICKET-6137 don't render dot separator when no renderCount and no behaviorId
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 19e01b2a8891604249a3ac16439d6ba0d704688c in wicket's branch refs/heads/master from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=19e01b2 ]

          WICKET-6137 test fixes: request listener has to exist

          Show
          jira-bot ASF subversion and git services added a comment - Commit 19e01b2a8891604249a3ac16439d6ba0d704688c in wicket's branch refs/heads/master from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=19e01b2 ] WICKET-6137 test fixes: request listener has to exist
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 538ca833d513dbd7943ad22dd6e0eb2cd85dfb07 in wicket's branch refs/heads/master from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=538ca83 ]

          WICKET-6137 adjusted more hard-coded urls in test code

          Show
          jira-bot ASF subversion and git services added a comment - Commit 538ca833d513dbd7943ad22dd6e0eb2cd85dfb07 in wicket's branch refs/heads/master from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=538ca83 ] WICKET-6137 adjusted more hard-coded urls in test code
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 53c5dc67316d49b147e61efe2c493adc5434ed85 in wicket's branch refs/heads/master from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=53c5dc6 ]

          WICKET-6137 more stateless urls without render count

          Show
          jira-bot ASF subversion and git services added a comment - Commit 53c5dc67316d49b147e61efe2c493adc5434ed85 in wicket's branch refs/heads/master from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=53c5dc6 ] WICKET-6137 more stateless urls without render count
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 18ab9bec6a7e492990043351a4f4e6cbadc95f4f in wicket's branch refs/heads/master from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=18ab9be ]

          WICKET-6137 removed strange url mangling in test: rendering count increases with each render

          Show
          jira-bot ASF subversion and git services added a comment - Commit 18ab9bec6a7e492990043351a4f4e6cbadc95f4f in wicket's branch refs/heads/master from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=18ab9be ] WICKET-6137 removed strange url mangling in test: rendering count increases with each render
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit c353fc8433e27fe7e2547f04713c41ce4d8a25cc in wicket's branch refs/heads/master from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=c353fc8 ]

          WICKET-6137 fixing tests: listener interface no longer in url; stateless components don't need render count in url

          Show
          jira-bot ASF subversion and git services added a comment - Commit c353fc8433e27fe7e2547f04713c41ce4d8a25cc in wicket's branch refs/heads/master from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=c353fc8 ] WICKET-6137 fixing tests: listener interface no longer in url; stateless components don't need render count in url
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit e9be1b97a993cb4777e7bcddc57ce9a63801be2c in wicket's branch refs/heads/master from Martin Grigorov
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=e9be1b9 ]

          WICKET-6137 Javadoc fix and code formatting

          Show
          jira-bot ASF subversion and git services added a comment - Commit e9be1b97a993cb4777e7bcddc57ce9a63801be2c in wicket's branch refs/heads/master from Martin Grigorov [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=e9be1b9 ] WICKET-6137 Javadoc fix and code formatting
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 0b798d999727d9642dd34c5db166b5a4cd4e7cd3 in wicket's branch refs/heads/master from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=0b798d9 ]

          WICKET-6137 renamed to IRequstListener#rendersPage() with default; javadoc; InlineFrame needs not to be dependent on rendering

          Show
          jira-bot ASF subversion and git services added a comment - Commit 0b798d999727d9642dd34c5db166b5a4cd4e7cd3 in wicket's branch refs/heads/master from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=0b798d9 ] WICKET-6137 renamed to IRequstListener#rendersPage() with default; javadoc; InlineFrame needs not to be dependent on rendering
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 657e449a7334aa933512f8b5a5700a04c3964e16 in wicket's branch refs/heads/master from Martin Grigorov
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=657e449 ]

          WICKET-6137 Fix javadocs

          Show
          jira-bot ASF subversion and git services added a comment - Commit 657e449a7334aa933512f8b5a5700a04c3964e16 in wicket's branch refs/heads/master from Martin Grigorov [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=657e449 ] WICKET-6137 Fix javadocs
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 199f3fc7457e03001c7f41ddbabd9db2b495eec7 in wicket's branch refs/heads/request_listener_simplification from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=199f3fc ]

          WICKET-6137 javadoc adjustments

          Show
          jira-bot ASF subversion and git services added a comment - Commit 199f3fc7457e03001c7f41ddbabd9db2b495eec7 in wicket's branch refs/heads/request_listener_simplification from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=199f3fc ] WICKET-6137 javadoc adjustments
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 421181e74de9ea77dc8a97e63000dce863023845 in wicket's branch refs/heads/request_listener_simplification from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=421181e ]

          WICKET-6137 dot is unnecessary when no render count and no behaviorId in listener

          Show
          jira-bot ASF subversion and git services added a comment - Commit 421181e74de9ea77dc8a97e63000dce863023845 in wicket's branch refs/heads/request_listener_simplification from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=421181e ] WICKET-6137 dot is unnecessary when no render count and no behaviorId in listener
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 2abf434caecb6a6f07fc4238209c2495817a2e8f in wicket's branch refs/heads/request_listener_simplification from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=2abf434 ]

          WICKET-6137 javadoc adjustments

          Show
          jira-bot ASF subversion and git services added a comment - Commit 2abf434caecb6a6f07fc4238209c2495817a2e8f in wicket's branch refs/heads/request_listener_simplification from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=2abf434 ] WICKET-6137 javadoc adjustments
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit b60ba3d80c3db957f7b2afee730e4cc197da2f1b in wicket's branch refs/heads/request_listener_simplification from Sven Meier
          [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=b60ba3d ]

          WICKET-6137 don't render dot separator when no renderCount and no behaviorId

          Show
          jira-bot ASF subversion and git services added a comment - Commit b60ba3d80c3db957f7b2afee730e4cc197da2f1b in wicket's branch refs/heads/request_listener_simplification from Sven Meier [ https://git-wip-us.apache.org/repos/asf?p=wicket.git;h=b60ba3d ] WICKET-6137 don't render dot separator when no renderCount and no behaviorId

            People

            • Assignee:
              svenmeier Sven Meier
              Reporter:
              svenmeier Sven Meier
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development