LXCでServiceLocatorへのアクセスを有効にすることはできません。

問題

  • 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>
この記事は役に立ちましたか?
1人中1人がこの記事が役に立ったと言っています