Reload Page + Invalidate Session

(ADF 11gR1 ADFBC) I have an ADF application which can be run with different contexts.
Every user has a “last_selected_context” stored in the database.
When launching the application, I fetch this “last selected context” and in the “beforePhase” of the “PagePhaseListener”, I set all my session variables for this context.
Users may swap from a context to another by selecting it from a popup.
My problem is : when a user select another context, I have to invalidate the session and reload the page.
I did this in a function “reloadThePage()”
    public static void reloadThePage()
      FacesContext fContext = FacesContext.getCurrentInstance();
      String viewId = fContext.getViewRoot().getViewId();
      String actionUrl = fContext.getApplication().getViewHandler().getActionURL(fContext, viewId);
      try
        ExternalContext eContext = fContext.getExternalContext();
        String resourceUrl = actionUrl;
       // Invalidate Session
       HttpSession session = (HttpSession)JSFUtils.getFacesContext().getExternalContext().getSession(false);
        if (session != null) {
            session.invalidate();
        eContext.redirect(resourceUrl);
      catch (IOException ioe)
        System.err.println("Problem trying to reload the page:");
        ioe.printStackTrace();
    }It is working fine, but I have this Warning message every time a change the context: Because of inactivity, your session has timed out and is no longer active.  Click OK to reload the page+.
Is there a way to avoid this Warning message?
Thanks & Regards
Nicolas

Hi Timo,
Thanks for your help.
I've tried this but I still have the same warning message.
    public static void reloadThePage()
      FacesContext fContext = FacesContext.getCurrentInstance();
      try
        ExternalContext eContext = fContext.getExternalContext();
        String resourceUrl = "/hr2/faces/home"; 
        // Invalidate Session
        HttpSession session = (HttpSession)JSFUtils.getFacesContext().getExternalContext().getSession(false);
        if (session != null) {
            session.invalidate();
        eContext.redirect(resourceUrl);
      catch (IOException ioe)
        System.err.println("Problem trying to reload the page:");
        ioe.printStackTrace();
    }Any other suggestion ?
Thanks & Regards
Nicolas

Similar Messages

  • Is it possible to invalidate session when I click my browsers back button

    Hai
    I have a question.
    I am building a jsp page with multiple forms.As of now,
    no login system has been implemented.
    I need my session to time out when the client click on the back
    button on the browser to prevent data corruption.
    Is there a possible way to do this in Java/ Script
    I know the use of session.invalidate() but how to tie it up to the
    browser's back button
    A second problem
    If I use session.invalidate() on Tomcat 3.2
    I find that it is not invalidated.But this same function on tomcat 4
    doesn't have any problem
    Could anyone help on these issues
    Thanks

    You don't mean you want to invalidate session every time you move to a new page, do you? If you do, after implementation of login system the users will be asked for passwords at each page. If you don't, it's better to use headers for your response.
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Expires", "-1");

  • Invalidate session with weblogic.Admin

    Hi,
    I tried to invalidate sessions using weblogic.Admin using the command: java weblogic.Admin -url t3://localhost:8013 -username system -password *** GET -pretty -type ServletSessionRuntime. The output was:
    MBeanName: "R3:Location=PIA,Name=B0lYRDnVqlw1VzPZO1XszSFlIASW017b!1102341400731,ServerRuntime=PIA,Type=ServletSessionRuntime"
    CachingDisabled: true
    MainAttribute: [email protected]/ps
    Name: B0lYRDnVqlw1VzPZO1XszSFlIASW017b!1102341400731
    ObjectName: B0lYRDnVqlw1VzPZO1XszSFlIASW017b!1102341400731
    Parent: PIA
    Registered: true
    TimeLastAccessed: 1102341410448
    Type: ServletSessionRuntime
    Then tried to invalidate it using:
    java weblogic.Admin -url t3://localhost:8013 -username system -password *** INVOKE -mbean "R3:Location=PIA,Name=B0lYRDnVqlw1VzPZO1XszSFlIASW017b!1102341400731,ServerRuntime=PIA,Type=ServletSessionRuntime" -method INVALIDATE
    ANd the error message: bash: !1102341400731: event not found
    Do you know how to handle this? Or any other way to invalidate session from weblogic.Admin?
    WLS 8.1 SP1
    Regards
    Tomi

    Hello,
    I have a system consisting of three different departments, each department has its own login page with different username and password.
    from the same browser, all three administrators can log in successfully, during there login, one session is created with different attributes for each of them, if any one administrator logs out, I invalidate the session, which logs out the other two administrators.
    Can I use session Id to log out on administrator while the other two can stay logs in?
    If I am using the wrong approach all together, can anyone suggest an alternative please?
    here is my code to create session:
    // if correct username and password entered then create session
    String financeAdminSess = adminUsername;
    session.setAttribute("financeAdminSess", adminUsername);                                        
    String redirectURL = "finance_admin_home.jsp";
    response.sendRedirect(redirectURL);
    and here is the code for loggin out:
    // get session
    String financeAdminSess=(String) session.getAttribute("financeAdminSess");
    // remove session
    session.removeAttribute("financeAdminSess<br />");
    // invalidate session
    session.invalidate();
    Any suggestion would be much appreciated.
    Thanks
    Shaxo

  • Invalidate session with specific sessionId

    Hi there,
    Is it possible to invalidate session with specific sessionId?
    Thanks.

    Hello,
    I have a system consisting of three different departments, each department has its own login page with different username and password.
    from the same browser, all three administrators can log in successfully, during there login, one session is created with different attributes for each of them, if any one administrator logs out, I invalidate the session, which logs out the other two administrators.
    Can I use session Id to log out on administrator while the other two can stay logs in?
    If I am using the wrong approach all together, can anyone suggest an alternative please?
    here is my code to create session:
    // if correct username and password entered then create session
    String financeAdminSess = adminUsername;
    session.setAttribute("financeAdminSess", adminUsername);                                        
    String redirectURL = "finance_admin_home.jsp";
    response.sendRedirect(redirectURL);
    and here is the code for loggin out:
    // get session
    String financeAdminSess=(String) session.getAttribute("financeAdminSess");
    // remove session
    session.removeAttribute("financeAdminSess<br />");
    // invalidate session
    session.invalidate();
    Any suggestion would be much appreciated.
    Thanks
    Shaxo

  • How do I use icloud to restore my documents that were in Pages? Pages got stuck in "waiting" to update and when nothing else worked I deleted it and reloaded Pages. I don't want to restore everything just my Pages documents.

    How do I use icloud to restore my documents that were in Pages? Pages got stuck in "waiting" to update and when nothing else worked I deleted it and reloaded Pages. Everything I can find is about wiping everything out and restoring everything. I don't want to restore everything just my Pages documents (and numbers and keynote that also locked up during updating).

    What I meant is turn off Documents and Data in iCloud in OS X. Keep it on on your iOS devices. iCloud will sync documents between the iOS devices and make them available on the iCloud web site, but it won't mess up iWorks' open and save dialog boxes. It also won't assume that you want all your documents in iCloud, which I think is undesirable anyway.
    Keep iOS and OS X separate, and use the web site to move files between the two as necessary.
    iOS iWork is different from OS X iWork. There are fewer fonts on an iOS device. iOS iWork programs have slightly different feature sets than OS X iWork programs, and the file formats are different. iCloud automatically converts the file format when necessary, but if you make a habit of saving things directly to iCloud, you are limited to the lowest common denominator between the two versions of iWorks. So why would anyone want iWork on the Mac to open and save documents on iCloud by default?
    If you want to store files in the cloud and sync them on your Macs, SugarSync is a much better solution. It lets you choose your sync folders, it doesn't make you reorganize your files, it lets you sync all file types, it doesn't convert files to a different format and back, and it stores everything in the cloud, too. Just the simle act of saving a file backs it up and syncs it. I wouldn't live without it. iCloud is best with iTunes purchases and synchronizing Mac settings and iOS files; I woudln't live without it. The two make an unbeatable combination.

  • Redirecting user to login page after session expiry

    Hi,
    Default session expiry implementation in sap EP6.0 doesn't work properly. To overcome this, we have implemented one component where we check the idle time and throw the user back to the login page if the idle time has exceeded the session expiry period. This component has been added to desktop inner page as an iView. Following is the logic put in this component.
    IAuthentication ia = UMFactory.getAuthenticator();
    ia.logout(httpRequest, httpResponse);
    httpResponse.sendRedirect("/irj/portal");
    We are successfully getting the login page after session expiry. Issue is, our portal server is running on 11111 port. We cannot change this to 80 on unix because of unix limitations for the port number. So we have put one apache web server before our portal server. Apache web server is listening on port 80 and forwarding the request to our portal server.
    Now when user is redirected to the login page, url being shown in the browser is http://<host_name>:11111/irj/portal but I am expecting http://<host_name>/irj/portal (without port). I have tried putting the full url in sendRedirect() method but that too doesn't work.
    Any help is highly appreciated.
    Regards,
    Chandra

    Hi Chandra,
    Let the URL be relative in the sendRedirect i.e.
    httpResponse.sendRedirect("/irj/portal");
    However since you have a Reverse proxy in front, the response header for redirect will not contain the address of the reverse proxy in this case, your servername without port. You have to properly configure your reverse proxy so that the HTTP Headers are changed properly before sending the response to the users.
    Check this URL,
    http://httpd.apache.org/docs/1.3/mod/mod_proxy.html#proxypassreverse
    This gives you the details on configuring your apache.
    Hope this helps.
    Ankur
    P.S. If this helps please reward points.

  • How do I get the following to the left of my  search bar: one page, X, reload page?

    how do I get the following to the left of my  search bar: <> one page, X, reload page?

    The reload page button is no longer an option in Safari—it's been integrated into the URL bar itself. For the other buttons, you can right-click (Control-click) on the toolbar, select "Customize Toolbar", and drag the buttons on to any part of the bar.

  • I couldn't find the "Reload Page" icon and went to "Customize" found it and moved it to the top tool bar but when I clicked "Done" it dissapeared. It won't stay visible. How can I keep it there for my use?

    I have V6 of Firefox and never had to worry about the "Reload Page" icon before so when I upgraded to V6 I was sorry to see that it was gone. Also the "Page Back" arrow isn't lit up and won't work. I have to go to the history and go back using that.. what happened to the back arrow? Now there are 2 clicks instead of one?
    I went to the "customize Toolbar" and moved the "reload Page" icon back to the top and it disappeared when I was done. How can I keep the "Reload Page" visible and useful?

    You see the orange (on Linux gray) Firefox button if the Menu Bar is hidden (View > Toolbars > Customize or right-click a toolbar).<br />
    If you need to access the hidden Menu bar then press F10 or hold down the Alt key to make the Menu Bar appear temporarily.<br />
    You only see the Bookmarks menu button if the Menu bar is hidden.

  • My reload page has disappeared

    for whatever reason in Firefox toolbar menu my reload page has disappeared and I'd like it back as I use it all the time for reloading pages on the U-tube

    I do not see a reload button anywhere. Frustrating.

  • Why is the "cancel loading" button not placeable right beside the "reload page" button?

    Hi Folks,
    I have a quite unusual issue with Nightly build 15.0a1 (x64) on Windows x64.
    I can not place the button to cancel loading a webpage right beside the reload page button - everywhere else it is possible to place it, but not at this specific location. If I do so, it becomes visible in the customize wizard but not in normal view. In normal view it is only visible when placed on other locations.

    Any particular reason why you are testing the unstable Nightly channel builds (which 15.0a1 just barely started on) ?.
    Also note that the Win64 builds are more experimental and not officially supported (no timetable for nay future release to have Win64 yet) so if there is a regression or a server for the daily builds goes down it may take a while fix due to lower priority compared to the officially supported Win32 builds. The Win32 builds should work anyways if not better anyways.

  • How do i move the reload page button in firefox OSX to beside the back button where it was before i updated.

    how do i move the reload page button in firefox OSX to beside the back button where it was before i updated.
    i know there is a classic theme addon for windows but i need a fix for osx...its very frustrating when you update and things like this change and cant be customized back to the way we are used to using the browser. its counter intuitive to have the refresh page button so far away from the back and home buttons.

    Is Classic Theme Restorer only for Windows? I thought it worked on Mac, too. Some of the pre-selected interface items like the Application Button may match old Windows versions and you may need to deselect those in its Settings dialog.
    To access that dialog, you can use the Add-ons page. Either:
    * Command+Shift+a
    * "3-bar" menu button (or Tools menu) > Add-ons
    In the left column, click Extensions, the on the right side, look for the Options button below Classic Theme Restorer.

  • [suggestion]: reload page icon at the beginning of the url bar

    Greetings all,
    I suggest to place the "reload page icon" at the beginning of the URL bar (and not at the end of it like done as far as Version 6.0 build 7536.25).
    This way seems more coherent (to me):
    * not far away with the other page control (close/reduce/iconize)
    * not far away of any action if needed to type something like a new URL
    my 2 cents,
    lem

    For the Search Bar:
    http://support.mozilla.com/en-US/kb/Back%20and%20forward%20or%20other%20toolbar%20items%20are%20missing#w_restoring-the-default-toolbar-set
    If you don't see the Search bar after you RESTORE the Default Toolbar Set:
    View > Toolbars > Customize and drag the SEARCH BAR to wherever you prefer.
    For Refresh Button:
    It has been incorporated into the far right end of the Address Bar. When you load a page, it is a "Stop" button, when it finished loading, it turns into a "Reload" button.
    If you want it to be somewhere else in the Toolbar, you can drag it out to wherever you want. If that doesn't work, try this:
    View > Toolbars > Customize and drag the Refresh/Stop icon into the window, then drag it back out to wherever you prefer.

  • Safari unwanted popups "Back, reload page, open in dashboard, etc..How to turn off?

    Using Safari 8.0 and OS X Yosemite,  repeated pop ups while scrolling with magic trackpad, - "Back, Reload Page, Open in Dashboard, etc.". and scrolling stopped. I have to hit esc to resume scrolling. How can I turn this off?

    Hi mikesy,
    Based on the description of the menu you are seeing, it sounds like you may be inadvertently activating the Safari right click menu. If this is incorrectly configured or too sensative, you should be able to change it in the Trackpad preferences; you may find the following articles helpful:
    OS X Yosemite: Right-click
    OS X Yosemite: Use an Apple Magic Trackpad
    Regards,
    - Brenden

  • Invalidate session in BlazeDS

    Hi!
    I need to integrate BlazeDS security with an external security mechanism so I have implemented custom authentication as described in http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content=services_security_1 .html. Now I need to invalidate user authentication on server upon certain circunstances. When this happens, I invalidate Session contained in Request parameter of invoke method of TomcatValve. This seems to work but I get a nasty "Duplicated Http Session" in Flex client telling that cookies where removed in server. Is there any clear way to invalidate current user login from BlazeDS?
    I've also tried invalidating FlexSession but then Flex clients hangs.
    Thank you very much.
    Daniel.

    Ummm - isn't that exactly what a session timeout specifies?
    ie how long should it stick around before it "expires" and should be invalidated?
    You don't need to call session.invalidate() - it will do that all by itself.

  • Refresh display image item without reload page

    hi all, is a way to refresh (requery) a display image item to change the image via botton and do not reload page ?
    thanks
    Edited by: Reza.Gh. on Sep 24, 2012 11:56 AM

    I create a sample app :
    https://apex.oracle.com/pls/apex/f?p=9310:1
    code of item  P1_CAPTCHA_IMG :
    SELECT captcha_img FROM captcha WHERE response = :P1_CAP_V;
    item P1_CAP_V  code (computations) :
    SELECT *
    FROM (
    SELECT response
    FROM captcha
    ORDER BY
    dbms_random.value
    WHERE rownum = 1 ;
    Refresh botton code :
    action 1 :
    SELECT * into :P1_CAP_V
    FROM (
    SELECT response
    FROM captcha
    ORDER BY
    dbms_random.value
    WHERE rownum = 1;
    action 2:
    refresh item P1_CAPTCHA_IMG

Maybe you are looking for