use of com.ibm.designer.runtime.domino.adapter.ServletMatch in project org.openntf.xsp.jakartaee by OpenNTF.
the class ServletServletFactory method getServletMatch.
@Override
public final ServletMatch getServletMatch(String contextPath, String path) throws javax.servlet.ServletException {
try {
if (LibraryUtil.usesLibrary(ServletLibrary.LIBRARY_ID, module)) {
for (Map.Entry<WebServlet, Class<? extends Servlet>> entry : getModuleServlets().entrySet()) {
String match = matches(entry.getKey(), path);
if (match != null) {
javax.servlet.Servlet servlet = getExecutorServlet(entry.getKey(), entry.getValue());
String pathInfo = findPathInfo(path, match);
int pathInfoLen = pathInfo == null ? 0 : pathInfo.length();
return new ServletMatch(servlet, path.substring(0, path.length() - pathInfoLen), pathInfo);
}
}
}
} catch (UncheckedIOException e) {
throw new javax.servlet.ServletException(e);
}
return null;
}
use of com.ibm.designer.runtime.domino.adapter.ServletMatch in project org.openntf.xsp.jakartaee by OpenNTF.
the class OldServletContextWrapper method getRequestDispatcher.
@Override
public RequestDispatcher getRequestDispatcher(String path) {
// Unsupported on Domino, so try to replicate the behavior from the ComponentModule
ServletMatch match = getServletFactories().stream().map(f -> {
try {
return f.getServletMatch(getContextPath(), path);
} catch (javax.servlet.ServletException e) {
throw new RuntimeException(e);
}
}).filter(Objects::nonNull).findFirst().orElse(null);
if (match != null) {
// TODO figure out if this behavior should change
return new RequestDispatcher() {
@Override
public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
Servlet servlet = ServletUtil.oldToNew(match.getServlet());
servlet.service(request, response);
}
@Override
public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
Servlet servlet = ServletUtil.oldToNew(match.getServlet());
servlet.service(request, response);
}
};
}
return null;
}
use of com.ibm.designer.runtime.domino.adapter.ServletMatch in project org.openntf.xsp.jakartaee by OpenNTF.
the class MappingBasedServletFactory method getServletMatch.
@Override
public final ServletMatch getServletMatch(String contextPath, String path) throws ServletException {
try {
String lib = getLibraryId();
if (StringUtil.isEmpty(lib) || LibraryUtil.usesLibrary(lib, module)) {
for (String ext : getExtensions()) {
int extIndex = StringUtil.toString(path).indexOf(ext);
if (extIndex > -1) {
String servletPath = path.substring(0, extIndex + ext.length());
String pathInfo = path.substring(extIndex + ext.length());
return new ServletMatch(getExecutorServlet(), servletPath, pathInfo);
}
}
}
} catch (UncheckedIOException e) {
throw new ServletException(e);
}
return null;
}
Aggregations