legacy-knowledge-base
公開されました Sep. 10, 2025

Liferay DXP 7.0におけるserviceLocatorコールの有効化に関する変更点

written-by

Justin Choi

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

この記事では、Liferayプラットフォーム(PortalとDXPの両方)で、 serviceLocator プロパティを定義する場所が変更されたことを説明します。

Portal 6.2のこの機能に慣れている開発者は、このプロパティを有効または無効にすることで、FreemarkerまたはVelocityの特定の呼び出しでWeb Content Templatesを作成できるようにすることができます。 そのため、DXP 7.0で何が変わったのか気になるところでしょう。

解決策

Portal 6.2 では、プロパティは portal.properties ファイルに設定されていました。

    # Set a comma delimited list of variables the FreeMarker engine cannot
    # have access to. This will affect Dynamic Data List templates, Journal
    # templates, and Portlet Display templates.
    #
    freemarker.engine.restricted.variables=\
        objectUtil,\
        serviceLocator,\
        staticFieldGetter,\
        staticUtil,\
        utilLocator

    # Set a comma delimited list of variables the Velocity engine cannot
    # have access to. This will affect Dynamic Data List templates, Journal
    # templates, and Portlet Display templates.
    #
    velocity.engine.restricted.variables=\
        serviceLocator,\
        staticFieldGetter,\
        utilLocator

デフォルトでは、 serviceLocator への呼び出しは制限されています。 その使用を許可するために、開発者は portal-ext.properties ファイルを更新する必要がありました。 DXP 7.0では、これらの設定はコントロールパネルに移されました。

FreeMarkerの場合、 コントロールパネル → 設定 → システム設定 → Foundation → FreeMarker Engine → Restricted Variablesに移動します。

service-locator-freemarker_01.png

Velocityの場合、 コントロールパネル → 設定 → システム設定 → Foundation → Velocity Engine → Restricted Variablesに移動します。

サービスロケータ-ベロシティ_02.png

テンプレートが serviceLocatorを使用できるようにするには、フィールドの値を削除し、 Updateをクリックします。 次に、アプリケーションサーバーを再起動し、変更を適用します。 この変更により、 serviceLocator 呼び出しを使用できるWebコンテンツ・テンプレートを作成できるようになりました。

did-this-article-resolve-your-issue

legacy-knowledge-base