Code with Finding: |
class HttpBasicServer {
protected Reply http11_ts_run(HttpBasicConnection conn, Request request)
throws IOException, MimeParserException
{
if ( debug )
System.out.println(conn+": runs[11ts] "+request.getURL());
RequestObserver o = request.getObserver();
OutputStream os = conn.getOutputStream();
MimeParser p = conn.getParser();
Reply reply = null;
try {
request.emit(os, Request.EMIT_HEADERS);
os.flush();
if ( o != null )
notifyObserver(o, new ConnectedEvent(this, request, os));
reply = (Reply) p.parse();
} catch (IOException ex) {
// Ok, we should give it another chance:
return null;
} catch (MimeParserException ex) {
// Ok, we should give it another chance:
return null;
}
while ((reply.getStatus() / 100) == 1 ||
reply.getStatus() == HTTP.EXPECTATION_FAILED) {
if (reply.getStatus() == HTTP.EXPECTATION_FAILED)
return reply; // FIXME observer?
// Notify the observer if any:
if ( o != null ) {
notifyObserver(o, new ContinueEvent(this, request, reply));
}
// Finish the request normally:
request.emit(os, Request.EMIT_BODY|Request.EMIT_FOOTERS);
os.flush();
reply = (Reply) p.parse();
// if we don't have any observer, we should eat the 100 continue!
if ( o == null) {
while ((reply.getStatus() / 100) == 1 ) {
reply = (Reply) p.parse();
}
}
}
return reply;
}
}
|