if (request instanceof PortletRequest) {
portletRequest = (PortletRequest) request;
}
else if (request instanceof HttpServletRequestAdapter) {
HttpServletRequestAdapter httpServletRequestAdapter = (HttpServletRequestAdapter) request;
portletRequest = httpServletRequestAdapter.getWrapped();
}
return portletRequest;
}