First Previous Next Last Portal Guide  

CHAPTER 19    Portal Replacement Strings

This chapter provides reference information for the portal replacement strings. It includes the following sections:

 
Top of page

About replacement strings

Director allows you to use replacement strings to include runtime, context-based information in a portal application. Replacement strings are keywords that reference things that can change dynamically at runtime, such as a user's current theme or the currently rendered component ID. When these keywords are detected at runtime, they are replaced based on information from the current HTTP request and/or the current portal context.

All portal replacement strings are defined as constants in the EboPortalUrlHelper class in the com.sssw.portal.util package.

 
Top of section

Where they can be used

Replacement strings can be used in several places in a portal application:

Portal pages

In a PID page or JSP page, you can use replacement strings to construct URLs, URIs, and query strings for the following HTML elements:

Director provides a portal component called PortalUrlHelper to give an easy way to use replacement strings on a portal page. Director also provides a custom tag called PortalUrlHelper that performs the same function.

For more information    For details on using the PortalUrlHelper component, see the chapter on installed components in the Samples. For details on using the PortalUrlHelper custom tag, see PortalUrlHelper.

Descriptors for portal resources

You can use replacement strings in the descriptors for the following portal resources:

Resource type

Elements searched for replacement strings

Portal layouts

  • preview-image

Portal themes

  • preview-image

  • thumbnail-image

Portal options

  • link

  • image

Portal components

Same as for portal options

WAR descriptor for a custom Web application

Replacement strings can also be used in the following context-param values in the web.xml file for a custom Web application:

 
Top of section

What they are

There are several categories of replacement string keywords:

Category

Keywords

URLs

Paths

IDs

Other

 
Top of page

$COMP_PATH$

Description

Extra path information following the path to the controller servlet that tells the servlet to serve a component's undecorated content.

The $COMP_PATH$ keyword is equivalent to the PortalPathCompKey context parameter in the web.xml file for the portal WAR.

Example

The following example:

  $PORTAL_SERVLET_URL$/$COMP_PATH$/HelloWorldComponent

Would be parsed and converted to:

  http://host/context/main/comp/HelloWorldComponent

 
Top of page

$COMPONENT_ID$

Description

Component ID of the user's currently selected component.

Example

If a link were placed in a page that had the URL http://host/context/main/MyPage/finance and the current component were called HelloWorld, the following example:

  ?ss_action=remove&ss_comp=$COMPONENT_ID$&ss_instance=$COMPONENT_INSTANCE_ID$

Would be parsed and converted to:

  http://host/context/main/MyPage/finance?ss_action=remove&ss_comp=HelloWorld&ss_instance=123456

 
Top of page

$COMPONENT_INSTANCE_ID$

Description

Instance ID of the user's currently selected component.

Example

If a link were placed in a page that had the URL http://host/context/main/MyPage/finance and the current component were called HelloWorld, the following example:

  ?ss_action=remove&ss_comp=$COMPONENT_ID$&ss_instance=$COMPONENT_INSTANCE_ID$

Would be parsed and converted to:

  http://host/context/main/MyPage/finance?ss_action=remove&ss_comp=HelloWorld&ss_instance=123456

 
Top of page

$COMPONENT_PATH$

Description

Extra path information following the path to the controller servlet that tells the servlet to serve a single decorated component.

The $COMPONENT_PATH$ keyword is equivalent to the PortalPathComponentKey context parameter in the web.xml file for the portal WAR.

Example

The following example:

  $PORTAL_SERVLET_URL$/$COMPONENT_PATH$/HelloWorldComponent

Would be parsed and converted to:

  http://host/context/main/component/HelloWorldComponent

 
Top of page

$context$

Description

Used for compatibility with Director 3.0. $CONTEXT_URL$ should be used in its place going forward.

The $context$ keyword is equivalent to:

  $SCHEME$://$HOST_PORT$/$CONTEXT_PATH$

Or:

  $CONTEXT_URL$

Example

The following example:

  $context$/jsp/PropertySheet.jsp

