コード例 #1
0
ファイル: ClientApplet.java プロジェクト: nixz/covise
  public void init() {
    is_master = false;
    dyn_usr = 0;
    dyn_view = 0;
    id = (int) System.currentTimeMillis();

    ClientApplet.client_applet = this;

    appletContext = getAppletContext();

    hostsrv = getParameter("HOSTSRV");

    String http_portString = getParameter("HTTP_PORT");
    if (http_portString != null) {
      try {
        Integer port = Integer.valueOf(http_portString);
        http_port = port.intValue();
      } catch (NumberFormatException e) {
        http_port = 50000;
      }
    }

    URL applet_url = this.getCodeBase();

    String host = applet_url.getHost();
    if (host != null) hostsrv = host;

    int port = applet_url.getPort();
    if (port > 0) http_port = port;

    user_interface = new UserInterface();
    user_interface.init();
  }
コード例 #2
0
ファイル: URIArg.java プロジェクト: tedvals/fleetmng
 /**
  * ** Gets the 'host' specification in the URI ** @return The 'host' specification in the URL, or
  * null if unable to determine host
  */
 public String getHost() {
   try {
     URL url = new URL(this.getURI());
     return url.getHost();
   } catch (MalformedURLException mue) {
     return null;
   }
 }
コード例 #3
0
ファイル: BorwserDemo.java プロジェクト: XingRay/Java
  void showContent() {
    URL address = null;

    try {
      address = new URL(addressTextField.getText());
    } catch (MalformedURLException mue) {
      showWarning(mainFrame, "地址输入错误");
    }

    System.out.println("getProtocol() " + address.getProtocol());
    System.out.println("getHost() " + address.getHost());
    System.out.println("getPort() " + address.getPort());
    System.out.println("getPath() " + address.getPath());
    System.out.println("getFile() " + address.getFile());
    System.out.println("getQuery() " + address.getQuery());
  }
コード例 #4
0
ファイル: URIArg.java プロジェクト: tedvals/fleetmng
 /** ** Sets the 'port' */
 public boolean setPort(int _port) {
   String uri = this.getURI();
   if ((_port > 0) && URIArg.isAbsoluteURL(uri)) {
     try {
       URL oldURI = new URL(uri);
       String proto = oldURI.getProtocol();
       String host = oldURI.getHost();
       int port = _port;
       String file = oldURI.getFile();
       URL newURI = new URL(proto, host, port, file);
       this._setURI(newURI.toString());
       return true;
     } catch (MalformedURLException mue) {
       // error
     }
   }
   return false;
 }