本文整理汇总了Java中com.liferay.portal.util.PortalUtil.getPortalURL方法的典型用法代码示例。如果您正苦于以下问题:Java PortalUtil.getPortalURL方法的具体用法?Java PortalUtil.getPortalURL怎么用?Java PortalUtil.getPortalURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.util.PortalUtil
的用法示例。
在下文中一共展示了PortalUtil.getPortalURL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: refreshCfg
import com.liferay.portal.util.PortalUtil; //导入方法依赖的package包/类
/**
* Refresh cfg.
*/
public void refreshCfg() {
try {
this.m_strPortalName = CustomPortalServiceHandler
.getConfigValue(E_ConfigKey.MGMT_CONTACT_NAME);
this.m_strOfferPermaBase = CustomPortalServiceHandler
.getConfigValue(E_ConfigKey.MGMT_PATH_OFFER_PERMALINK);
this.m_objDefCompany = CompanyLocalServiceUtil
.getCompany(PortalUtil
.getDefaultCompanyId());
if (this.m_objDefCompany == null)
this.m_objDefCompany = CompanyLocalServiceUtil.getCompanyByMx(PropsUtil.get(PropsKeys.COMPANY_DEFAULT_WEB_ID));
this.m_strPortalURL = PortalUtil.getPortalURL(
this.m_objDefCompany.getVirtualHostname(),
PortalUtil.getPortalPort(), false);
// FIX: #5 - somethimes portal port is -1 for unknown reasons
if (this.m_strPortalURL.contains(":-1"))
this.m_strPortalURL = this.m_strPortalURL.replace(":-1", "");
m_objLog.info("Portal URL is "+this.m_strPortalURL);
} catch (final Throwable e) {
m_objLog.error(e);
}
}
示例2: sendMailP2pDone
import com.liferay.portal.util.PortalUtil; //导入方法依赖的package包/类
private static void sendMailP2pDone(User user, long actId, ThemeDisplay themeDisplay){
try
{
LearningActivity activity = LearningActivityLocalServiceUtil.getLearningActivity(actId);
Group group = GroupLocalServiceUtil.getGroup(activity.getGroupId());
Course course= CourseLocalServiceUtil.getCourseByGroupCreatedId(activity.getGroupId());
Module module = ModuleLocalServiceUtil.getModule(activity.getModuleId());
String courseFriendlyUrl = "";
String courseTitle = "";
String activityTitle = activity.getTitle(user.getLocale());
String moduleTitle = module.getTitle(user.getLocale());
String portalUrl = PortalUtil.getPortalURL(themeDisplay);
String pathPublic = PortalUtil.getPathFriendlyURLPublic();
//QUITANDO PUERTOS
String[] urls = portalUrl.split(":");
portalUrl = urls[0] + ":" +urls[1];
// if(urls.length > 2){ // http:prueba.es:8080
// portalUrl += urls[1];
// }
_log.debug("***portalUrl:"+portalUrl);
if(course != null){
courseTitle = course.getTitle(user.getLocale());
courseFriendlyUrl = portalUrl + pathPublic + course.getFriendlyURL();
courseFriendlyUrl += "/reto?p_p_id=p2ptaskactivity_WAR_liferaylmsportlet";
courseFriendlyUrl += "&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_r_p_564233524_actId="+actId;
courseFriendlyUrl += "&p_r_p_564233524_moduleId="+activity.getModuleId();
_log.debug("URL "+ courseFriendlyUrl);
}
String messageArgs[]= {activityTitle, moduleTitle, courseTitle, courseFriendlyUrl};
String titleArgs[]= {String.valueOf(user.getFullName())};
//Nuevos campos del email
//Subject
String subject = LanguageUtil.get(user.getLocale(), "p2ptaskactivity.mail.sendactivity.mail.subject");
String title = LanguageUtil.format(user.getLocale(), "p2ptaskactivity.mail.sendactivity.mail.title", titleArgs);
String body = title +"<br /><br />"+ LanguageUtil.format(user.getLocale(), "p2ptaskactivity.mail.sendactivity.mail.message", messageArgs);
String firmaPortal = PrefsPropsUtil.getString(themeDisplay.getCompanyId(),"firma.email.admin");
// JOD
firmaPortal = (firmaPortal!=null?firmaPortal:"");
if(_log.isDebugEnabled()){_log.debug("P2PActivityPortlet::sendMailNoCorrection::subject:"+subject);}
if(_log.isDebugEnabled()){_log.debug("P2PActivityPortlet::sendMailNoCorrection::body:"+body);}
//String fromUser=PrefsPropsUtil.getString(user.getCompanyId(),PropsKeys.ADMIN_EMAIL_FROM_ADDRESS);
String fromName=PrefsPropsUtil.getString(user.getCompanyId(),PropsKeys.ADMIN_EMAIL_FROM_NAME,"");
String fromAddress=PrefsPropsUtil.getString(user.getCompanyId(),PropsKeys.ADMIN_EMAIL_FROM_ADDRESS,"");
InternetAddress from = new InternetAddress(fromAddress, fromName);
InternetAddress to = new InternetAddress(user.getEmailAddress(), user.getFullName());
MailMessage mailMessage = new MailMessage(from, to, subject, body, true);
MailServiceUtil.sendEmail(mailMessage);
//MailEngine.send(from, new InternetAddress[]{to}, new InternetAddress[]{}, subject, body, true);
if(_log.isDebugEnabled()){_log.debug("P2PActivityPortlet::sendMailNoCorrection::Mail Enviado");}
}
/*catch(MailEngineException ex) {
if(_log.isErrorEnabled()){_log.error(ex);}
}*/ catch (Exception e) {
if(_log.isErrorEnabled()){_log.error(e);}
}
}