Policy variables
You can use policy variables to resolve tokens of the form {$Variable_name} that can appear in the URL pattern setting of a proxy rule or in metadata.
Policy variables are used in the urlPattern
setting of a proxy rule item, or in a metadata section. There are two types of policy variables:
-
Endpoint variables
Endpoint variables define a single-value variable. They are typically used to define a specific backend host. When application developers use endpoint variables, they can write a policy rule so that it extracts those parts of the URL pattern in a variable that are specific to the current portal environment. Example:
- The portlet developer defines a proxy rule with the following URL pattern setting:
{$my_server}/mymail*
. This means that the resulting URL pattern is the value of the policy variable, appended with the path/mymail
. - The portal system administrator defines the value
http://www.the-remote-system.com
for the variablemy_server
. Therefore, the URL pattern of the policy rule ishttp://www.the-remote-system.com/mymail
. The benefit of this technique is that you can divide a URL pattern into parts that are owned by the portlet developer and parts that are owned by the portal system administrator. Therefore, the portlet developer can define a policy rule without knowing the concrete host name of the backend system to which the outbound connection is established.
- The portlet developer defines a proxy rule with the following URL pattern setting:
-
Dynamic policy variables
Dynamic policy variables can have more than one value. The purpose of this variable type is to define dynamic parts of the URL pattern without having to specify a policy rule more than once. Example:
- A policy rule URL pattern has the following URL pattern setting:
http://localhost/wps/{$my_dynamic_policy}/Main/*
. - The variable
my_dynamic_policy
is associated with the valuesportal
andmyportal
. As a result, the policy rule applies to URLs that start withhttp://localhost/wps/portal/Main/
orhttp://localhost/wps/myportal/Main/
. The purpose of this technique is to make one policy rule available for multiple URL patterns that can contain dynamic parts.
- A policy rule URL pattern has the following URL pattern setting: