Back Forward contentURL JavaServer Page tag

JavaServer Pages tags

Use the contentURL JSP tag to include a system-generated URL in the current stream that requests an image saved in an image content data instance (Data-Content-Image class). I

In contrast to an image defined by a binary file rule, an image retrieved from an Image Content instance is the same for all requestors.

For example:

<img src='<pega:contentURL name="companylogo.gif" path="/content/" classType="Image" />' >

This tag references the image content data instance named content.companylogo.gif.

Example

Advanced featureFor an example, review the standard HTML rule @baseclass.Operator-Profile-Full. This rule supports the display of operator images in the View > My Profile display. If an image content data instance for an operator is associated with an operator ID, that file is retrieved and included in the My Profile display. If no data content data instance is associated with the operator ID, the default image from the binary file rule image.dialogprofileimage.gif appears.

Complete syntax

In the syntax presentation below:

<pega:contentURL name="filename.filetype"
   [path="filepath" ]
   classType = "Image"
   [ enforceAbsoluteURL = "true|false" ]
/>

The name and classType attributes are required.

Attribute

Value

name

Second key part (File Name) and third key part (File Type) of an image content data instance.

path

Optional. First key part (File Path) of an image content instance. Note that each path value starts and ends with a forward slash character.

classType

"Image" is the only allowed value. .

enforceAbsoluteURL

Advanced featureOptional. Set to "true" to cause PRPC to send an absolute HTTP URL. For example:

http://myserver:8080/prweb/PRServlet/800234EABJ8000AAE52352

An absolute URL may be needed in unusual situations where the base URL of the HTML page containing the tag differs from typical structure.

If false, the system sends a relative URL. The default if this attribute omitted is "false".

Notes

During stream processing, the system retrieves the image content rule and tests the privilege and access when rules (if any) on the Main tab, based on the RuleSet list of the requestor.

If the requestor is not authenticated, or does not hold the privilege listed, or the access when rule is not found or evaluates to false, the JSP tag fails with a Java Security exception, and stream processing fails.

If the requestor meets the security tests, stream processing generates a unique, once-only hash URL and includes that URL in the HTML code. When requested by the browser in an HTTP request, PRPC validates the hash URL and serves the image.

The contentURL tag generates a URL, not an <img ..> tag. To present an image, include the contentURL within an <img > tag, as shown above.

Definitions stream processing
Related topics About Image Content data instances

UpJavaServer Page tags