/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Extract components of an "iiop" or "iiopname" URL.
*
* The format of an iiopname URL is defined in INS 98-10-11 as follows:
*
* iiopname url = "iiopname://" [addr_list]["/" string_name]
* addr_list = [address ","]* address
* address = [version host [":" port]]
* host = DNS style host name | IP address
* version = major "." minor "@" | empty_string
* port = number
* major = number
* minor = number
* string_name = stringified name | empty_string
*
* The default port is 9999. The default version is "1.0"
* US-ASCII alphanumeric characters are not escaped. Any characters outside
* of this range are escaped except for the following:
* ; / : ? : @ & = + $ , - _ . ! ~ * ' ( )
* Escaped characters is escaped by using a % followed by its 2 hexadecimal
* numbers representing the octet.
*
* For backward compatibility, the "iiop" URL as defined in INS 97-6-6
* is also supported:
*
* iiop url = "iiop://" [host [":" port]] ["/" string_name]
* The default port is 900.
*
* @author Rosanna Lee
*/
public final class IiopUrl {
public static class Address {
throws MalformedURLException {
// [version host [":" port]]
int start;
// Parse version
int at;
major = 1;
minor = 0;
} else {
if (dot < 0) {
throw new MalformedURLException(
"invalid version: " + hostPortVers);
}
try {
} catch (NumberFormatException e) {
throw new MalformedURLException(
"Nonnumeric version: " + hostPortVers);
}
}
// Parse host and port
if (slash < 0) {
}
throw new IllegalArgumentException(
"IiopURL: name is an Invalid URL: " + hostPortVers);
}
// include brackets
} else { // at hostname or IPv4
? slash
: colon;
}
}
start++; // skip past ":"
} else {
throw new IllegalArgumentException(
"IiopURL: name is an Invalid URL: " + hostPortVers);
}
}
host = DEFAULT_HOST ;
}
if (port == -1) {
}
}
}
return addresses;
}
/**
* Returns a possibly empty but non-null string that is the "string_name"
* portion of the URL.
*/
return stringName;
}
}
int addrStart;
boolean oldFormat;
oldFormat = false;
addrStart = 11;
oldFormat = true;
addrStart = 7;
} else {
}
if (addrEnd < 0) {
stringName = "";
} else {
}
if (oldFormat) {
// Only one host:port part, not multiple
} else {
while (tokens.hasMoreTokens()) {
}
}
}
}
// for testing only
/*public static void main(String[] args) {
try {
IiopUrl url = new IiopUrl(args[0]);
Vector addrs = url.getAddresses();
String name = url.getStringName();
for (int i = 0; i < addrs.size(); i++) {
Address addr = (Address)addrs.elementAt(i);
System.out.println("host: " + addr.host);
System.out.println("port: " + addr.port);
System.out.println("version: " + addr.major + " " + addr.minor);
}
System.out.println("name: " + name);
} catch (MalformedURLException e) {
e.printStackTrace();
}
} */
}