开发者

icefaces modal popup timeout issue

开发者 https://www.devze.com 2022-12-31 07:26 出处:网络
Have a question regarding something which has been bugging me for some time now.I\'m using icefaces to generate a modal popup with search fields.Clicking search kicks off a screen scraper for a partic

Have a question regarding something which has been bugging me for some time now.I'm using icefaces to generate a modal popup with search fields.Clicking search kicks off a screen scraper for a particular website.

My problem is this.If you enter some pretty generic terms,obviously the scraper will take longer to complete which causes a timeout.The timeout causes the modal popup to freeze and it can't be closed.

How can I gracefully close the popup and navigate to another page if a 开发者_开发技巧timeout occurs?


You can create a thread, start it & make it to sleep the amount of time that is session max timeout interval.

You can then redirect to another resource after thread resumes as follows:

@Thread's run method

//...
    try {
            Thread.currentThread().sleep(TIMEOUT_INTERVAL);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        URL url = new URL("REDIRECT_PAGE");
        url.openConnection();

//...

But if your search process completes prior to timeout interval, you can kill the thread.

0

精彩评论

暂无评论...
验证码 换一张
取 消