public static String sanitizeErrorMessage(String errorMessage) { boolean debug = false; Object debugVal = WebContextFactory.get().getContainer().getBean("debug"); if (debugVal != null) { debug = LocalUtil.simpleConvert(debugVal.toString(), Boolean.class); } if (debug) { return "null /* " + errorMessage.replace("*/", "* /") + " */"; } else { return "null"; } } }
/** * Generates and returns a new unique id suitable to use for the * CSRF session cookie. This method is itself exempted from CSRF checking. */ public String generateId() { WebContext webContext = WebContextFactory.get(); // If the current session already has a set DWRSESSIONID then we return that HttpServletRequest request = webContext.getHttpServletRequest(); HttpSession sess = request.getSession(false); if (sess != null && sess.getAttribute(ATTRIBUTE_DWRSESSIONID) != null) { return (String) sess.getAttribute(ATTRIBUTE_DWRSESSIONID); } // Otherwise generate a fresh ID IdGenerator idGenerator = webContext.getContainer().getBean(IdGenerator.class); return idGenerator.generate(); }
/** * Something has published to the client side 'hub' and we're getting to * know about it. * @param topic The topic that has been published to * @param data The published data */ public void publish(String topic, RealRawData data) { WebContext webContext = WebContextFactory.get(); ConverterManager converterManager = webContext.getContainer().getBean(ConverterManager.class); Hub hub = HubFactory.get(); MessageEvent event = new DefaultMessageEvent(hub, converterManager, data); hub.publish(topic, event); }
Container container = WebContextFactory.get().getContainer(); boolean preferDataUrlSchema = ContainerUtil.getBooleanSetting(container, "preferDataUrlSchema", false);
ConverterManager converterManager = webContext.getContainer().getBean(ConverterManager.class);