Logo Search packages:      
Sourcecode: fex version File versions  Download package

String [] fix::HttpClient::parseURL ( String  address  )  [inline]

Parses the given URL address and returns an array existing of: [0]: Protocol (http, https) [1]: Host-Address [2]: the Host-Port as a String [3]: the Requested File.

If the protocol is not http oder https a IllegalArgumentException will be thrown

Parameters:
address the URL address to be parsed
Returns:
String[] as described above

Definition at line 186 of file HttpClient.java.

References getPort(), and fix::ErrorWindow::setMess().

Referenced by connect(), and fix::Sender::send().

                                               {
            String[] response = new String[4];
            try {
                  URL url;
                  url = new URL(address);

                  response[0] = url.getProtocol();
                  response[1] = url.getHost();
                  response[2] = "" + url.getPort();
                  response[3] = url.getFile();

                  if (!response[0].equals("http") && !response[0].equals("https")) {
                        throw new IllegalArgumentException("Protocol must be http or https.");
                  }
                  if (Integer.parseInt(response[2]) == -1)
                        response[2] = "" + getPort(response[0]);
            } catch (MalformedURLException e) {
                  er.setMess("Malformed Server URL: " + address, e);
                  // System.out.println(address);
            }
            return response;
      }


Generated by  Doxygen 1.6.0   Back to index