464 |
connect(); |
connect(); |
465 |
|
|
466 |
gotResponseVals = true; |
gotResponseVals = true; |
|
// Response is the first header received from the connection. |
|
|
String respField = getHeaderField(0); |
|
|
|
|
|
if (respField == null || ! respField.startsWith("HTTP/")) |
|
|
{ |
|
|
// Set to default values on failure. |
|
|
responseCode = -1; |
|
|
responseMessage = null; |
|
|
return; |
|
|
} |
|
467 |
|
|
468 |
int firstSpc, nextSpc; |
// If responseCode not yet explicitly set by subclass |
469 |
firstSpc = respField.indexOf(' '); |
if (responseCode == -1) |
|
nextSpc = respField.indexOf(' ', firstSpc + 1); |
|
|
responseMessage = respField.substring(nextSpc + 1); |
|
|
String codeStr = respField.substring(firstSpc + 1, nextSpc); |
|
|
try |
|
470 |
{ |
{ |
471 |
responseCode = Integer.parseInt(codeStr); |
// Response is the first header received from the connection. |
472 |
} |
String respField = getHeaderField(0); |
473 |
catch (NumberFormatException e) |
|
474 |
{ |
if (respField == null || ! respField.startsWith("HTTP/")) |
475 |
// Set to default values on failure. |
{ |
476 |
responseCode = -1; |
// Set to default values on failure. |
477 |
responseMessage = null; |
responseCode = -1; |
478 |
|
responseMessage = null; |
479 |
|
return; |
480 |
|
} |
481 |
|
|
482 |
|
int firstSpc, nextSpc; |
483 |
|
firstSpc = respField.indexOf(' '); |
484 |
|
nextSpc = respField.indexOf(' ', firstSpc + 1); |
485 |
|
responseMessage = respField.substring(nextSpc + 1); |
486 |
|
String codeStr = respField.substring(firstSpc + 1, nextSpc); |
487 |
|
try |
488 |
|
{ |
489 |
|
responseCode = Integer.parseInt(codeStr); |
490 |
|
} |
491 |
|
catch (NumberFormatException e) |
492 |
|
{ |
493 |
|
// Set to default values on failure. |
494 |
|
responseCode = -1; |
495 |
|
responseMessage = null; |
496 |
|
} |
497 |
} |
} |
498 |
} |
} |
499 |
|
|