public WebContext get() { return WebContextFactory.get(); }
WebContextFactory.attach(container); HubFactory.attach(container); JsonParserFactory.attach(container);
public ScriptSession get() { WebContext webcx = WebContextFactory.get(); return webcx.getScriptSession(); }
public Object getInstance() throws InstantiationException { // fills for the first time the moduleConfig ActionForm formInstance = (ActionForm) WebContextFactory.get().getSession().getAttribute(formBean); if (formInstance == null) { throw new InstantiationException("Can't find formInstance for " + formBean); } return formInstance; }
public HttpServletRequest get() { WebContext webcx = WebContextFactory.get(); return webcx.getHttpServletRequest(); }
@Override public HttpSession get() { return WebContextFactory.get().getSession(); }
@SuppressWarnings({"unchecked"}) public Map<String, String[]> get() { WebContext webcx = WebContextFactory.get(); return webcx.getHttpServletRequest().getParameterMap(); }
@Override public ScriptSession get() { return WebContextFactory.get().getScriptSession(); }
public HttpServletResponse get() { WebContext webcx = WebContextFactory.get(); return webcx.getHttpServletResponse(); }
public HttpSession get() { WebContext webcx = WebContextFactory.get(); return webcx.getSession(); }
@Override public HttpServletRequest get() { return WebContextFactory.get().getHttpServletRequest(); }
/** * Create a Callback from a DWR thread, * i.e. where {@link WebContextFactory#get()} =! null */ public Callback() { WebContext context = WebContextFactory.get(); if (context == null) { throw new IllegalStateException("Attempt to use Callback without any ScriptSessions, from a non DWR thread. There is nowhere for replies to go."); } sessions.add(context.getScriptSession()); }
public ServerContext get() { ServerContext serverContext = WebContextFactory.get(); if (serverContext == null) { // If not see if there is a singleton serverContext = StartupUtil.getSingletonServerContext(); if (serverContext == null) { log.fatal("Error initializing ServerContext because this is not a DWR thread and there is more than one DWR servlet in the current classloader."); log.fatal("This probably means that either DWR has not been properly initialized (in which case you should delay the current action until it has)"); log.fatal("or that there is more than 1 DWR servlet is configured in this classloader, in which case you should provide a ServletContext to the get() yourself."); throw new IllegalStateException("No singleton ServerContext see logs for possible causes and solutions."); } } return serverContext; }
public Object getInstance() throws InstantiationException { if (getter == null) { getter = (bhGetter != null) ? bhGetter : wlGetter; } try { HttpServletRequest request = WebContextFactory.get().getHttpServletRequest(); return getter.invoke(null, request); } catch (InvocationTargetException ex) { throw new InstantiationException(ex.getTargetException().toString()); } catch (Exception ex) { throw new InstantiationException(ex.toString()); } }
/** * Call {@link ScriptSession#invalidate()} on the {@link ScriptSession} * that called this method. * Used by the page unloader. */ public void pageUnloaded() { WebContext wctx = WebContextFactory.get(); ScriptSession scriptSession = wctx.getScriptSession(); log.debug("pageUnloaded is invalidating scriptSession: " + scriptSession); scriptSession.invalidate(); }
/** * Internal method to find or create a StoreProvider for a given user. */ @Override protected StoreProvider<T> getStoreProvider() { HttpSession session = WebContextFactory.get().getSession(true); @SuppressWarnings("unchecked") StoreProvider<T> storeProvider = (StoreProvider<T>) session.getAttribute(attributeName); if (storeProvider == null) { storeProvider = factory.create(session); session.setAttribute(attributeName, storeProvider); } return storeProvider; }
public Object doFilter(Object object, Method method, Object[] params, AjaxFilterChain chain) throws Exception { ServletContext context = WebContextFactory.get().getServletContext(); SessionFactory sessionFactory = (SessionFactory) context.getAttribute(ATTRIBUTE_SESSION); Transaction transaction = null; if (sessionFactory != null) { Session session = sessionFactory.getCurrentSession(); transaction = session.beginTransaction(); } else { log.error("SessionFactory not initialized for this web application. Use: H3SessionAjaxFilter.setSessionFactory(servletContext, sessionFactory);"); } Object reply = chain.doFilter(object, method, params); if (transaction != null) { transaction.commit(); } return reply; }
public String getPathToDwrServlet(String contextServletPath) { String actualPath = contextServletPath; if (useAbsolutePath) { HttpServletRequest request = WebContextFactory.get().getHttpServletRequest(); actualPath = LocalUtil.getFullUrlToDwrServlet(request); } return actualPath; }
public String addFileTransfer(FileTransfer generator) throws IOException { String id = idGenerator.generate(); putFileTransfer(id, generator); HttpServletRequest request = WebContextFactory.get().getHttpServletRequest(); return "'" + request.getContextPath() + request.getServletPath() + downloadHandlerUrl + id + "'"; }
private HttpServletResponse getCapturingResponse(StringWriter sw) { WebContext ctx = WebContextFactory.get(); return new CapturingResponseWrapper(ctx.getHttpServletResponse(), sw); }