/** * Returns the current users OpenCms request context.<p> * * @return the current users OpenCms request context */ public CmsRequestContext getRequestContext() { return getCmsObject().getRequestContext(); }
/** * Initialize this bean with the current page context, request and response.<p> * * It is required to call one of the init() methods before you can use the * instance of this bean. * * @param context the JSP page context object * @param req the JSP request * @param res the JSP response */ public void init(PageContext context, HttpServletRequest req, HttpServletResponse res) { m_controller = CmsFlexController.getController(req); if (m_controller == null) { handleMissingFlexController(); } m_context = context; m_request = req; m_response = res; m_isNotInitialized = false; }
/** * Handles any exception that might occur in the context of this element to * ensure that templates are not disturbed.<p> * * @param t the Throwable that was caught */ protected void handleException(Throwable t) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_ERR_JSP_BEAN_0), t); } if (!(m_isSupressingExceptions || getRequestContext().getCurrentProject().isOnlineProject())) { if (LOG.isDebugEnabled()) { // no stack trace needed since it was already logged with the "error" log message above LOG.debug( Messages.get().getBundle().key(Messages.LOG_DEBUG_INTERRUPTED_EXCEPTION_1, getClass().getName())); } String uri = null; Throwable u = getController().getThrowable(); if (u != null) { uri = getController().getThrowableResourceUri(); } else { uri = getRequestContext().getUri(); } throw new CmsRuntimeException( Messages.get().container(Messages.ERR_RUNTIME_1, (uri != null) ? uri : getClass().getName()), t); } }
/** * Handles any exception that might occur in the context of this element to * ensure that templates are not disturbed.<p> * * @param t the Throwable that was caught */ protected void handleException(Throwable t) { if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_ERR_JSP_BEAN_0), t); } if (!(m_isSupressingExceptions || getRequestContext().currentProject().isOnlineProject())) { if (LOG.isDebugEnabled()) { // no stack trace needed since it was already logged with the "error" log message above LOG.debug(Messages.get().getBundle().key( Messages.LOG_DEBUG_INTERRUPTED_EXCEPTION_1, getClass().getName())); } String uri = null; Throwable u = getController().getThrowable(); if (u != null) { uri = getController().getThrowableResourceUri(); } else { uri = getRequestContext().getUri(); } throw new CmsRuntimeException(Messages.get().container( Messages.ERR_RUNTIME_1, (uri != null) ? uri : getClass().getName()), t); } }
/** * Returns the current users OpenCms request context.<p> * * @return the current users OpenCms request context */ public CmsRequestContext getRequestContext() { return getCmsObject().getRequestContext(); }
/** * Internally localizes the given <code>CmsMessageContainer</code> to a String. <p> * * If the user request context is at hand, the user's locale will be chosen. If * no user request context is available, the default locale is used. <p> * * @param container the message container that allows localization of the represented message. * * @return the message String of the container argument localized to the user's locale (if available) or * to the default locale. */ protected String getMessage(CmsMessageContainer container) { CmsObject cms = getCmsObject(); String result; if ((cms == null) || (cms.getRequestContext().getLocale() == null)) { result = container.key(); } else { result = container.key(cms.getRequestContext().getLocale()); } return result; }
/** * Internally localizes the given <code>CmsMessageContainer</code> to a String. <p> * * If the user request context is at hand, the user's locale will be chosen. If * no user request context is available, the default locale is used. <p> * * @param container the message container that allows localization of the represented message. * * @return the message String of the container argument localized to the user's locale (if available) or * to the default locale. */ protected String getMessage(CmsMessageContainer container) { CmsObject cms = getCmsObject(); String result; if ((cms == null) || (cms.getRequestContext().getLocale() == null)) { result = container.key(); } else { result = container.key(cms.getRequestContext().getLocale()); } return result; }