601 if (dateString.indexOf("GMT") == -1) { 602 dateString = dateString+" GMT"; 603 } 604 return Date.parse(dateString); 605 } catch (Exception e) { 606 } 607 return Default; 608 } 609 610 611 /** 612 * Indicates that other requests to the server 613 * are unlikely in the near future. Calling disconnect() 614 * should not imply that this HttpURLConnection 615 * instance can be reused for other requests. 616 */ 617 public abstract void disconnect(); 618 619 /** 620 * Indicates if the connection is going through a proxy. 621 * @return a boolean indicating if the connection is 622 * using a proxy. 623 */ 624 public abstract boolean usingProxy(); 625 626 /** 627 * Returns a {@link SocketPermission} object representing the 628 * permission necessary to connect to the destination host and port. 629 * 630 * @throws IOException if an error occurs while computing 631 * the permission. 632 * 633 * @return a {@code SocketPermission} object representing the 634 * permission necessary to connect to the destination 635 * host and port. 636 */ 637 public Permission getPermission() throws IOException { 638 int port = url.getPort(); 639 port = port < 0 ? 80 : port; 640 String host = url.getHost() + ":" + port; 641 Permission permission = new SocketPermission(host, "connect"); 642 return permission; | 601 if (dateString.indexOf("GMT") == -1) { 602 dateString = dateString+" GMT"; 603 } 604 return Date.parse(dateString); 605 } catch (Exception e) { 606 } 607 return Default; 608 } 609 610 611 /** 612 * Indicates that other requests to the server 613 * are unlikely in the near future. Calling disconnect() 614 * should not imply that this HttpURLConnection 615 * instance can be reused for other requests. 616 */ 617 public abstract void disconnect(); 618 619 /** 620 * Indicates if the connection is going through a proxy. 621 * 622 * This method returns {@code true} if the connection is known 623 * to be going or has gone through proxies, and returns {@code false} 624 * if the connection will never go through a proxy or if 625 * the use of a proxy cannot be determined. 626 * 627 * @return a boolean indicating if the connection is using a proxy. 628 */ 629 public abstract boolean usingProxy(); 630 631 /** 632 * Returns a {@link SocketPermission} object representing the 633 * permission necessary to connect to the destination host and port. 634 * 635 * @throws IOException if an error occurs while computing 636 * the permission. 637 * 638 * @return a {@code SocketPermission} object representing the 639 * permission necessary to connect to the destination 640 * host and port. 641 */ 642 public Permission getPermission() throws IOException { 643 int port = url.getPort(); 644 port = port < 0 ? 80 : port; 645 String host = url.getHost() + ":" + port; 646 Permission permission = new SocketPermission(host, "connect"); 647 return permission; |