org.apache.catalina.startup.Tomcat.getDefaultWebXmlListener()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(317)

本文整理了Java中org.apache.catalina.startup.Tomcat.getDefaultWebXmlListener()方法的一些代码示例,展示了Tomcat.getDefaultWebXmlListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tomcat.getDefaultWebXmlListener()方法的具体详情如下:
包路径:org.apache.catalina.startup.Tomcat
类名称:Tomcat
方法名:getDefaultWebXmlListener

Tomcat.getDefaultWebXmlListener介绍

[英]Return a listener that provides the required configuration items for JSP processing. From the standard Tomcat global web.xml. Pass this to Context#addLifecycleListener(LifecycleListener) and then pass the result of #noDefaultWebXmlPath() to ContextConfig#setDefaultWebXml(String).
[中]返回一个提供JSP处理所需配置项的侦听器。来自标准的Tomcat全球网络。xml。将其传递给Context#addLifecycleListener(LifecycleListener),然后将#noDefaultWebXmlPath()的结果传递给ContextConfig#setDefaultWebXml(字符串)。

代码示例

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

  1. /**
  2. * @param host The host in which the context will be deployed
  3. * @param contextPath The context mapping to use, "" for root context.
  4. * @param docBase Base directory for the context, for static files.
  5. * Must exist, relative to the server home
  6. * @param config Custom context configurator helper
  7. * @return the deployed context
  8. * @see #addWebapp(String, String)
  9. */
  10. public Context addWebapp(Host host, String contextPath, String docBase,
  11. LifecycleListener config) {
  12. silence(host, contextPath);
  13. Context ctx = createContext(host, contextPath);
  14. ctx.setPath(contextPath);
  15. ctx.setDocBase(docBase);
  16. if (addDefaultWebXmlToWebapp)
  17. ctx.addLifecycleListener(getDefaultWebXmlListener());
  18. ctx.setConfigFile(getWebappConfigFile(docBase, contextPath));
  19. ctx.addLifecycleListener(config);
  20. if (addDefaultWebXmlToWebapp && (config instanceof ContextConfig)) {
  21. // prevent it from looking ( if it finds one - it'll have dup error )
  22. ((ContextConfig) config).setDefaultWebXml(noDefaultWebXmlPath());
  23. }
  24. if (host == null) {
  25. getHost().addChild(ctx);
  26. } else {
  27. host.addChild(ctx);
  28. }
  29. return ctx;
  30. }

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

  1. /**
  2. * @param host The host in which the context will be deployed
  3. * @param contextPath The context mapping to use, "" for root context.
  4. * @param docBase Base directory for the context, for static files.
  5. * Must exist, relative to the server home
  6. * @param config Custom context configurator helper
  7. * @return the deployed context
  8. * @see #addWebapp(String, String)
  9. */
  10. public Context addWebapp(Host host, String contextPath, String docBase,
  11. LifecycleListener config) {
  12. silence(host, contextPath);
  13. Context ctx = createContext(host, contextPath);
  14. ctx.setPath(contextPath);
  15. ctx.setDocBase(docBase);
  16. ctx.addLifecycleListener(getDefaultWebXmlListener());
  17. ctx.setConfigFile(getWebappConfigFile(docBase, contextPath));
  18. ctx.addLifecycleListener(config);
  19. if (config instanceof ContextConfig) {
  20. // prevent it from looking ( if it finds one - it'll have dup error )
  21. ((ContextConfig) config).setDefaultWebXml(noDefaultWebXmlPath());
  22. }
  23. if (host == null) {
  24. getHost().addChild(ctx);
  25. } else {
  26. host.addChild(ctx);
  27. }
  28. return ctx;
  29. }

相关文章