Examples

The examples are for the generic end point eo-form in WebEo.java using just plain html form with an editable text field.

It demonstrates the communication from your browser as client to the server.

Empty call

One can send any json getting the json as a response.

As a result one receive a json with some additional special fields from elastic objects:

  • _rootmodel: Set the model of the root
  • _logLevel: Default logLevel to fill log information
  • _calls: List of calls found in Json

For elastic objects there this is an empty map object.

Special fields

Those "informational" fields without object mapping are defined static in PathElement.java and used by Elastic Objects internally.

The generic webserver interface WebEo.java defined here has no

  • object mapping,
  • functional meaning
  • or error handling.

The method eoPostForm just has a JSON string message as input. With this message this method creates a new EO object.

Any type information within this JSON message is used by JSONToEO to instantiate typed objects.

Any Call type will be added to a "_call" list. At the end WebEo.java will execute this list.

One advantage is that one can write tests without starting any application server thing. Further more the client is free to define any structure he needs.

One send a serialized object and receive "the same" serialized but enriched object. Thats all.

Log Level

One can change the _logLevel to receive some more information.

One get then some feedback from the server in the logs list.

Return format

One can change the serialization type to json to return plan json without eo extensions. Default value for _serializationType is "EO".

The following example will return an empty json object due to _serializationType "STANDARD".

Mapping To Objects

A mapping will be defined by keys defined in the ≡Model Configurations.

Generally the model keys will be prepended to the field key except the root models.

Root Models

The _rootModels entry refers to the type, the root is set.

Model Prefix

The mapping for any sub field could be defined by a java casting type expression:

Standard JSON

Standard json will be mapped straightforward:

Functionality

All models that implements the ≡Call interface will be set to the _call list and could be exectuted.

The implementation could be rather trivial as in the example with ≡SinusValueCall .

The following example will read the value from source and set the target value with the computed sinus.

Templates

A special call is ≡TemplateResourceCall . The file content will be replaced by values or the result of other function calls.

Every page will be created by get and RequestMapping WebEoGet.java or post by WebEo.java.

At the bottom of each page you fid a post version sending the json via browser. Without the asTemplate parameter the json will be returned. Of course it's readable.

This Page Elements
Get Method: WebEoGet.java
Post Method: WebEo.java
Page-Template: ≡ContentPage.html
Header: Header.html
Content-Directory:⊚examples
Navigation: ≡examples_Nav.html
Content: ExamplesStart.html
Footer: Footer.html
Postversion of this page: