Trace:
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
jvx:server:lco:actions_in_objects [2018/02/02 12:35] admin |
jvx:server:lco:actions_in_objects [2020/07/08 17:52] (current) cduncan articles |
||
---|---|---|---|
Line 1: | Line 1: | ||
~~NOTRANS~~ | ~~NOTRANS~~ | ||
- | ~~Title: Actions in Server objects~~ | + | ~~Title: Actions in Server Objects~~ |
- | Every [[jvx:server:lco:actions|server-side action]] should be defined in a [[jvx:server:lco:lifecycle|life-cycle object]] (= LCO). Sometimes it's better to group functionality in helper objects. | + | Every [[jvx:server:lco:actions|server-side action]] should be defined in a [[jvx:server:lco:lifecycle|life cycle object]] (LCO). Sometimes, it's better to group functionality in helper objects. |
It's very easy to encapsulate functionality in objects. Just create an object and add public methods: | It's very easy to encapsulate functionality in objects. Just create an object and add public methods: | ||
Line 32: | Line 32: | ||
Our Car class has two methods: **getType** and **getSpeed**! | Our Car class has two methods: **getType** and **getSpeed**! | ||
- | If you're using the Car class in your life-cycle obect, like following: | + | If you're using the Car class in your life cycle object, like the following: |
<file java> | <file java> | ||
Line 67: | Line 67: | ||
But this call would throw a SecurityException with "access is not allowed". | But this call would throw a SecurityException with "access is not allowed". | ||
- | It's not possible to call every method of an object just because it's public. This could open back-doors. | + | It's not possible to call every method of an object just because it's public. This could open back doors. |
You have to define accessible methods - from objects - via annotation: | You have to define accessible methods - from objects - via annotation: | ||
Line 98: | Line 98: | ||
will work without problems! | will work without problems! | ||
- | If you define a public method in your LCO (= action), it's always accessible because usually you will offere business logic or storages for the client. But it's possible to deny the access to objects or actions: | + | If you define a public method in your LCO (action), it's always accessible because, usually, you will offer business logic or storages for the client. But it's possible to deny the access to objects or actions: |
<file java Session.java> | <file java Session.java> | ||
Line 151: | Line 151: | ||
will work without problems. | will work without problems. | ||
- | The security controller doesn't check simple method calls because the developer should have the freedom to do everything on server-side. | + | The security controller doesn't check simple method calls because the developer should have the freedom to do everything on server side. |