Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8114259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:05:55+00:00 2026-06-06T03:05:55+00:00

I have some download implementation which allows me to export all data from a

  • 0

I have some download implementation which allows me to export all data from a dataTable. When a lot of data is being exported, the user must not press anywhere in the application, because the current export process is getting aborted then and it would crash with some exceptions like “EJB Invocation failed on component…..” or “Could not find XyzBean”.

So my idea is to forbid button presses as long as the download process is in progress. I thought about using a PhaseListener but I’m not sure how to intercept request? The awaited behaviour should be that nothing happens in the GUI when user presses anywhere as long as the download process is in progress. I could set a variable when download has been started and unset it when download has been finished. So I know when to block, but I’m not sure how this blocking could look like. Any ideas?

I’m using JBoss 7.1.1 with RichFaces 4.2.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:05:57+00:00Added an answer on June 6, 2026 at 3:05 am

    This solution causes a latch for all buttons in the view, so if a download is in progress and I press any buttons, this request will be discarded. This basically works but I still have some crashes with , but I think this is related to another problem.

    In my download method at the beginning I add a flag to the current session:

    HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false);
    session.setAttribute("DOWNLOAD_IN_PROGRESS", "true");
    

    At the end of the download method I set this flag to false…

    session.setAttribute("DOWNLOAD_IN_PROGRESS", "false");
    

    In a phase listener (which has been added to faces-config) I check if there is currently a download in progress. If so, discard the request.

    @Named
    @Logged
    public class DownloadLatchPhaseListener implements PhaseListener
    {
        private static final long serialVersionUID = -8603272654541248512L;
    
        @Override
        public void beforePhase(PhaseEvent event)
        {
            HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
    
            if (session != null && "true".equals(session.getAttribute("DOWNLOAD_IN_PROGRESS")))
            {
                FacesContext.getCurrentInstance().responseComplete();
            }
        }
    
        @Override
        public void afterPhase(PhaseEvent event)
        {
            // not used
        }
    
        @Override
        public PhaseId getPhaseId()
        {
            return PhaseId.RESTORE_VIEW;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a singleton class to download some data from the web. I am
I have some code that downloads an image from a remote server $data =
I have this content script that downloads some binary data using XHR, which is
I have some code to download a text file from a website. When the
I have to download some files from an FTP server. Seems prosaic enough. However,
I have some files in a directory tree which is being served over HTTP.
I have a custom implementation of the Map interface which does some fancy stuff,
My goal is to have the user be able to download some information currently
In my application I download some xml data file from some information center, add
I have some spider that download pages and store data in database. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.