Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.endeca.portlet
Class EndecaPortlet

    java.lang.Object
      javax.portlet.GenericPortlet
          com.endeca.portlet.EndecaPortlet

All Implemented Interfaces:
  javax.portlet.EventPortlet, javax.portlet.Portlet, javax.portlet.PortletConfig, javax.portlet.ResourceServingPortlet

    public class EndecaPortlet

extends javax.portlet.GenericPortlet

Base portlet class for portlets that want to make use of Endeca or Discovery Framework functionality. These include:

- MDEX interaction (via DataSource instances)
- Asynchronous portlet refreshing/mode switches
- Automatic resource mapping to fetch files or dynamically generate resources via method mappings
- Serialization/deserialization of portlet state for bookmarking

### Resources

You can generate ResourceURLs in your portlets for a resource id. These resources urls, when fetched, will automatically be mapped to a file in your portlet's WAR with a path equal to the resource's id. For Example: `<portlet:resourceURL var="javascriptUrl" escapeXml="false" id="/js/endeca-results-table.js"/>` will retrieve the file "endeca-results-table.js" in the "js" directory under the root of the portlet bundle. You can also use resources to generate & return your own dynamic resources. This is very useful for portlet's that make heavy use of ajax. You can map a method to respond to a resource id using the \@ProcessResource annotation. Example: `<portlet:resourceURL var="javascriptUrl" escapeXml="false" id="my_ajax_resource"/>` `

     \@ProcessResource(resourceId = "my_ajax_resource")
     public void getRecords(ResourceRequest request, ResourceResponse response)
     throws PortletException, IOException {
     …
     }

