447 }
448
449 /**
450 * Gets the HTTP response message, if any, returned along with the
451 * response code from a server. From responses like:
452 * <PRE>
453 * HTTP/1.0 200 OK
454 * HTTP/1.0 404 Not Found
455 * </PRE>
456 * Extracts the Strings "OK" and "Not Found" respectively.
457 * Returns null if none could be discerned from the responses
458 * (the result was not valid HTTP).
459 * @throws IOException if an error occurred connecting to the server.
460 * @return the HTTP response message, or <code>null</code>
461 */
462 public String getResponseMessage() throws IOException {
463 getResponseCode();
464 return responseMessage;
465 }
466
467 public long getHeaderFieldDate(String name, long Default) {
468 String dateString = getHeaderField(name);
469 try {
470 if (dateString.indexOf("GMT") == -1) {
471 dateString = dateString+" GMT";
472 }
473 return Date.parse(dateString);
474 } catch (Exception e) {
475 }
476 return Default;
477 }
478
479
480 /**
481 * Indicates that other requests to the server
482 * are unlikely in the near future. Calling disconnect()
483 * should not imply that this HttpURLConnection
484 * instance can be reused for other requests.
485 */
486 public abstract void disconnect();
|
447 }
448
449 /**
450 * Gets the HTTP response message, if any, returned along with the
451 * response code from a server. From responses like:
452 * <PRE>
453 * HTTP/1.0 200 OK
454 * HTTP/1.0 404 Not Found
455 * </PRE>
456 * Extracts the Strings "OK" and "Not Found" respectively.
457 * Returns null if none could be discerned from the responses
458 * (the result was not valid HTTP).
459 * @throws IOException if an error occurred connecting to the server.
460 * @return the HTTP response message, or <code>null</code>
461 */
462 public String getResponseMessage() throws IOException {
463 getResponseCode();
464 return responseMessage;
465 }
466
467 @SuppressWarnings("deprecation")
468 public long getHeaderFieldDate(String name, long Default) {
469 String dateString = getHeaderField(name);
470 try {
471 if (dateString.indexOf("GMT") == -1) {
472 dateString = dateString+" GMT";
473 }
474 return Date.parse(dateString);
475 } catch (Exception e) {
476 }
477 return Default;
478 }
479
480
481 /**
482 * Indicates that other requests to the server
483 * are unlikely in the near future. Calling disconnect()
484 * should not imply that this HttpURLConnection
485 * instance can be reused for other requests.
486 */
487 public abstract void disconnect();
|