@Override
public void install(final Environment environment, final HttpServlet instance) {
final Class<? extends HttpServlet> extType = FeatureUtils.getInstanceClass(instance);
final WebServlet annotation = FeatureUtils.getAnnotation(extType, WebServlet.class);
final String[] patterns = annotation.urlPatterns().length > 0 ? annotation.urlPatterns() : annotation.value();
Preconditions.checkArgument(patterns.length > 0,
"Servlet %s not specified url pattern for mapping", extType.getName());
final AdminContext context = FeatureUtils.getAnnotation(extType, AdminContext.class);
final String name = WebUtils.getServletName(annotation, extType);
reporter.line("%-15s %-5s %-2s (%s) %s", Joiner.on(",").join(patterns),
WebUtils.getAsyncMarker(annotation), WebUtils.getContextMarkers(context), extType.getName(), name);
if (WebUtils.isForMain(context)) {
configure(environment.servlets(), instance, extType, name, annotation);
}
if (WebUtils.isForAdmin(context)) {
configure(environment.admin(), instance, extType, name, annotation);
}
}
WebServletInstaller.java 文件源码
java
阅读 37
收藏 0
点赞 0
评论 0
项目:dropwizard-guicey
作者:
评论列表
文章目录