invalidation

Store and invalidate Java HttpSession from different user

China☆狼群 提交于 2019-12-02 04:32:01
Okay. What I want to do is be able to, when I update a user, invalidate any session that they currently have in order to force a refresh of credentials. I don't care about being able to directly access the session-specific user data. Ideally, I would also be able to restrict users to one session by a similar manner. What I tried doing is creating a HashMap using the username as key and HttpSession as the value (my actual setup is a little more involved, but after repeated seemingly inexplicable failures, I boiled it down to this simple test). However, whenever I attempt to tell the retrieved

Invalidate Session of a specific user

冷暖自知 提交于 2019-12-02 01:32:56
So for my webapp, if I remove a user that is currently logged in, and I want to invalidate his/her session. So that as soon as he/she refresh the page or navigate, they are no longer log in. The way I have now is that if a User logged in successfully, I will store the user object in my SessionScoped bean, and store the HttpSession to the Application Map . Below is my code This is my SessionScoped bean @PostConstruct public void init() { User user = UserDAO.findById(userId, password); Map<String, Object> appMap = FacesContext.getCurrentInstance(). getExternalContext().getApplicationMap();

Invalidate is not redrawing the screen. Android

我的梦境 提交于 2019-12-02 01:25:23
BufferedReader hl = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.lines))); while(hl.ready()){ showLines.append(hl.readLine()+"\n"); showLines.invalidate(); Thread.sleep(10); } That is my code but it is not redrawing when I tell it to. It is supposed to redraw after every line that is added to textview, but it still only redraws at the end? Can someone please help me, I can't figure it out. That is bacause your invalidate() is in a thread while loop and is being acummulated, so to speak, until the loop ends, and only than it draws... I had the same problem when

Why session is not null after session.invalidate() in JAVA?

主宰稳场 提交于 2019-11-30 07:13:39
问题 I am facing very strange problem while developing JavaEE WEB Application. Even after invalidating the HttpSession using session.invalidate(); , I am not getting session null . There is a case where I have one statement in execution like below after invalidating session. if (null != session && null != session.getAttribute("loginToken")){ //do something } I am not getting session null here so second condition will try to execute. And hence session is not null, so I am getting

Android : Update Image in GridView on touch event in Adapter

匆匆过客 提交于 2019-11-29 16:27:39
I have a GridView and attached adapter to it. Adapter populates images in the grid. I have set setOnTouchLister to GridView in my Activity and implemented in the adapter only. In adapter I have an Integer[] imageIDs that contains resource ids of all images that are added & an ArrayList<ImageSourceObject> imgObjsArr that extends ImageView & has other properties set. Now onTouch() , I want to change the image of the selected image to other one. Here's my code : SEtting adapter of grid in Activity in onCreate : // Set Objects in Game View gameView = (GridView) this.findViewById(R.id.game_gridView

Update existing Preference-item in a PreferenceActivity upon returning from a (sub)PreferenceScreen

自闭症网瘾萝莉.ら 提交于 2019-11-29 04:08:46
I have a PreferenceActivity with a bunch of (Sub)PreferenceScreens. Each such (Sub)PreferenceScreen represents an account and has the account-username as its title. PreferenceScreen root = mgr.createPreferenceScreen(this); for (MyAccountClass account : myAccounts) { final PreferenceScreen accScreen = mgr.createPreferenceScreen(this); accScreen.setTitle(account.getUsername()); // add Preferences to the accScreen // (for instance a "change username"-preference) ... root.add(accScreen); } As the user enters sub-PreferenceScreen, and edits the account user-name, I want the outer PreferenceScreen

Why session is not null after session.invalidate() in JAVA?

一笑奈何 提交于 2019-11-29 02:05:33
I am facing very strange problem while developing JavaEE WEB Application. Even after invalidating the HttpSession using session.invalidate(); , I am not getting session null . There is a case where I have one statement in execution like below after invalidating session. if (null != session && null != session.getAttribute("loginToken")){ //do something } I am not getting session null here so second condition will try to execute. And hence session is not null, so I am getting IllegalStateException - session is already invalidated . But why session is not null after invalidating it?? :( Calling

What is the difference between Android's invalidate() and postInvalidate() methods?

瘦欲@ 提交于 2019-11-29 00:45:08
问题 What is the difference between Android's invalidate() and postInvalidate() methods? When does each one get called? Must the methods be called only in classes which extend View ? 回答1: If you want to re-draw your view from the UI thread you can call invalidate() method. If you want to re-draw your view from a non-UI thread you can call postInvalidate() method. Each class which is derived from the View class has the invalidate and the postInvalidate method. If invalidate gets called it tells the

Android : Update Image in GridView on touch event in Adapter

心已入冬 提交于 2019-11-28 10:27:38
问题 I have a GridView and attached adapter to it. Adapter populates images in the grid. I have set setOnTouchLister to GridView in my Activity and implemented in the adapter only. In adapter I have an Integer[] imageIDs that contains resource ids of all images that are added & an ArrayList<ImageSourceObject> imgObjsArr that extends ImageView & has other properties set. Now onTouch() , I want to change the image of the selected image to other one. Here's my code : SEtting adapter of grid in

NSTimer doesn't stop with invalidate

风流意气都作罢 提交于 2019-11-28 04:12:21
问题 I add timer like this tim=[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(repeatTim) userInfo:nil repeats:YES]; [[NSRunLoop mainRunLoop] addTimer:tim forMode:NSDefaultRunLoopMode]; tim it is NSTimer property of my class. Then i stop it on button click like [[fbt tim] invalidate]; [fbt setTim:nil]; fbt it is instance of my class. if i call only invalidate then it doesn't stop, but if i set it to nil then i got EXC_BREAKPOINT here code of repeatTim method in selector