Passes a "contextConfigLocation" portlet init-param to the context instance,
parsing it into potentially multiple file paths which can be separated by any
number of commas and spaces, like "test-portlet.xml, myPortlet.xml".
If not explicitly specified, the context implementation is supposed to build a
default location from the namespace of the portlet.

Note: In case of multiple config locations, later bean definitions will
override ones defined in earlier loaded files, at least when using one of
Spring's default ApplicationContext implementations. This can be leveraged
to deliberately override certain bean definitions via an extra XML file.

The default namespace is "'portlet-name'-portlet", e.g. "test-portlet" for a
portlet-name "test" (leading to a "/WEB-INF/test-portlet.xml" default location
with XmlPortletApplicationContext). The namespace can also be set explicitly via
the "namespace" portlet init-param.

PORTLET_CONTEXT_PREFIX

Prefix for the PortletContext attribute for the Portlet ApplicationContext.
The completion is the portlet name.

DEFAULT_USERINFO_ATTRIBUTE_NAMES

public static final java.lang.String[] DEFAULT_USERINFO_ATTRIBUTE_NAMES

Default USER_INFO attribute names to search for the current username:
"user.login.id", "user.name".

Constructor Detail

FrameworkPortlet

public FrameworkPortlet()

Method Detail

setContextClass

public void setContextClass(java.lang.Class contextClass)

Set a custom context class. This class must be of type ApplicationContext;
when using the default FrameworkPortlet implementation, the context class
must also implement ConfigurablePortletApplicationContext.

setContextConfigLocation

Set the context config location explicitly, instead of relying on the default
location built from the namespace. This location string can consist of
multiple locations separated by any number of commas and spaces.

getContextConfigLocation

public java.lang.String getContextConfigLocation()

Return the explicit context config location, if any.

setPublishContext

public void setPublishContext(boolean publishContext)

Set whether to publish this portlet's context as a PortletContext attribute,
available to all objects in the web container. Default is true.

This is especially handy during testing, although it is debatable whether
it's good practice to let other application objects access the context this way.

setPublishEvents

public void setPublishEvents(boolean publishEvents)

Set whether this portlet should publish a PortletRequestHandledEvent at the end
of each request. Default is true; can be turned off for a slight performance
improvement, provided that no ApplicationListeners rely on such events.

setThreadContextInheritable

Set whether to expose the LocaleContext and RequestAttributes as inheritable
for child threads (using an InheritableThreadLocal).

Default is "false", to avoid side effects on spawned background threads.
Switch this to "true" to enable inheritance for custom child threads which
are spawned during request processing and only used for this request
(that is, ending after their initial task, without reuse of the thread).

WARNING: Do not use inheritance for child threads if you are
accessing a thread pool which is configured to potentially add new threads
on demand (e.g. a JDK ThreadPoolExecutor),
since this will expose the inherited context to such a pooled thread.