protocol = uri.substring(position, cnt);
Matcher m = p.matcher(protocol);
if (!m.find()) {
throw new ServletParseException("URI does not conform to BNF :" + protocol);
}
if (protocol.equals(SIP_URI_PROTOCOL)) {
return new SipURIImpl(SIP_URI_PROTOCOL, uri, cnt + 1);
}
if (protocol.equals(TEL_URI_PROTOCOL)) {
return new TelURLImpl(uri, cnt + 1);
}
if (protocol.equals(SIPS_URI_PROTOCOL)) {
return new SipURIImpl(SIPS_URI_PROTOCOL, uri, cnt + 1);
}
//JSR 289 SipFactory.createURI says, implementation should be able
//to handle any scheme. So, create a GeneralURIImpl.
return new GeneralURIImpl(protocol, uri, cnt + 1);
} catch (Throwable t) {
throw new ServletParseException(t);
}
}