ASF Bugzilla – Attachment 27194 Details for
Bug 51418
Allow more flexibility in adding webapps to org.apache.catalina.startup.Tomcat
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
A patch to Tomcat.java as described.
tc-config.patch (text/plain), 3.34 KB, created by
bmargulies
on 2011-06-22 15:54:00 UTC
(
hide
)
Description:
A patch to Tomcat.java as described.
Filename:
MIME Type:
Creator:
bmargulies
Created:
2011-06-22 15:54:00 UTC
Size:
3.34 KB
patch
obsolete
>Index: java/org/apache/catalina/startup/Tomcat.java >=================================================================== >--- java/org/apache/catalina/startup/Tomcat.java (revision 1138501) >+++ java/org/apache/catalina/startup/Tomcat.java (working copy) >@@ -83,6 +83,30 @@ > * use if you have a webapp with a web.xml file, but it is > * optional - you can use your own servlets. > * >+ * There are a variety of 'add' methods to configure servlets and webapps. These methods, by default, >+ * create a simple in-memory security realm and apply it. If you need more complex security processing, >+ * you can define a subclass of this class. >+ * >+ * This class provides a set of convenience methods for configuring webapp contexts, all overloads >+ * of the method <pre>addWebapp</pre>. These methods create a webapp context, configure it, >+ * and then add it to a {@link Host}. They do not use a global default web.xml; rather, they add a >+ * lifecycle listener that adds the standard DefaultServlet, JSP processing, and welcome files. >+ * >+ * In complex cases, you may prefer to use the ordinary Tomcat >+ * API to create webapp contexts; for example, you might need to install a custom Loader before >+ * the call to {@link Host#addChild(Container)}. To replicate the basic behavior of the <pre>addWebapp</pre> >+ * methods, you may want to call three methods of this class: {@link #getDefaultRealm()}, >+ * {@link #noDefaultWebXmlPath()}, and {@link #getDefaultWebXmlListener()}. >+ * >+ * {@link #getDefaultRealm()} returns the simple security realm. >+ * >+ * {@link #getDefaultWebXmlListener()} returns a {@link LifecycleListener} that adds the standard >+ * DefaultServlet, JSP processing, and welcome files. If you add this listener, you must prevent >+ * Tomcat from applying any standard global web.xml with ... >+ * >+ * {@link #noDefaultWebXmlPath()} returns a dummy pathname to configure to prevent {@link ContextConfig} >+ * from trying to apply a global web.xml file. >+ * > * This class provides a main() and few simple CLI arguments, > * see setters for doc. It can be used for simple tests and > * demo. >@@ -511,6 +535,37 @@ > > return ctx; > } >+ >+ /** >+ * Return a listener that provides the required configuration items for JSP processing. >+ * from the standard Tomcat global web.xml. Pass this to {@link Context#addLifecycleListener(LifecycleListener)} >+ * and then pass the result of {@link #noDefaultWebXmlPath()} to >+ * {@link ContextConfig#setDefaultWebXml(String)}. >+ * @return a listener object that configures default JSP processing. >+ */ >+ public LifecycleListener getDefaultWebXmlListener() { >+ return new DefaultWebXmlListener(); >+ } >+ >+ /** >+ * @return a pathname to pass to {@link ContextConfig#setDefaultWebXml(String)} when using >+ * {@link #getDefaultWebXmlListener()}. >+ */ >+ public String noDefaultWebXmlPath() { >+ return "org/apache/catalin/startup/NO_DEFAULT_XML"; >+ } >+ >+ /** >+ * For complex configurations, this accessor allows callers of this class >+ * to obtain the simple realm created by default. >+ * @return the simple in-memory realm created by default. >+ */ >+ public Realm getDefaultRealm() { >+ if (defaultRealm == null) { >+ initSimpleAuth(); >+ } >+ return defaultRealm; >+ } > > > // ---------- Helper methods and classes -------------------
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 51418
: 27194