}
protected ServletContext getServletContext(
String portletId, String requestURI) {
Portlet portlet = null;
if (Validator.isNotNull(portletId)) {
try {
String rootPortletId = PortletConstants.getRootPortletId(
portletId);
portlet = PortletLocalServiceUtil.getPortletById(rootPortletId);
}
catch (Exception e) {
if (_log.isDebugEnabled()) {
_log.debug(e, e);
}
}
}
String servletContextName = null;
if (portlet != null) {
PortletApp portletApp = portlet.getPortletApp();
servletContextName = portletApp.getServletContextName();
}
else if (requestURI != null) {
servletContextName = requestURI;