Hi everybody,

I have a problem with redirects in Tomcat 5.5.25. I am doing a Lucene
search and would like to send a redirect after finding the top 25 hits,
commit this response, and then continue processing the remaining hits.
The relevant parts of the doPost() code are as below:

final int PARTIAL_HITS = 25;

for (int i = 0; i < hits.length(); i++) {

  Document doc = hits.doc(i);
  String citation = doc.get("citation");

  /** Insert into table */
  try {
    insertId.setInt(1, java.lang.Integer.parseInt(citation));
    insertId.executeUpdate();
  }
  catch (SQLException e) {
    out.sendError(500, "Bad SQL insert: " + e);
  }
  catch (Exception e) {}

  if (i == PARTIAL_HITS) {
    // Intermittant redirect
    out.sendRedirect(resultUrl);
  }
}

insertId.close();

if (!out.isCommitted()) {
  // Final redirect
  out.sendRedirect(resultUrl);
}

My problem is that the intermittant redirect is not committed until the
function returns, which will take quite some time for some queries. I
have tried HttpServletResponse.flushBuffer() and other possible
variations. Any pointers would be most appreciated.

Tore
_______________________________________________________________
Tore Eriksson [tore.eriksson ad po.rd.taisho.co.jp]



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to