class FilterEngine {
private String[] urlParts(URL url) {
Vector parts = new Vector(8);
// The protocol is always the first part:
parts.addElement(url.getProtocol());
// Then comes the host:port identifier (we deal *only* with http):
if ((url.getPort() == -1) || (url.getPort() == 80))
parts.addElement(url.getHost());
else
parts.addElement(url.getHost()+":"+url.getPort());
// And last but not least, the parsed path (really not efficient !)
StringTokenizer st = new StringTokenizer(url.getFile(), "/");
while ( st.hasMoreTokens() )
parts.addElement(st.nextElement());
// Build the vector into an array:
String p[] = new String[parts.size()];
parts.copyInto(p);
return p;
}
}