-
Notifications
You must be signed in to change notification settings - Fork 24
What Does the Access Modifier Do in an event handler?
The access
modifier in an event-handler determines whether or not a
browser can access that event-handler directly by requesting that event
name via an URL. The access attribute may take the value of public
or
private
. Setting the access modifier to public
allows browsers to
request that event as well as allows other events to announce that event
programatically. Setting the it to private
denies direct access to
that event-handler when a browser requests it via an url. This means
that an another event-handler has to programatically announce this event
for it to be run.
If you forget to define an access type for your event-handler, it will
default to public
. Mach-II allows you to not define an access type,
however it is not best practice to rely on the framework to use the
default as this could potentially introduce a security hole in your
application.
We recommend that you explicitly define the access attribute when
defining your event-handler. Defining an access attribute also improves
the readability of your configuration file by explicitly showing the
access type. By not defining an access type, you assume other developers
know what the default value the Mach-II assigns is public
.