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 8139113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:43:02+00:00 2026-06-06T11:43:02+00:00

I am writing a web application that takes a script input from a client-side

  • 0

I am writing a web application that takes a script input from a client-side browser and sends it to a Java servlet through AJAX. Upon receiving the script, the Java class executes the script and sends some information back to the web page.

An important component of the web application that I am testing right now is the connection timeout and when/if a browser connection will timeout after long periods of time. For me, it is important that the connection does NOT timeout before the Java servlet sends a response, or at least the timeout should be handled.

I have researched ways of handling this and I have a vague understanding of what needs to be done, but first thing is first, I decided to try to get the connection to timeout in order to understand how everything will behave WITHOUT any sort of error handling. Yesterday, I sent the servlet a command from the script input of the client-side which told the servlet to sleep until this morning. I come back this morning to find that in Chrome, the servlet response was successfully received and happily showing itself in the browser.

In IE7, I did not have as much luck 🙁

After over 15 hours of waiting on a response, IE7 timed out and Chrome did not. I figured either both would time out or neither would.

Also, it might be helpful to know that I am using Struts2 framework.

Can anyone explain this?

Thanks!

P.S. I tried to be as detailed as I could in my question explanation, but I will be happy to include any extra information. I also did not include code, because I did not think any would be relevant, but again, please tell me what code you’d want me to include if you’d like to see some.

  • 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-06T11:43:03+00:00Added an answer on June 6, 2026 at 11:43 am

    Turns out that Chrome is just awesome and IE is not (surprise!). Here’s what I am pretty sure happened:

    On the ajax call, since no timeout was set, Chrome let the timeout default to 0 i.e. never timeout.

    IE7 being the obnoxious browser that it is (and unfortunately the one I MUST develop for), didn’t want that to happen, so it stuck with its registry-set default timeout of 60 minutes.

    JQuery and AJAX made handling this error a breeze with a bit of longpolling, or at least what I understand to be longpolling. Here’s what I did:

    Initial AJAX Request (contained in a function):

    $.ajax({
    
                beforeSend: function() {
    
                    inUse = true;
                    disableInput();
    
                },
    
                url: "executeScript.do",
                data: params,
                dataType: "text",
                type: "post",
                success: function(responseText) {
    
                    onSuccess(responseText);
    
                },
                error: function(jqXHR, textStatus, errorThrown) {
                    if(textStatus == "timeout") {
                        pollServlet();
                    }               
                }
            });
    ...
    

    Longpolling(?)

    function pollServlet() {
    
    var params = "testID=" + document.getElementById("testIDValue").value;
    
    $.ajax({
        url: "servletQuery.do",
        dataType: "text",
        type: "post",
        data: params,
        success: function(response) {
    
            if(!isNaN(parseInt(response, 10))) {
                setTimeout(pollServlet, parseInt(response, 10));
            } else {
                onSuccess(response);
            }
        }
    });
    

    }

    This works! One thing I noticed, however, is IE7 returns a textStatus of “error” on a timeout instead of “timeout”… odd!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a GUI application that regularly retrieves data through a web connection. Since
I am writing a web application with django on the server side. It takes
I am writing a web application in ASP.NET 3.5 that takes care of some
I'm writing a web application in Django that is accessed from multiple domains to
I am writing a web application that allows a user to get an employee's
I'm currently writing a web application that have about 6-12 pages. On each one
I'm writing a web application that involves a continuous cycle of creating (and removing)
I am writing a web application that uses a JSP usebean tag in the
Suppose you are tasked with writing a web application that must store configuration information
I'm writing a web based application that will have its own authorization/authentication mechanism (traditional

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.