org.apache.wicket.protocol.http.WebSession Java Examples
The following examples show how to use
org.apache.wicket.protocol.http.WebSession.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IcalUtils.java From openmeetings with Apache License 2.0 | 6 votes |
/** * Adapted from DateUtils to support Timezones, and parse ical dates into {@link java.util.Date}. * Note: Replace FastDateFormat to java.time, when shifting to Java 8 or higher. * * @param str Date representation in String. * @param patterns Patterns to parse the date against * @param inTimeZone Timezone of the Date. * @return <code>java.util.Date</code> representation of string or * <code>null</code> if the Date could not be parsed. */ public Date parseDate(String str, String[] patterns, TimeZone inTimeZone) { FastDateFormat parser; Locale locale = WebSession.get().getLocale(); TimeZone timeZone = str.endsWith("Z") ? TimeZone.getTimeZone("UTC") : inTimeZone; ParsePosition pos = new ParsePosition(0); for (String pattern : patterns) { parser = FastDateFormat.getInstance(pattern, timeZone, locale); pos.setIndex(0); Date date = parser.parse(str, pos); if (date != null && pos.getIndex() == str.length()) { return date; } } log.error("Unable to parse the date: {} at {}", str, -1); return null; }
Example #2
Source File: ApplicationHelper.java From openmeetings with Apache License 2.0 | 5 votes |
public static IApplication ensureApplication(Long langId) { IApplication a = ensureApplication(); if (ThreadContext.getRequestCycle() == null) { ServletWebRequest req = new ServletWebRequest(new MockHttpServletRequest((Application)a, new MockHttpSession(a.getServletContext()), a.getServletContext()), ""); RequestCycleContext rctx = new RequestCycleContext(req, new MockWebResponse(), a.getRootRequestMapper(), a.getExceptionMapperProvider().get()); ThreadContext.setRequestCycle(new RequestCycle(rctx)); } if (ThreadContext.getSession() == null) { WebSession s = WebSession.get(); if (langId > 0) { ((IWebSession)s).setLanguage(langId); } } return a; }
Example #3
Source File: AbstractTemplatePanel.java From openmeetings with Apache License 2.0 | 4 votes |
public static IWebSession getOmSession() { return (IWebSession)WebSession.get(); }