}
public ServiceContext getServiceContext() {
ServiceContext serviceContext = new ServiceContext();
ThemeDisplay themeDisplay = getThemeDisplay();
serviceContext.setCompanyId(themeDisplay.getCompanyId());
serviceContext.setLanguageId(themeDisplay.getLanguageId());
serviceContext.setPathMain(PortalUtil.getPathMain());
serviceContext.setPlid(themeDisplay.getPlid());
serviceContext.setPortalURL(PortalUtil.getPortalURL(getPortletRequest()));
serviceContext.setScopeGroupId(themeDisplay.getScopeGroupId());
serviceContext.setUserId(themeDisplay.getUserId());
try {
serviceContext.setLayoutFullURL(PortalUtil.getLayoutFullURL(themeDisplay));
serviceContext.setLayoutURL(PortalUtil.getLayoutURL(themeDisplay));
serviceContext.setUserDisplayURL(themeDisplay.getUser().getDisplayURL(themeDisplay));
}
catch (Exception e) {
logger.error(e.getMessage(), e);
}