Default Container Encoding To prevent any script inside a portlet title from Escape Methods If you have code that renders customized values, you need

Enhancing Java Portlets 7-49 ■ in a separate Oracle Containers for Java EE, where the Oracle Portal instance may be different, and the provider is the same but is not registered on the target Oracle Portal instance.

7.2.8.1 ImportExport Programming Interface

The PDK-Javas preference store mechanism allows data to be persisted by any number of application entities. The following three entities are the ones that persist data for the purposes of exportimport:

1. The portlet instance is the portlet on a page with the default personalizations made

to it by the administrator. The API for the portlet instance is as follows: ■ oracle.portal.provider.v2.PortletInstance – exportData public byte[] exportData boolean exportUsers, String[] userNames, TransportLogger logger throws PortletException – importData public void importData byte[] data, TransportLogger logger throws PortletException

2. The portlet definition is the base portlet without any personalizations applied to it.

You might think of the portlet definition as the version of the portlet that exists in the Portlet Repository before it is placed on a particular page for use. The API for the portlet definition is as follows: ■ oracle.portal.provider.v2.PortletDefinition – exportData public byte[] exportData ProviderInstance pi, boolean exportUsers, String[] userNames, TransportLogger logger throws PortletException – importData public void importData ProviderInstance pi, byte[] data, TransportLogger logger throws PortletException 7-50 Oracle Fusion Middleware Developers Guide for Oracle Portal 3. The provider instance is the entity that contains and communicates with a set of portlets. The API for the provider instance is as follows: ■ oracle.portal.provider.v2.ProviderInstance – exportData public byte[] exportData boolean exportUsers, String[] userNames, TransportLogger logger throws ProviderException – importData public void importData byte[] data, TransportLogger logger throws ProviderException By default, each of these entities employs an instance of oracle.portal.provider.v2.transport.PrefStoreTransporter to transform the data from an oracle.portal.provider.v2.preference.PreferenceStore to a byte array for transport. For the default exportimport behavior, though, only the portlet instance entitys personalization data is exported and imported. If you have persisted data at the portlet definition or provider instance level, you may want to export that data as well. For example, a billing handle that you persisted at the ProviderInstance level may need to be exported. To change the behavior of PrefStoreTransporter, you can override its default implementation. The example in Section 7.2.8.3.7, Exporting by Reference Example illustrates how you can override PrefStoreTransporter. Logging Interface To simplify troubleshooting of your exportimport transactions, you can send messages to both the calling Oracle Portal instance and the Web provider log. PDK-Java provides a transport logging class that enables you to add events to the log during export and import operations. In this way, you can better keep track of events that occur during the transport of portlet personalizations. The log can be a valuable troubleshooting tool if you encounter unexpected behavior in your portlets during or after transport. For example, you can log events when incompatibilities between PDK-Java versions are found. You log events using the logger object, an instance of the oracle.portal.provider.v2.transport.TransportLogger class provided for each of the methods mentioned earlier. You log events with the calling portal through the instance provided for each method. You record events in the Web provider log with the normal logging mechanism, oracle.portal.log.LogManager. The log levels for exportimport are as follows: ■ TransportLogger.SEVERITY_INFO ■ TransportLogger.SEVERITY_WARNING ■ TransportLogger.SEVERITY_ERROR