List of usage examples for com.liferay.portal.util PropsValues VIRTUAL_HOSTS_DEFAULT_SITE_NAME
String VIRTUAL_HOSTS_DEFAULT_SITE_NAME
To view the source code for com.liferay.portal.util PropsValues VIRTUAL_HOSTS_DEFAULT_SITE_NAME.
Click Source Link
From source file:com.liferay.portlet.layoutsadmin.action.RobotsAction.java
License:Open Source License
@Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try {/*from w w w. j a v a 2 s. co m*/ String host = GetterUtil.getString(PortalUtil.getHost(request)); LayoutSet layoutSet = null; try { layoutSet = LayoutSetLocalServiceUtil.getLayoutSet(host); } catch (LayoutSetVirtualHostException lsvhe) { Company company = PortalUtil.getCompany(request); if (host.equals(company.getVirtualHostname()) && Validator.isNotNull(PropsValues.VIRTUAL_HOSTS_DEFAULT_SITE_NAME)) { Group defaultGroup = GroupLocalServiceUtil.getGroup(company.getCompanyId(), PropsValues.VIRTUAL_HOSTS_DEFAULT_SITE_NAME); layoutSet = defaultGroup.getPublicLayoutSet(); } } /*================ start changes ================*/ catch (NoSuchLayoutSetException | NoSuchVirtualHostException nse) { if (_log.isErrorEnabled()) { _log.error( "Ignored exception: " + nse.getMessage() + " Headers: " + printRequestHeaders(request)); } } /*================ end changes ================*/ String robots = RobotsUtil.getRobots(layoutSet); ServletResponseUtil.sendFile(request, response, null, robots.getBytes(StringPool.UTF8), ContentTypes.TEXT_PLAIN_UTF8); } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn(e, e); } PortalUtil.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e, request, response); } return null; }