Few words about ServicePreAction class.
This action invokes each time when user make request(some button, link pressing, etc). In this case ServicePreAction can be used when you need to set some objects to requests or session. Also when you look into source of this class, you can find that ThemeDisplay object are set in it:
This action invokes each time when user make request(some button, link pressing, etc). In this case ServicePreAction can be used when you need to set some objects to requests or session. Also when you look into source of this class, you can find that ThemeDisplay object are set in it:
protected void servicePre(HttpServletRequest request, HttpServletResponse response) throws Exception { ThemeDisplay themeDisplay = initThemeDisplay(request, response); if (themeDisplay == null) { return; } request.setAttribute(WebKeys.THEME_DISPLAY, themeDisplay); ... }
- Create ServicePreActionExt.java
- Add to portal-ext.propeties:
public class ServicePreActionExt extends ServicePreAction { /** The _log. */ private static Log _log = LogFactoryUtil.getLog(ServicePreActionExt.class); /** {@inheritDoc} */ @Override protected void servicePre(HttpServletRequest request, HttpServletResponse response) throws Exception { super.servicePre(request, response); request.setAttribute("myAttr", "Hello attr"); }
servlet.service.events.pre=package.path.ServicePreActionExt
No comments:
Post a Comment