use of org.xipki.http.servlet.HttpServlet in project xipki by xipki.
the class ServletListener method getServlet.
public Object[] getServlet(String rawPath) throws URISyntaxException {
String alias = null;
String uriText = null;
for (String m : aliases) {
if (m.equals("/")) {
alias = m;
uriText = rawPath;
break;
}
if (rawPath.startsWith(m)) {
int len = rawPath.length();
int mlen = m.length();
if (len == mlen) {
uriText = "/";
alias = m;
} else {
char ch = rawPath.charAt(mlen);
if (ch == '/') {
uriText = (len == mlen + 1) ? "/" : rawPath.substring(mlen);
alias = m;
} else if (ch == '?') {
uriText = rawPath.substring(mlen);
alias = m;
}
}
}
if (alias != null) {
break;
}
}
if (alias == null) {
return null;
}
ServletURI servletUri = ServletURIPool.getServletURI(uriText);
HttpServlet servlet = aliasServletMap.get(alias);
return new Object[] { servletUri, servlet };
}
Aggregations