You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: etc/wiki/06.-Application.md
+67Lines changed: 67 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,73 @@ Nalu offers the possibility to add a custom alert and confirm dialog. In case it
56
56
57
57
A custom alert needs to implement the `IsCustomAlertPresenter` and a custom confirm dialog needs to implement the `IsCustomConfirmPresenter`.
58
58
59
+
## Hash-less Routing
60
+
61
+
Usually Nalu uses hashes to route. A hash looks something like this: **#/applicationShell/myroute01**. In case you want to use anchors or use Domino-UI v2 as widget library, you might run into trouble.
62
+
For example Domino-UI generates **href="#"** attributes for links. This is correct, but, when clicked will update the hash which wil trigger a - unwanted - routing.
63
+
In case of Domino-UI you can configure the **ElementsFactory**-class to create an a-tag without the href-attribute.
64
+
65
+
Nalu offers also an alternative. By setting the **useHash**-attribute of the **Applicaiton**-interface to **false**, Nalu will not use a hash. Instead it uses the URI.
66
+
67
+
This is an example of an URL in case useHash is true:
and this represents the same URI in cae useHash is false:
74
+
75
+
```
76
+
http://localhost:8080/applicationShell/myRoute01"
77
+
```
78
+
79
+
This will work with no difference with one exception:
80
+
81
+
In case of a reload, the hash will be ignored on the server side and the hash-less URI will create a Status 404 because the path is unknown.
82
+
83
+
To avoid that, you have to implement a filter, that recognize this URIs and redirect after updating the URL. Here is an example (based on Spring Boot v3) how the filter looks like:
The classes need to identify the routes of the clients. The easiest way to do that is look for the shell names at the start of the path.
121
+
In case a route is identified, change the route to something like **index.html?uri=[route]** and redirect the URL. Now the client calls the server
122
+
again. This time with and URL that looks like: **index.html?uri=[route]**. Now the server works as expected and because of the **uri**-key Nalu
123
+
will use this as start route.
124
+
125
+
59
126
## Filter Annotation
60
127
Nalu allows you to use filters to stop routings in order to interrupt a route before it is handled. In case a route is interrupted, you can redirect to another route.
0 commit comments