/** * @return true for web contexts. */ public boolean isWeb() { if (web == null) { web = ContextUtils.isWeb(); } return web; }
/** @return true for web contexts. */ protected boolean isWeb() { if (web == null) { web = ContextUtils.isWeb(); } return web; }
/** * @return the locale stored in session. */ protected Locale getSessionLocale() { if (ContextUtils.isWeb()) { return (Locale) ContextUtils.getSessionAttribute(LOCALE_ATTRIBUTE); } return LocaleContextHolder.getLocale(); }
/** * Set the session locale. * @param locale */ protected void setSessionLocale(final Locale locale) { if (ContextUtils.isWeb()) { ContextUtils.setSessionAttribute(LOCALE_ATTRIBUTE, locale); } else { LocaleContextHolder.setLocale(locale); } }
/** * @return a HTML report of the exception. */ public String getHtmlReport() { StringBuffer sb = new StringBuffer( h1(getString("EXCEPTION.TITLE"))); sb.append("\n<table border=\"1\">"); sb.append(getHtmlReportInformation()); sb.append(getHtmlReportException()); if (ContextUtils.isWeb()) { sb.append(getHtmlReportRequest()); } sb.append(getHtmlReportProperties()); sb.append("\n</table>"); return sb.toString(); }
/** * @return a plain/text report of the throwable. */ protected String getTextReport() { StringBuffer sb = new StringBuffer(getString("EXCEPTION.TITLE")); String separator = getString("EXCEPTION.SEPARATOR"); sb.append(getTextReportInformation(separator)); sb.append(getTextReportException(separator)); if (ContextUtils.isWeb()) { sb.append(getTextReportRequest()); } sb.append(getTextReportProperties()); sb.append(TEXT_HRULE); return sb.toString(); }
/** * @return The global session attributes, as a set of strings. */ public static Set<String> getGlobalSessionAttributesStrings() { if (!isWeb()) { return new TreeSet<String>(); } if (isServlet()) { HttpServletRequest servletRequest = ((ServletRequestAttributes) getContextAttributes()).getRequest(); return getAttributesStrings(getGlobalSessionAttributes(servletRequest)); } PortletRequest portletRequest = ((PortletRequestAttributes) getContextAttributes()).getRequest(); return getAttributesStrings(getGlobalSessionAttributes(portletRequest)); }
/** * @return The request attributes, as a set of strings. */ public static Set<String> getRequestAttributesStrings() { if (!isWeb()) { return new TreeSet<String>(); } if (isServlet()) { return getAttributesStrings(getRequestAttributes( ((ServletRequestAttributes) getContextAttributes()).getRequest())); } return getAttributesStrings(getRequestAttributes( ((PortletRequestAttributes) getContextAttributes()).getRequest())); }
/** * @return The session attributes, as a set of strings. */ public static Set<String> getSessionAttributesStrings() { if (!isWeb()) { return new TreeSet<String>(); } if (isServlet()) { return getAttributesStrings(getSessionAttributes( ((ServletRequestAttributes) getContextAttributes()).getRequest())); } return getAttributesStrings(getSessionAttributes( ((PortletRequestAttributes) getContextAttributes()).getRequest())); }
if (ContextUtils.isWeb()) { if (userId == null) { userId = getString("EXCEPTION.INFORMATION.USER_ID.UNKNOWN");
if (ContextUtils.isWeb()) { String userIdStr; if (getUserId() == null) {
maxMemory = SystemUtils.getMaxMemory(); totalMemory = SystemUtils.getTotalMemory(); if (ContextUtils.isWeb()) { server = HttpUtils.getServerString(); if (authenticationService != null) {