Would be parsed and converted to:

  http://host/context/jsp/PropertySheet.jsp

 
Top of page

$CONTEXT_PATH$

Description

Path to the context on HttpServletRequest.

The $CONTEXT_PATH$ keyword is equivalent to the value returned from HttpServletRequest.getContextPath() excluding the preceding slash.

Example

The following example:

  http://host/$CONTEXT_PATH$/main

Would be parsed and converted to:

  http://host/Portal/main

 
Top of page

$CONTEXT_URL$

Description

URL reference to the servlet context.

The $CONTEXT_URL$ keyword is equivalent to:

  $SCHEME$://$HOST_PORT$/$CONTEXT_PATH$

Example

The following example:

  $CONTEXT_URL$/jsp/PropertySheet.jsp

Would be parsed and converted to:

  http://host/context/jsp/PropertySheet.jsp

 
Top of page

$ENCODED_REQUEST_URL$

Description

Complete encoded URL reference.

The $ENCODE_REQUEST_URL$ keyword is equivalent to the URL-encoded value returned from HttpServletRequest.getRequestURL().

Example

The following example:

  http://host/catalog?callingpage=$ENCODED_REQUEST_URL$

Would be parsed and converted to:

  http://host/catalog/callingpage=http%3A%2F%2Flocalhost%2FPortal%2Fmain%2FMyPortal%2FMyProfile

 
Top of page

$HOST$

Description

The host for the HttpServletRequest. Use this keyword when you want to specify a port other than the port on the current request.

The $HOST$ keyword is equivalent to the value returned from HttpServletRequest.getServerName() for the current request.

Example

The following example:

  $SCHEME$://$HOST$

Would be parsed and converted to:

  http://myhost

 
Top of page

$HOST_PORT$

Description

Host and port for the HttpServletRequest.

The $HOST_PORT$ keyword is equivalent to the value returned from HttpServletRequest.getServerName() and HttpServletRequest.getServerPort() for the current request.

If the current port is the default for the scheme specified, then the port is left out.

Example

If myhost were the string returned from HttpServletRequest.getServerName() and 9090 is the string returned from HttpServletRequest.getServerPort() for the current request, the following example:

  $SCHEME$://$HOSTP_PORT$

Would be parsed and converted to:

  http://myhost:9090

 
Top of page

$MYPORTAL_PATH$

Description

Extra path information following the path to the controller servlet that tells the servlet to serve the user's personalized pages.

The $MYPORTAL_PATH$ keyword is equivalent to the PortalPathMyPortalKey context parameter in the web.xml file for the portal WAR.

Example

The following example:

  $PORTAL_SERVLET_URL$/$MYPORTAL_PATH$

Would be parsed and converted to:

  http://host/context/myportal/main

 
Top of page

$PAGE_PATH$

Description

Extra path information following the path to the controller servlet that tells the servlet to serve a PID page.

The $PAGE_PATH$ keyword is equivalent to the PortalPathPagesKey context parameter in the web.xml file for the portal WAR.

Example

The following example:

  $PORTAL_SERVLET_URL$/$PAGE_PATH$/helloWorldPID.html

Would be parsed and converted to:

  http://host/context/main/page/helloWorldPID.html

 
Top of page

$PORTAL_SERVLET_PATH$

Description

Main path to the portal controller servlet.

The $PORTAL_SERVLET_PATH$ keyword is equivalent to the PortalControllerServletPath context parameter in the web.xml file for the portal WAR.

Example

The following example:

  $CONTEXT_URL$/$PORTAL_SERVLET_PATH$/comp/HelloWorld

Would be parsed and converted to:

  http://host/context/main/comp/HelloWorld

 
Top of page

$PORTAL_SERVLET_URL$

Description

URL reference to the portal controller servlet.

The $PORTAL_SERVLET_URL$ keyword is equivalent to:

  $SCHEME$://$HOST_PORT$/$CONTEXT_PATH$/$PORTAL_SERVLET_PATH$

Example

The following example:

  $PORTAL_SERVLET_URL$/$COMPONENT_PATH$