`

### Supporting bookmarking

Bookmarking will automatically store and retrieve any Strings stored in the portlet's PortletState. Currently, only String values are supported. If you want to store non-String values, you should override serializePortletState to transform your non-String value into a String in the session and deserializePortletState to perform the reverse translation. Refer to SDK documentation for more details concerning usage and development.

See Also:
  `DataSource`

Field Summary
`protected java.lang.String` | `apiErrorJSP`
`protected java.lang.String` | `dataSourceErrorJSP`
`protected java.lang.String` | `dataSourceSelectorJSP`
`protected java.lang.String` | `defaultDataSourceId`
`static java.lang.String` | `EDIT_JSP`
`protected java.lang.String` | `editJSP`
`static java.lang.String` | `HELP_JSP`
`protected java.lang.String` | `helpJSP`
`protected static java.lang.String` | `MSG_DATASOURCE_BINDING_CHANGED_SUCCESSFULLY`
`protected static java.lang.String` | `MSG_DATASOURCE_BINDING_ERROR`
`protected static java.lang.String` | `MSG_DATASOURCE_BINDING_UNCHANGED`
`protected static java.lang.String` | `MSG_DATASOURCE_BINDING_UNCHANGED_UNSUPPORTED_API`
`protected static java.lang.String` | `MSG_NO_DATASOURCE_SELECTED`
`protected static java.lang.String` | `MSG_NO_DATASOURCE_SELECTED_FOR_POWER_USER`
`protected static java.lang.String` | `MSG_NO_DATASOURCE_SPECIFIED`
`protected static java.lang.String` | `MSG_PORTLET_DOES_NOT_SUPPORT_DATASOURCE_API`
`protected static java.lang.String` | `MSG_SAVE_PREFS_ERROR`
`protected static java.lang.String` | `MSG_SAVE_PREFS_SUCCESS`
`protected java.lang.String` | `postRenderJSP`
`protected java.lang.String` | `preRenderJSP`
`static java.lang.String` | `REQUIRES_DATA_SOURCE` Represents the name of the init-param, in portlet.xml, that controls whether or not this portlet requires a binding to a MDEX data source.
`protected java.lang.String` | `requiresDataSource`
`protected static java.util.List<java.lang.String>` | `reservedSessionAttributes`
`static java.lang.String` | `SUPPORTS_DISCOVERY_SERVICE` Represents the name of the init-param, in portlet.xml, that controls whether or not this portlet supports connections to a MDEX 7 data source via the Endeca Conversation Service, aka the Endeca Discovery Service.
`static java.lang.String` | `SUPPORTS_ENE_QUERY` Represents the name of the init-param, in portlet.xml, that controls whether or not this portlet supports connections to a MDEX 6 data source via the Endeca Presentation API.
`protected java.lang.String` | `supportsDiscoveryService`
`protected java.lang.String` | `supportsENEQuery`
`static java.lang.String` | `VIEW_JSP`
`protected java.lang.String` | `viewJSP`

Constructor Summary
`EndecaPortlet()`

Method Summary
`protected boolean` | `checkDataSourceRequired()` This method denotes whether or not this portlet requires a binding to a MDEX data source.
`protected void` | `deserializePortletState(EndecaPortletState state, javax.portlet.PortletRequest request, javax.portlet.StateAwareResponse response)` Deserializes portlet state (see notes in `serializePortletState(PortletRequest, StateAwareResponse)` above)
`void` | `doEdit(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)`
`void` | `doHelp(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)`
`void` | `doView(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)`
`java.util.Set<java.lang.String>` | `getAllPublishedEventNames(javax.portlet.RenderRequest request)` Gets the set of event names that this portlet should trigger.
`protected Container` | `getContainer()`
`protected DataSource` | `getDataSource(javax.portlet.PortletRequest request)` Retrieve the `DataSource` instance this portlet listens to.
`protected java.lang.String` | `getFirstParam(javax.portlet.PortletRequest request, java.lang.String key)`
`protected java.lang.String` | `getParamValue(javax.portlet.PortletRequest request, java.lang.String paramName, java.lang.String defaultVal)` Retrieves the given parameter from the request, returning the given default value if the value in the request is null or the empty string
`java.lang.String` | `getPortalContext()` Retrieves the context path for the root portal web application; typically "/".
`protected java.lang.String` | `getPortletId(javax.portlet.PortletRequest request)`
`protected UserSession` | `getUserSession(javax.portlet.PortletRequest request)`
`protected java.util.List<java.lang.String>` | `getValidSessionAttributes()`
`protected java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>>` | `getViewTransitionParameters(javax.portlet.PortletRequest request)`
`protected void` | `handleBookmarkCreation(Bookmark bookmark, javax.portlet.PortletRequest request, javax.portlet.StateAwareResponse response)` Handles a bookmark's creation for this particular portlet; Default implementation is to store serialized session attributes as a single JSON String
`protected void` | `handleBookmarkLoad(Bookmark bookmark, javax.portlet.PortletRequest request, javax.portlet.StateAwareResponse response)` Handles a bookmark load for this particular portlet; Default implementation is to load a JSON String representation of this portlet's state by setting session attributes
`protected ModelAndView` | `handleEditRenderRequest(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)` Builds a `ModelAndView` object.
`protected ModelAndView` | `handleHelpRenderRequest(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)` Builds a `ModelAndView` object.
`void` | `handlePageTransitionParameters(javax.portlet.ActionRequest request, java.lang.String viewTransitionPageContext, java.util.Map<java.lang.String,java.lang.String[]> parameterMap)` Stores parameters in user session, to make them available after a page transition.
`void` | `handlePageTransitionRedirect(javax.portlet.ActionResponse response, java.lang.String viewTransitionPageContext)` Triggers a redirect on the passed in ActionResponse, to the page specified in the viewTransitionPageContext parameter.
`protected void` | `handleQueryException(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response, java.lang.Exception e)`
`protected ModelAndView` | `handleViewRenderRequest(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)` Builds a `ModelAndView` object for a given `QueryState`.
`protected void` | `include(java.lang.String path, javax.portlet.PortletRequest request, javax.portlet.PortletResponse response)`
`void` | `init(javax.portlet.PortletConfig config)`
`protected boolean` | `isAsync()`
`protected boolean` | `isEmpty(java.lang.String value)`
`protected boolean` | `isRequestDeferrable(javax.portlet.PortletRequest request)` This method denotes whether or not this portlet supports deferred rendering.
`void` | `pageTransition(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)` Invokes `pageTransition(ActionRequest, ActionResponse, String, Map)` with the parameter map from the provided request object, and the target page transition context retrieved from request parameter with key `Constants.REQUEST_PARAMETER_VIEW_TRANSITION_PAGE_CONTEXT`.
`void` | `pageTransition(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response, java.lang.String viewTransitionPageContext, java.util.Map<java.lang.String,java.lang.String[]> parameterMap)` Triggers a page transition.
`protected boolean` | `portletSupportsAsync()` This method denotes whether or not this portlet supports async mode.
`protected boolean` | `portletSupportsDiscoveryService()` This method denotes whether or not this portlet supports connections to a MDEX 7 data source via the Endeca Conversation Service, aka the Endeca Discovery Service.
`protected boolean` | `portletSupportsENEQuery()` This method denotes whether or not this portlet supports connections to a MDEX 6 data source via the Endeca Presentation API.
`void` | `processCreateEndecaBookmarkEvent(javax.portlet.EventRequest request, javax.portlet.EventResponse response)` Event-processing method for bookmark creation
`void` | `processEvent(javax.portlet.EventRequest request, javax.portlet.EventResponse response)`
`void` | `processLoadEndecaBookmarkEvent(javax.portlet.EventRequest request, javax.portlet.EventResponse response)` Event-processing method for bookmark loading
`void` | `render(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)`
`void` | `resetPortletState(javax.portlet.PortletRequest request, javax.portlet.PortletResponse response)` Children can override this method to reset preferences or variables that are attached to the data source.
`protected EndecaPortletState` | `serializePortletState(javax.portlet.PortletRequest request, javax.portlet.StateAwareResponse response)` Default implementation of portlet state serialization TODO: Is PortletRequest sufficient here?
`void` | `serveResource(javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response)` Called by the portlet container to allow the portlet to serve a resource request.
`void` | `serveResourceSetSessionState(javax.portlet.ResourceRequest request, javax.portlet.ResourceResponse response)` Updates arbitrary session attributes in this portlet's session state Request parameters: df.sessionAttributeName: a String that represents the name of the session attribute df.sessionAttributeValue: a String that represents the value of the session attribute df.sessionAttributes: a JSON array of name, value pairs [{"attrName":"attrValue"},...]
`void` | `setSavePrefsFailureMessage(javax.portlet.PortletRequest request)` Convenience wrapper for `setSavePrefsFailureMessage(PortletRequest, String)`.
`void` | `setSavePrefsFailureMessage(javax.portlet.PortletRequest request, java.lang.String failureMessage)` Sets request attributes indicating that the status of saving preferences was an error/failure, and sets a failure message for display.
`protected void` | `setSavePrefsStatusMessage(javax.portlet.PortletRequest request, java.lang.String status, java.lang.String message)` Sets the save preferences status and message as request attributes based on the passed in parameters.
`void` | `setSavePrefsSuccessMessage(javax.portlet.PortletRequest request)` Convenience wrapper for `setSavePrefsSuccessMessage(PortletRequest, String)`.
`void` | `setSavePrefsSuccessMessage(javax.portlet.PortletRequest request, java.lang.String successMessage)` Sets request attributes indicating that the status of saving preferences was successful, and sets a success message for display.
`void` | `triggerEvent(javax.portlet.PortletRequest request, javax.portlet.StateAwareResponse response, javax.xml.namespace.QName name, java.io.Serializable value)` This method should be used instead of response.setEvent(QName, Serializable), and provides functionality to store event state in the session if required
`void` | `triggerEvent(javax.portlet.PortletRequest request, javax.portlet.StateAwareResponse response, java.lang.String name, java.io.Serializable value)` This method should be used instead of response.setEvent(String, Serializable), and provides functionality to store event state in the session if required
`void` | `updateDataSourceBinding(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)`

Methods inherited from class javax.portlet.GenericPortlet
`destroy, doDispatch, doHeaders, getContainerRuntimeOptions, getDefaultNamespace, getInitParameter, getInitParameterNames, getNextPossiblePortletModes, getPortletConfig, getPortletContext, getPortletName, getProcessingEventQNames, getPublicRenderParameterNames, getPublishingEventQNames, getResourceBundle, getSupportedLocales, getTitle, init, processAction`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MSG_PORTLET_DOES_NOT_SUPPORT_DATASOURCE_API

    protected static final java.lang.String MSG_PORTLET_DOES_NOT_SUPPORT_DATASOURCE_API

See Also:
  Constant Field Values

### MSG_NO_DATASOURCE_SELECTED

    protected static final java.lang.String MSG_NO_DATASOURCE_SELECTED

See Also:
  Constant Field Values

### MSG_NO_DATASOURCE_SELECTED_FOR_POWER_USER

    protected static final java.lang.String MSG_NO_DATASOURCE_SELECTED_FOR_POWER_USER

See Also:
  Constant Field Values

### MSG_NO_DATASOURCE_SPECIFIED

    protected static final java.lang.String MSG_NO_DATASOURCE_SPECIFIED

See Also:
  Constant Field Values

### MSG_DATASOURCE_BINDING_UNCHANGED

    protected static final java.lang.String MSG_DATASOURCE_BINDING_UNCHANGED

See Also:
  Constant Field Values

### MSG_DATASOURCE_BINDING_UNCHANGED_UNSUPPORTED_API

    protected static final java.lang.String MSG_DATASOURCE_BINDING_UNCHANGED_UNSUPPORTED_API

See Also:
  Constant Field Values

### MSG_DATASOURCE_BINDING_CHANGED_SUCCESSFULLY

    protected static final java.lang.String MSG_DATASOURCE_BINDING_CHANGED_SUCCESSFULLY

See Also:
  Constant Field Values

### MSG_DATASOURCE_BINDING_ERROR

    protected static final java.lang.String MSG_DATASOURCE_BINDING_ERROR

See Also:
  Constant Field Values

### MSG_SAVE_PREFS_SUCCESS

    protected static final java.lang.String MSG_SAVE_PREFS_SUCCESS

See Also:
  Constant Field Values

### MSG_SAVE_PREFS_ERROR

    protected static final java.lang.String MSG_SAVE_PREFS_ERROR

See Also:
  Constant Field Values

### reservedSessionAttributes

    protected static final java.util.List<java.lang.String> reservedSessionAttributes

### VIEW_JSP

    public static final java.lang.String VIEW_JSP

See Also:
  Constant Field Values

### EDIT_JSP

    public static final java.lang.String EDIT_JSP

See Also:
  Constant Field Values

### HELP_JSP

    public static final java.lang.String HELP_JSP

See Also:
  Constant Field Values

### REQUIRES_DATA_SOURCE

    public static final java.lang.String REQUIRES_DATA_SOURCE

  Represents the name of the init-param, in portlet.xml, that controls whether or not this portlet requires a binding to a MDEX data source. Set the "requiresDataSource" init-param to true to allow this portlet to be bound to MDEX data sources. Set it false to skip all logic that checks to see if this portlet has a MDEX binding and to disable all MDEX binding functional controls. If the "requiresDataSource" init-param is missing, we default it to true. This init param is read by the protected `checkDataSourceRequired()` method. See that method for additional information.

  See Also:
    Constant Field Values

### SUPPORTS_ENE_QUERY

    public static final java.lang.String SUPPORTS_ENE_QUERY

  Represents the name of the init-param, in portlet.xml, that controls whether or not this portlet supports connections to a MDEX 6 data source via the Endeca Presentation API. Set the "supportsENEQuery" init-param to true to allow this portlet to be bound to MDEX 6 data sources. If the "supportsENEQuery" init-param is missing, we default it to true. This init param is read by the protected `portletSupportsENEQuery()` method. See that method for additional information.

  See Also:
    Constant Field Values

### SUPPORTS_DISCOVERY_SERVICE

    public static final java.lang.String SUPPORTS_DISCOVERY_SERVICE

  Represents the name of the init-param, in portlet.xml, that controls whether or not this portlet supports connections to a MDEX 7 data source via the Endeca Conversation Service, aka the Endeca Discovery Service. Set the "supportsDiscoveryService" init-param to true to allow this portlet to be bound to MDEX 7 data sources. If the "supportsDiscoveryService" init-param is missing, we default it to false. This init param is read by the protected `portletSupportsDiscoveryService()` method. See that method for additional information.

  See Also:
    Constant Field Values

### viewJSP

    protected java.lang.String viewJSP

### editJSP

    protected java.lang.String editJSP

### helpJSP

    protected java.lang.String helpJSP

### requiresDataSource

    protected java.lang.String requiresDataSource

### supportsENEQuery

    protected java.lang.String supportsENEQuery

### supportsDiscoveryService

    protected java.lang.String supportsDiscoveryService

### dataSourceSelectorJSP

    protected java.lang.String dataSourceSelectorJSP

### dataSourceErrorJSP

    protected java.lang.String dataSourceErrorJSP

### apiErrorJSP

    protected java.lang.String apiErrorJSP

### preRenderJSP

    protected java.lang.String preRenderJSP

### postRenderJSP

    protected java.lang.String postRenderJSP

### defaultDataSourceId

    protected java.lang.String defaultDataSourceId

Constructor Detail

### EndecaPortlet

    public EndecaPortlet()

Method Detail

### init

    public void init(javax.portlet.PortletConfig config)
              throws javax.portlet.PortletException

  Specified by:
    `init` in interface `javax.portlet.Portlet`
  Overrides:
    `init` in class `javax.portlet.GenericPortlet`
  Throws:
    `javax.portlet.PortletException`

### render

    public void render(javax.portlet.RenderRequest request,
                       javax.portlet.RenderResponse response)
                throws javax.portlet.PortletException,
                       java.io.IOException

  Specified by:
    `render` in interface `javax.portlet.Portlet`
  Overrides:
    `render` in class `javax.portlet.GenericPortlet`
  Throws:
    `javax.portlet.PortletException`
    `java.io.IOException`

### doView

    public void doView(javax.portlet.RenderRequest request,
                       javax.portlet.RenderResponse response)
                throws javax.portlet.PortletException,
                       java.io.IOException

  Overrides:
    `doView` in class `javax.portlet.GenericPortlet`
  Throws:
    `javax.portlet.PortletException`
    `java.io.IOException`
  See Also:
    `Checks for {@link DataSource} existence, defers rendering when necessary (for ajax), and calls out to {@link #handleViewRenderRequest} to get the {@link ModelAndView} that should be used to render. Overriding this method is discouraged: most portlets should be able to accomplish what they need by overriding {@link #handleViewRenderRequest}.`

### doEdit

    public void doEdit(javax.portlet.RenderRequest request,
                       javax.portlet.RenderResponse response)
                throws javax.portlet.PortletException,
                       java.io.IOException

  Overrides:
    `doEdit` in class `javax.portlet.GenericPortlet`
  Throws:
    `javax.portlet.PortletException`
    `java.io.IOException`
  See Also:
    `Defers rendering when necessary (for ajax), and calls out to {@link #handleViewRenderRequest} to get the {@link ModelAndView} that should be used to render. Overriding this method is discouraged: most portlets should be able to accomplish what they need by overriding {@link #handleEditRenderRequest}.`

### doHelp

    public void doHelp(javax.portlet.RenderRequest request,
                       javax.portlet.RenderResponse response)
                throws javax.portlet.PortletException,
                       java.io.IOException

  Overrides:
    `doHelp` in class `javax.portlet.GenericPortlet`
  Throws:
    `javax.portlet.PortletException`
    `java.io.IOException`
  See Also:
    `Defers rendering when necessary (for ajax), and calls out to {@link #handleViewRenderRequest} to get the {@link ModelAndView} that should be used to render. Overriding this method is discouraged: most portlets should be able to accomplish what they need by overriding {@link #handleViewRenderRequest}.`

### serveResource

    public void serveResource(javax.portlet.ResourceRequest request,
                              javax.portlet.ResourceResponse response)
                       throws javax.portlet.PortletException,
                              java.io.IOException

  Called by the portlet container to allow the portlet to serve a resource request. This method is called if the client request was originated by a URL created (by the portlet) with the `RenderResponse.createResourceURL()` method.

  The default implementation tries to dispatch to a method annotated with `@ProcessResource` that matches the resource id or, if no such method is found, tries to find the resource on disk, and otherwise throws a `PortletException`.
  Note that the annotated methods needs to be public in order to be allowed to be called by `EndecaPortlet`.

  Specified by:
    `serveResource` in interface `javax.portlet.ResourceServingPortlet`
  Overrides:
    `serveResource` in class `javax.portlet.GenericPortlet`
  Parameters:
    `request` - the resource request
    `response` - the resource response
  Throws:
    `javax.portlet.PortletException` - if the portlet cannot fulfill the request
    `java.io.IOException` - if the streaming causes an I/O problem

### handleViewRenderRequest

    protected ModelAndView handleViewRenderRequest(javax.portlet.RenderRequest request,
                                                   javax.portlet.RenderResponse response)
                                            throws java.lang.Exception

  Builds a `ModelAndView` object for a given `QueryState`. This method is intended to be overridden by a subclass-- if it is not, an empty ModelAndView object will be returned with the `viewJSP` specified as the target view.

  Parameters:
    `request` - the RenderRequest
    `response` - the RenderResponse
  Returns:
    the ModelAndView object
  Throws:
    `java.lang.Exception`

### handleEditRenderRequest

    protected ModelAndView handleEditRenderRequest(javax.portlet.RenderRequest request,
                                                   javax.portlet.RenderResponse response)
                                            throws java.lang.Exception

  Builds a `ModelAndView` object. This method is intended to be overridden by a subclass-- if it is not, an empty ModelAndView object will be returned with the `editJSP` specified as the target view.

  Parameters:
    `request` - the RenderRequest
    `response` - the RenderResponse
  Returns:
    the ModelAndView object
  Throws:
    `java.lang.Exception`

### handleHelpRenderRequest

    protected ModelAndView handleHelpRenderRequest(javax.portlet.RenderRequest request,
                                                   javax.portlet.RenderResponse response)
                                            throws java.lang.Exception

  Builds a `ModelAndView` object. This method is intended to be overridden by a subclass-- if it is not, an empty ModelAndView object will be returned with the `helpJSP` specified as the target view.

  Parameters:
    `request` - the RenderRequest
    `response` - the RenderResponse
  Returns:
    the ModelAndView object
  Throws:
    `java.lang.Exception`

### handleQueryException

    protected void handleQueryException(javax.portlet.RenderRequest request,
                                        javax.portlet.RenderResponse response,
                                        java.lang.Exception e)
                                 throws javax.portlet.PortletException,
                                        java.io.IOException

  Throws:
    `javax.portlet.PortletException`
    `java.io.IOException`

### getAllPublishedEventNames

    public java.util.Set<java.lang.String> getAllPublishedEventNames(javax.portlet.RenderRequest request)

  Gets the set of event names that this portlet should trigger. Normally this is handled automatically by the postRender.jspf common resource. If your portlet handles triggering in a special way, you can call this method to determine which events should be fired. Returns an empty set of no events are found.

  Parameters:
    `request` - the portlet request
  Returns:
    the set of all events that should be triggered in this request.

### processEvent

    public void processEvent(javax.portlet.EventRequest request,
                             javax.portlet.EventResponse response)
                      throws javax.portlet.PortletException,
                             java.io.IOException

  Specified by:
    `processEvent` in interface `javax.portlet.EventPortlet`
  Overrides:
    `processEvent` in class `javax.portlet.GenericPortlet`
  Throws:
    `javax.portlet.PortletException`
    `java.io.IOException`

### triggerEvent

    public void triggerEvent(javax.portlet.PortletRequest request,
                             javax.portlet.StateAwareResponse response,
                             javax.xml.namespace.QName name,
                             java.io.Serializable value)

  This method should be used instead of response.setEvent(QName, Serializable), and provides functionality to store event state in the session if required

  Parameters:
    `request` -
    `response` -
    `name` -
    `value` -

### triggerEvent

    public void triggerEvent(javax.portlet.PortletRequest request,
                             javax.portlet.StateAwareResponse response,
                             java.lang.String name,
                             java.io.Serializable value)

  This method should be used instead of response.setEvent(String, Serializable), and provides functionality to store event state in the session if required

  Parameters:
    `request` -
    `response` -
    `name` -
    `value` -

### processCreateEndecaBookmarkEvent

    public void processCreateEndecaBookmarkEvent(javax.portlet.EventRequest request,
                                                 javax.portlet.EventResponse response)
                                          throws java.io.IOException,
                                                 javax.portlet.PortletException

  Event-processing method for bookmark creation

  Parameters:
    `request` -
    `response` -
  Throws:
    `java.io.IOException`
    `javax.portlet.PortletException`

### processLoadEndecaBookmarkEvent

    public void processLoadEndecaBookmarkEvent(javax.portlet.EventRequest request,
                                               javax.portlet.EventResponse response)
                                        throws java.io.IOException,
                                               javax.portlet.PortletException

  Event-processing method for bookmark loading

  Parameters:
    `request` -
    `response` -
  Throws:
    `java.io.IOException`
    `javax.portlet.PortletException`

### handleBookmarkCreation

    protected void handleBookmarkCreation(Bookmark bookmark,
                                          javax.portlet.PortletRequest request,
                                          javax.portlet.StateAwareResponse response)
                                   throws javax.portlet.PortletException

  Handles a bookmark's creation for this particular portlet; Default implementation is to store serialized session attributes as a single JSON String

  Parameters:
    `bookmark` -
    `request` -
    `response` -
  Throws:
    `javax.portlet.PortletException`

### handleBookmarkLoad

    protected void handleBookmarkLoad(Bookmark bookmark,
                                      javax.portlet.PortletRequest request,
                                      javax.portlet.StateAwareResponse response)
                               throws javax.portlet.PortletException

  Handles a bookmark load for this particular portlet; Default implementation is to load a JSON String representation of this portlet's state by setting session attributes

  Parameters:
    `bookmark` -
    `request` -
    `response` -
  Throws:
    `javax.portlet.PortletException`

### serializePortletState

    protected EndecaPortletState serializePortletState(javax.portlet.PortletRequest request,
                                                       javax.portlet.StateAwareResponse response)
                                                throws javax.portlet.PortletException

  Default implementation of portlet state serialization TODO: Is PortletRequest sufficient here? or do we need additional methods for serialization? What are the other use cases for serializing the state besides bookmarks? Note that StateAwareResponse is being used here b/c this is likely being called from a processAction or processEvent method-- is there a need to access or set render parameters here?

  Throws:
    `javax.portlet.PortletException`

### deserializePortletState

    protected void deserializePortletState(EndecaPortletState state,
                                           javax.portlet.PortletRequest request,
                                           javax.portlet.StateAwareResponse response)
                                    throws javax.portlet.PortletException

  Deserializes portlet state (see notes in `serializePortletState(PortletRequest, StateAwareResponse)` above)

  Parameters:
    `state` -
    `request` -
    `response` -
  Throws:
    `javax.portlet.PortletException`

### updateDataSourceBinding

    public void updateDataSourceBinding(javax.portlet.ActionRequest request,
                                        javax.portlet.ActionResponse response)
                                 throws javax.portlet.PortletException,
                                        java.io.IOException

  Throws:
    `javax.portlet.PortletException`
    `java.io.IOException`

### resetPortletState

    public void resetPortletState(javax.portlet.PortletRequest request,
                                  javax.portlet.PortletResponse response)
                           throws javax.portlet.PortletException,
                                  java.io.IOException

  Children can override this method to reset preferences or variables that are attached to the data source. This will be called when the the linked data source for a portlet is changed.

  Parameters:
    `request` -
    `response` -
  Throws:
    `javax.portlet.PortletException`
    `java.io.IOException`

### pageTransition

    public void pageTransition(javax.portlet.ActionRequest request,
                               javax.portlet.ActionResponse response)
                        throws javax.portlet.PortletException

  Invokes `pageTransition(ActionRequest, ActionResponse, String, Map)` with the parameter map from the provided request object, and the target page transition context retrieved from request parameter with key `Constants.REQUEST_PARAMETER_VIEW_TRANSITION_PAGE_CONTEXT`.

  Parameters:
    `request` - ActionRequest for action invoking the page transition.
    `response` - ActionResponse for action invoking the page transition.
  Throws:
    `javax.portlet.PortletException` - Exception thrown if page view parameters cannot be saved in session, or if the redirect cannot be sent on the response.

### pageTransition

    public void pageTransition(javax.portlet.ActionRequest request,
                               javax.portlet.ActionResponse response,
                               java.lang.String viewTransitionPageContext,
                               java.util.Map<java.lang.String,java.lang.String[]> parameterMap)
                        throws javax.portlet.PortletException

  Triggers a page transition. First, invokes `handlePageTransitionParameters(ActionRequest, String, Map)`, which stores the parameters in the parameterMap argument in the user session. Parameters in the map are expected to contain a single String value, even though an array is supported. Only the first item in the array is stored. Then, `handlePageTransitionRedirect(ActionResponse, String)` is invoked, causing the redirect to be triggered on the response. Note: the first method invocation returns a String, which is a qualified version of the target page transition context (i.e. either the passed in context, if it's a full path, or a page name appended to the default context), and this is passed to the redirect page as the redirect target.

  Parameters:
    `request` - ActionRequest for action invoking the page transition.
    `response` - ActionResponse for action invoking the page transition.
    `viewTransitionPageContext` - Target page context for redirect. Full context paths should start with "/", while relative page paths should not (i.e. "/web/guest/mypage" or "mypage").
    `parameterMap` - Request parameters to store and make available after the page transition. Only single-item arrays are supported.
  Throws:
    `javax.portlet.PortletException` - Exception thrown if page view parameters cannot be saved in session, or if the redirect cannot be sent on the response.

### handlePageTransitionParameters

    public void handlePageTransitionParameters(javax.portlet.ActionRequest request,
                                               java.lang.String viewTransitionPageContext,
                                               java.util.Map<java.lang.String,java.lang.String[]> parameterMap)
                                        throws javax.portlet.PortletException

  Stores parameters in user session, to make them available after a page transition. Parameters in the map are expected to contain a single String value, even though an array is supported. Only the first item in the array is stored.

  Parameters:
    `request` - ActionRequest for action invoking the page transition.
    `viewTransitionPageContext` - Target page context for redirect. Full context paths should start with "/", while relative page paths should not (i.e. "/web/guest/mypage" or "mypage").
    `parameterMap` - Request parameters to store and make available after the page transition. Only single-item arrays are supported.
  Throws:
    `javax.portlet.PortletException` - Exception thrown if page view parameters cannot be saved in session.

### handlePageTransitionRedirect

    public void handlePageTransitionRedirect(javax.portlet.ActionResponse response,
                                             java.lang.String viewTransitionPageContext)
                                      throws javax.portlet.PortletException

  Triggers a redirect on the passed in ActionResponse, to the page specified in the viewTransitionPageContext parameter. The passed in target page context should be a full path (e.g. "/web/guest/mypage"), and will typically be resolved by `handlePageTransitionParameters(ActionRequest, String, Map)`.

  Parameters:
    `response` - ActionResponse for action invoking the page transition.
    `viewTransitionPageContext` - Target page context for redirect. Context paths should start with "/" (e.g. "/web/guest/mypage").
  Throws:
    `javax.portlet.PortletException` - Exception thrown if the redirect cannot be sent on the response.

### getValidSessionAttributes

    protected java.util.List<java.lang.String> getValidSessionAttributes()

### serveResourceSetSessionState

    public void serveResourceSetSessionState(javax.portlet.ResourceRequest request,
                                             javax.portlet.ResourceResponse response)
                                      throws javax.portlet.PortletException

  Updates arbitrary session attributes in this portlet's session state Request parameters:

  - df.sessionAttributeName: a String that represents the name of the session attribute
  - df.sessionAttributeValue: a String that represents the value of the session attribute
  - df.sessionAttributes: a JSON array of name, value pairs [{"attrName":"attrValue"},...]
  Child portlets should override getValidSessionAttributes() to return the list of session attributes that can be set through this method:

       private static List validSessionAttributes = Arrays.asList( new String[]{REQUEST_PARAMETER_FOO, REQUEST_PARAMETER_BAR} );

  Parameters:
    `request` - the ResourceRequest
    `response` - the ResourceResponse
  Throws:
    `javax.portlet.PortletException`
    `java.io.IOException`

### getUserSession

    protected UserSession getUserSession(javax.portlet.PortletRequest request)
                                  throws UserSessionException

  Throws:
    `UserSessionException`

### getDataSource

    protected DataSource getDataSource(javax.portlet.PortletRequest request)
                                throws DataSourceException

  Retrieve the `DataSource` instance this portlet listens to.

  Parameters:
    `request` -
  Returns:
    The DataSource this portlet is connected to.
  Throws:
    `DataSourceException`

### getViewTransitionParameters

    protected java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> getViewTransitionParameters(javax.portlet.PortletRequest request)
                                                                                                              throws javax.portlet.PortletException

  Throws:
    `javax.portlet.PortletException`

### isRequestDeferrable

    protected boolean isRequestDeferrable(javax.portlet.PortletRequest request)

  This method denotes whether or not this portlet supports deferred rendering. Deferred rendering allows portlets, under certain full-page-refresh conditions, to load their contents via ajax. This functionality allows the page shell to finish rendering sooner, and then fill in portlet contents in parallel. Without deferred rendering, full page reloads would be slower to first render. To denote your portlet's support for deferred rendering, override this method. Return true to support deferred rendering. Some portlets will not benefit from deferred rendering. For instance, portlets in the control panel do not benefit, since only a single portlet is shown at a time. Portlets that consist of a single Flash movie which in turn will load its data via a web service will also not benefit, since the Flash movie is loaded asynchronously through native browser handling of embed/object tags, and the movie's data is loaded asynchronously through native Flash functionality.

  Parameters:
    `request` - the current request object
  Returns:
    true if this portlet supports deferred rendering

### setSavePrefsSuccessMessage

    public void setSavePrefsSuccessMessage(javax.portlet.PortletRequest request,
                                           java.lang.String successMessage)

  Sets request attributes indicating that the status of saving preferences was successful, and sets a success message for display. If a non-empty, non-null message is specified in the second parameter, that message is used. Otherwise, the default localized message is retrieved from a resource bundle (or a default constant is used). Note: if a message is passed in as an argument, it will not be localized (i.e. it's the responsibility of the calling method to pass in a localized message String). Invokes `setSavePrefsStatusMessage(PortletRequest, String, String)` with a success status.

  Parameters:
    `request` - PortletRequest for the portlet updating preferences.
    `successMessage` - Success message to set as a request attribute. If null, the default success message is used.

### setSavePrefsSuccessMessage

    public void setSavePrefsSuccessMessage(javax.portlet.PortletRequest request)

  Convenience wrapper for `setSavePrefsSuccessMessage(PortletRequest, String)`. Passes null as the second argument, resulting in the default success message being used.

  Parameters:
    `request` - PortletRequest for the portlet updating preferences.

### setSavePrefsFailureMessage

    public void setSavePrefsFailureMessage(javax.portlet.PortletRequest request,
                                           java.lang.String failureMessage)

  Sets request attributes indicating that the status of saving preferences was an error/failure, and sets a failure message for display. If a non-empty, non-null message is specified in the second parameter, that message is used. Otherwise, the default localized message is retrieved from a resource bundle (or a default constant is used). Note: if a message is passed in as an argument, it will not be localized (i.e. it's the responsibility of the calling method to pass in a localized message String). Invokes `setSavePrefsStatusMessage(PortletRequest, String, String)` with a failure status.

  Parameters:
    `request` - PortletRequest for the portlet updating preferences.
    `failureMessage` - Failure message to set as a request attribute. If null, the default failure message is used.

### setSavePrefsFailureMessage

    public void setSavePrefsFailureMessage(javax.portlet.PortletRequest request)

  Convenience wrapper for `setSavePrefsFailureMessage(PortletRequest, String)`. Passes null as the second argument, resulting in the default success message being used.

  Parameters:
    `request` - PortletRequest for the portlet updating preferences.

### setSavePrefsStatusMessage

    protected void setSavePrefsStatusMessage(javax.portlet.PortletRequest request,
                                             java.lang.String status,
                                             java.lang.String message)

  Sets the save preferences status and message as request attributes based on the passed in parameters. Status is stored in the request attribute keyed by `Constants.REQUEST_PARAMETER_SAVE_PREFERENCES_STATUS` and message is stored in the request attribute keyed by `Constants.REQUEST_PARAMETER_SAVE_PREFERENCES_STATUS_MSG`.

  Parameters:
    `request` - PortletRequest for the portlet updating preferences.
    `status` - Status to set as a request attribute. Typically, either success or failure.
    `message` - Status message to set as a request attribute.

### getPortletId

    protected java.lang.String getPortletId(javax.portlet.PortletRequest request)

### getContainer

    protected Container getContainer()

### isAsync

    protected boolean isAsync()

### portletSupportsAsync

    protected boolean portletSupportsAsync()

  This method denotes whether or not this portlet supports async mode. Async mode is Endeca's enhancement that allows multiple portlets to load their contents via ajax as their underlying MDEX data sources change. To denote your portlet's support for async mode, override this method. Return true to support async mode. Some portlets will not benefit from async mode. For instance, a portlet that is only rendered within a popup window would not take advantage of async mode.

  Returns:
    true if this portlet supports async mode

### portletSupportsENEQuery

    protected boolean portletSupportsENEQuery()

  This method denotes whether or not this portlet supports connections to a MDEX 6 data source via the Endeca Presentation API. Return true to allow this portlet to be bound to MDEX 6 data sources. By default, this method looks at the value of the "supportsENEQuery" init-param in the portlet.xml file for this portlet. If that init-param is missing from portlet.xml, this method will default to returning true. To denote your portlet's support for MDEX 6, change the value of the "supportsENEQuery" init-param in portlet.xml. You should only override this method if you have an explicit need to denote MDEX 6 support programmatically. If you do override this method, you should set the init-param with a default value anyway, as other functionality such as the Data Source Bindings control panel reads the init-param instead of calling this method.

  Returns:
    true if this portlet supports MDEX 6, as denoted by this portlet's "supportsENEQuery" init-param

### portletSupportsDiscoveryService

    protected boolean portletSupportsDiscoveryService()

  This method denotes whether or not this portlet supports connections to a MDEX 7 data source via the Endeca Conversation Service, aka the Endeca Discovery Service. Return true to allow this portlet to be bound to MDEX 7 data sources. By default, this method looks at the value of the "supportsDiscoveryService" init-param in the portlet.xml file for this portlet. If that init-param is missing from portlet.xml, this method will default to returning false. To denote your portlet's support for MDEX 7, change the value of the "supportsDiscoveryService" init-param in portlet.xml. You should only override this method if you have an explicit need to denote MDEX 7 support programmatically. If you do override this method, you should set the init-param with a default value anyway, as other functionality such as the Data Source Bindings control panel reads the init-param instead of calling this method.

  Returns:
    true if this portlet supports MDEX 7, as denoted by this portlet's "supportsDiscoveryService" init-param

### checkDataSourceRequired

    protected boolean checkDataSourceRequired()

  This method denotes whether or not this portlet requires a binding to a MDEX data source. Return true to allow this portlet to be bound to MDEX data sources. Return false to skip all logic that checks to see if this portlet has a MDEX binding and to disable all MDEX binding functional controls. By default, this method looks at the value of the "requiresDataSource" init-param in the portlet.xml file for this portlet. If that init-param is missing from portlet.xml, this method will default to returning true. To denote your portlet's support for a MDEX data source, change the value of the "requiresDataSource" init-param in portlet.xml. You should only override this method if you have an explicit need to denote MDEX binding support programmatically. If you do override this method, you should set the init-param with a default value anyway, as other functionality such as the Data Source Bindings control panel reads the init-param instead of calling this method.

  Returns:
    true if this portlet supports MDEX data source binding, as denoted by this portlet's "requiresDataSource" init-param
  See Also:
    `portletSupportsENEQuery()`, `portletSupportsDiscoveryService()`

### getPortalContext

    public java.lang.String getPortalContext()

  Retrieves the context path for the root portal web application; typically "/". Works only on Liferay.

  Returns:
    the portal's context path

### include

    protected void include(java.lang.String path,
                           javax.portlet.PortletRequest request,
                           javax.portlet.PortletResponse response)
                    throws java.io.IOException,
                           javax.portlet.PortletException

  Throws:
    `java.io.IOException`
    `javax.portlet.PortletException`

### getParamValue

    protected java.lang.String getParamValue(javax.portlet.PortletRequest request,
                                             java.lang.String paramName,
                                             java.lang.String defaultVal)

  Retrieves the given parameter from the request, returning the given default value if the value in the request is null or the empty string

### getFirstParam

    protected java.lang.String getFirstParam(javax.portlet.PortletRequest request,
                                             java.lang.String key)

### isEmpty

    protected boolean isEmpty(java.lang.String value)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD