/** * Returns session associated to current thread. Always returns a session during a request * cycle, even though the session might be temporary * * @return session. */ public static Session get() { Session session = ThreadContext.getSession(); if (session != null) { return session; } else { return Application.get().fetchCreateAndSetSession(RequestCycle.get()); } }
/** * Returns session associated to current thread. Always returns a session during a request * cycle, even though the session might be temporary * * @return session. */ public static Session get() { Session session = ThreadContext.getSession(); if (session != null) { return session; } else { return Application.get().fetchCreateAndSetSession(RequestCycle.get()); } }
private void internalUmount(String path){ //workaround so wicket doesn't choke because the thread context isn't filled (wrong thread) Application application = ThreadContext.getApplication(); if (application == null) ThreadContext.setApplication(JabylonApplication.this); if(ThreadContext.getSession()==null) ThreadContext.setSession(new WebSession(createFakeRequest(null))); // unmount(path); /* * umount seems to be greedy, e.g. a prefix match is enough. * That's troublesome because umount /settings/log will also umount /settings */ ICompoundRequestMapper rootRequestMapperAsCompound = getRootRequestMapperAsCompound(); if (rootRequestMapperAsCompound instanceof CompoundRequestMapper) { CompoundRequestMapper compound = (CompoundRequestMapper) rootRequestMapperAsCompound; Iterator<IRequestMapper> it = compound.iterator(); while (it.hasNext()) { IRequestMapper iRequestMapper = it.next(); if (iRequestMapper instanceof ResouceAwareMountedMapper) { ResouceAwareMountedMapper mapper = (ResouceAwareMountedMapper) iRequestMapper; if(path.equals(mapper.getMountPath())) { logger.info("Unmounting {}",path); getRootRequestMapperAsCompound().remove(mapper); } } } } }
/** * Checks existence of a <code>Session</code> associated with the current thread. * * @return {@code true} if {@link Session#get()} can return the instance of session, * {@code false} otherwise */ public static boolean exists() { Session session = ThreadContext.getSession(); if (session == null) { // no session is available via ThreadContext, so lookup in session store RequestCycle requestCycle = RequestCycle.get(); if (requestCycle != null) { session = Application.get().getSessionStore().lookup(requestCycle.getRequest()); if (session != null) { ThreadContext.setSession(session); } } } return session != null; }
/** * Checks existence of a <code>Session</code> associated with the current thread. * * @return {@code true} if {@link Session#get()} can return the instance of session, * {@code false} otherwise */ public static boolean exists() { Session session = ThreadContext.getSession(); if (session == null) { // no session is available via ThreadContext, so lookup in session store RequestCycle requestCycle = RequestCycle.get(); if (requestCycle != null) { session = Application.get().getSessionStore().lookup(requestCycle.getRequest()); if (session != null) { ThreadContext.setSession(session); } } } return session != null; }
Session oldSession = ThreadContext.exists() ? ThreadContext.getSession() : null; ThreadContext oldContext = ThreadContext.detach(); Session newSession = ThreadContext.getSession(); ThreadContext.restore(oldContext); if (oldSession == null && newSession != null && !newSession.isTemporary()) {
Session oldSession = ThreadContext.getSession(); RequestCycle oldRequestCycle = ThreadContext.getRequestCycle();
Session oldSession = ThreadContext.getSession(); RequestCycle oldRequestCycle = ThreadContext.getRequestCycle();
Session oldSession = ThreadContext.getSession(); RequestCycle oldRequestCycle = ThreadContext.getRequestCycle();