Would be parsed and converted to:

  http://host/DirectorDB/EAR/Portal/main/component

NOTE:   The DirectorDB portion of the URL applies only if you're using an exteNd application server and you've deployed your archive to the same database created for Director application data. If you're using another application server or if you've deployed the archive to the SilverMaster database, the URL would not include the name of the Director database. The EAR portion of the URL would not be included for a Director WAR.

 
Top of page

$PORTAL_USERPAGE_NAME$

Description

Name of the current Portal User Page.

The $PORTAL_USERPAGE_NAME$ keyword is the name given to the current personal page by the user.

Example

The following example:

  $PORTAL_USERPAGE_NAME$

Might be parsed and converted to:

  MyFinance

 
Top of page

$REQUEST_URL$

Description

Complete URL reference to the request (without the query parameters).

The $REQUEST_URL$ keyword is equivalent to the value returned from req.getRequestURL() on the current request.

Example

The following example:

  $REQUEST_URL$?mode=new

Would be parsed and converted to:

  http://host/context/edit.jsp?mode=new

 
Top of page

$RESOURCE_URL$

Description

URL reference to the resource path.

The $RESOURCE_URL$ keyword is equivalent to:

  $SCHEME$://$HOST_PORT$/$CONTEXT_PATH$/$RESOURCE_PATH$

Example

The following example:

  $RESOURCE_URL$/portal-general/images/Hello.gif

Would be parsed and converted to:

  http://host/context/resource/portal-general/images/Hello.gif

 
Top of page

$SCHEME$

Description

The scheme for the HttpServletRequest.

The $SCHEME$ keyword is equivalent to the value returned from HttpServletRequest.getScheme() for the current request.

Example

The following example:

  $SCHEME$://$HOST$

Would be parsed and converted to:

  http://myhost

 
Top of page

$SERVLET_PATH$

Description

Path to the servlet on HttpServletRequest.

The $SERVLET_PATH$ keyword is equivalent to the value returned from HttpServletRequest.getServletPath() excluding the preceding slash:

Example

The following example:

  $CONTEXT_URL$/$SERVLET_PATH$

Might be parsed and converted to:

  http://host/context/custom.jsp

 
Top of page

$SERVLET_URL$

Description

URL reference to the current servlet path.

The $SERVLET_URL$ keyword is equivalent to:

  $SCHEME$://$HOST_PORT$/$CONTEXT_PATH$/$SERVLET_PATH$

Example

The following example:

  $SERVLET_URL$

Would be parsed and converted to:

  http://host/DirectorDB/EAR/Portal/main

NOTE:   The DirectorDB portion of the URL applies only if you're using an exteNd application server and you've deployed your archive to the same database created for Director application data. If you're using another application server or if you've deployed the archive to the SilverMaster database, the URL would not include the name of the Director database. The EAR portion of the URL would not be included for a Director WAR.

 
Top of page

$THEME_ID$

Description

Theme ID of the user's currently selected theme. If no user is logged in or the user does not have a selected theme, the portal's default theme will be used.

Example

If the current theme were called metallic, the following example:

  $PORTAL_SERVLET_URL$/resource/portal-theme/$THEMEID$/edit.gif

Would be parsed and converted to:

  http://host/context/main/resource/portal-theme/metallic/edit.gif

 
Top of page

$THEME_URL$

Description

URL reference to a theme.

The $THEME_URL$ keyword is equivalent to:

  $SCHEME$://$HOST_PORT$/$CONTEXT_PATH$/$RESOURCE_PATH$/portal-theme/$THEME_ID$

The $THEME_URL$ keyword is also equivalent to:

  $RESOURCE_URL$/portal-theme/$THEME_ID$

Example

The following example:

  $THEME_URL$/edit.gif

Would be parsed and converted to:

  http://host/context/main/resource/portal-theme/theme-ID/edit.gif
    First Previous Next Last Portal Guide  

Copyright © 2000, 2001, 2002, 2003 SilverStream Software, LLC, a wholly owned subsidiary of Novell, Inc. All rights reserved.