use of org.nutz.boot.starter.WebFilterFace in project nutzboot by nutzam.
the class TomcatStarter method addNutzSupport.
private void addNutzSupport() {
List<WebFilterFace> filters = appContext.getBeans(WebFilterFace.class);
Collections.sort(filters, Comparator.comparing(WebFilterFace::getOrder));
filters.forEach((face) -> addFilter(face));
appContext.getBeans(WebServletFace.class).forEach((face) -> {
if (face.getServlet() == null) {
return;
}
addServlet(face);
});
appContext.getBeans(WebEventListenerFace.class).forEach((face) -> {
EventListener listener = face.getEventListener();
if (listener != null) {
if ((listener instanceof ServletContextAttributeListener) || (listener instanceof ServletRequestAttributeListener) || (listener instanceof ServletRequestListener) || (listener instanceof HttpSessionIdListener) || (listener instanceof HttpSessionAttributeListener)) {
this.tomcatContext.addApplicationEventListener(listener);
}
if ((listener instanceof ServletContextListener) || (listener instanceof HttpSessionListener)) {
this.tomcatContext.addApplicationLifecycleListener(listener);
}
}
});
}
use of org.nutz.boot.starter.WebFilterFace in project nutzboot by nutzam.
the class JettyStarter method addNutzSupport.
private void addNutzSupport() {
List<WebFilterFace> filters = appContext.getBeans(WebFilterFace.class);
Collections.sort(filters, Comparator.comparing(WebFilterFace::getOrder));
filters.forEach((face) -> addFilter(face));
appContext.getBeans(WebServletFace.class).forEach((face) -> {
if (face.getServlet() == null) {
return;
}
ServletHolder holder = new ServletHolder(face.getServlet());
holder.setName(face.getName());
holder.setInitParameters(face.getInitParameters());
wac.addServlet(holder, face.getPathSpec());
});
appContext.getBeans(WebEventListenerFace.class).forEach((face) -> {
if (face.getEventListener() != null) {
wac.addEventListener(face.getEventListener());
}
});
}
Aggregations