問題
- LXC 環境で
ServiceLocator
にアクセスできるようにしたい。
Environment
- LXC
- DXP 7.4
解決策
- LXC のマルチテナントの性質上、
ServiceLocator
を含め、有効にできない変数がいくつか存在します。 ServiceLocator
の代替アプローチとして、変数restClient
を使用すると、非常に簡単にLiferayのヘッドレスAPIを利用することができます。- 以下は、
restClient
変数の例です:
<div class="fragment_1"> [#assign myNotifications = restClient.get("/headless-user-notification/v1.0/my-user-notifications").items /] [#list myNotifications as curNotification] <ul class="list-group"> <li class="list-group-item"> <div class="date-created">${curNotification.dateCreated}</div> <div class="message">${curNotification.message}</div> </li> </ul> [/#list] </div>
会員限定記事
Liferay エンタープライズ サブスクリプションをお持ちのお客様は1500件を超えるベストプラクティス、トラブルシューティング、その他のソリューション記事を閲覧できます。ログインすると、記事全体をお読みいただけます。
ログイン