org.jasig.springframework.web.portlet.support
Class PortletRequestContextUtils

java.lang.Object
  extended by org.jasig.springframework.web.portlet.support.PortletRequestContextUtils

public class PortletRequestContextUtils
extends Object

Utility class for easy access to request-specific state which has been set by the ContribDispatcherPortlet.

Supports lookup of current PortletApplicationContext.

Author:
Eric Dalquist
See Also:
ContribDispatcherPortlet

Constructor Summary
PortletRequestContextUtils()
           
 
Method Summary
static PortletApplicationContext getPortletApplicationContext(javax.portlet.PortletRequest request)
          Look for the PortletApplicationContext associated with the DispatcherPortlet that has initiated request processing.
static PortletApplicationContext getPortletApplicationContext(javax.portlet.PortletRequest request, javax.portlet.PortletContext portletContext)
          Look for the PortletApplicationContext associated with the DispatcherPortlet that has initiated request processing, and for the global context if none was found associated with the current request.
static org.springframework.context.ApplicationContext getWebApplicationContext(javax.portlet.PortletRequest request, javax.portlet.PortletContext portletContext)
          Look for the PortletApplicationContext associated with the DispatcherPortlet that has initiated request processing, for the global portlet context if none was found associated with the current request, and for the global context if no global portlet context was found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortletRequestContextUtils

public PortletRequestContextUtils()
Method Detail

getPortletApplicationContext

public static PortletApplicationContext getPortletApplicationContext(javax.portlet.PortletRequest request)
                                                              throws IllegalStateException
Look for the PortletApplicationContext associated with the DispatcherPortlet that has initiated request processing.

Parameters:
request - current portlet request
Returns:
the request-specific portlet application context
Throws:
IllegalStateException - if no portlet-specific context has been found

getPortletApplicationContext

public static PortletApplicationContext getPortletApplicationContext(javax.portlet.PortletRequest request,
                                                                     javax.portlet.PortletContext portletContext)
                                                              throws IllegalStateException
Look for the PortletApplicationContext associated with the DispatcherPortlet that has initiated request processing, and for the global context if none was found associated with the current request. This method is useful to allow components outside the framework, such as JSP tag handlers, to access the most specific application context available.

Parameters:
request - current portlet request
portletContext - current portlet context
Returns:
the request-specific PortletApplicationContext, or the global one if no request-specific context has been found
Throws:
IllegalStateException - if neither a portlet-specific nor a global context has been found

getWebApplicationContext

public static org.springframework.context.ApplicationContext getWebApplicationContext(javax.portlet.PortletRequest request,
                                                                                      javax.portlet.PortletContext portletContext)
                                                                               throws IllegalStateException
Look for the PortletApplicationContext associated with the DispatcherPortlet that has initiated request processing, for the global portlet context if none was found associated with the current request, and for the global context if no global portlet context was found. This method is useful to allow components outside the framework, such as JSP tag handlers, to access the most specific application context available.

Parameters:
request - current portlet request
portletContext - current portlet context
Returns:
the request-specific PortletApplicationContext, or the global one if no request-specific context has been found
Throws:
IllegalStateException - if neither a portlet-specific nor a global context has been found


Copyright © 2013 Jasig. All Rights Reserved.