views:

171

answers:

1

Hi Guys,

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 scrapper 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?

Thanks!!

+1  A: 

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.

Nayan Wadekar