5
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
6
* (the "License"); you may not use this file except in compliance with
7
7
* the License. You may obtain a copy of the License at
9
9
* http://www.apache.org/licenses/LICENSE-2.0
11
11
* Unless required by applicable law or agreed to in writing, software
12
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
101
101
import org.apache.naming.resources.FileDirContext;
102
102
import org.apache.naming.resources.ProxyDirContext;
103
103
import org.apache.naming.resources.WARDirContext;
104
import org.apache.tomcat.util.descriptor.XmlIdentifiers;
104
105
import org.apache.tomcat.util.modeler.Registry;
111
112
* @author Craig R. McClanahan
112
113
* @author Remy Maucherat
113
* @version $Id: StandardContext.java 1080224 2011-03-10 13:52:41Z markt $
114
* @version $Id: StandardContext.java 1561795 2014-01-27 19:03:54Z markt $
116
117
public class StandardContext
192
193
private boolean antiJARLocking = false;
196
197
* The antiResourceLocking flag for this Context.
198
199
private boolean antiResourceLocking = false;
202
203
* The set of application listener class names configured for this
203
204
* application, in the order they were encountered in the web.xml file.
205
206
private String applicationListeners[] = new String[0];
207
208
private final Object applicationListenersLock = new Object();
211
212
* The set of instantiated application event listener objects</code>.
213
private transient Object applicationEventListenersObjects[] =
214
private transient Object applicationEventListenersObjects[] =
218
219
* The set of instantiated application lifecycle listener objects</code>.
220
private transient Object applicationLifecycleListenersObjects[] =
221
private transient Object applicationLifecycleListenersObjects[] =
228
229
new ApplicationParameter[0];
230
231
private final Object applicationParametersLock = new Object();
234
235
* The application available flag for this Context.
236
237
private boolean available = false;
239
* The broadcaster that sends j2ee notifications.
240
* The broadcaster that sends j2ee notifications.
241
242
private NotificationBroadcasterSupport broadcaster = null;
244
245
* The Locale to character set mapper for this application.
317
318
private String displayName = null;
321
322
* Override the default context xml location.
323
324
private String defaultContextXml;
327
328
* Override the default web xml location.
329
330
private String defaultWebXml;
402
403
* The mapper associated with this context.
404
private org.apache.tomcat.util.http.mapper.Mapper mapper =
405
private org.apache.tomcat.util.http.mapper.Mapper mapper =
405
406
new org.apache.tomcat.util.http.mapper.Mapper();
529
530
* The notification sequence number.
531
532
private long sequenceNumber = 0;
534
535
* The status code error pages for this web application, keyed by
535
536
* HTTP status code (as an Integer).
669
677
private long startTime;
670
678
private long tldScanTime;
673
681
* Name of the engine. If null, the domain is used.
675
683
private String engineName = null;
676
684
private String j2EEApplication="none";
677
685
private String j2EEServer="none";
681
689
* Attribute value used to turn on/off XML validation
683
private boolean webXmlValidation = false;
691
private boolean webXmlValidation = Globals.STRICT_SERVLET_COMPLIANCE;
687
695
* Attribute value used to turn on/off XML namespace validation
689
private boolean webXmlNamespaceAware = false;
697
private boolean webXmlNamespaceAware = Globals.STRICT_SERVLET_COMPLIANCE;
692
700
* Attribute value used to turn on/off TLD processing
697
705
* Attribute value used to turn on/off XML validation
699
private boolean tldValidation = false;
703
* Attribute value used to turn on/off TLD XML namespace validation
705
private boolean tldNamespaceAware = false;
707
private boolean tldValidation = Globals.STRICT_SERVLET_COMPLIANCE;
711
713
private boolean saveConfig = true;
715
717
* The flag that indicates that session cookies should use HttpOnly
717
719
private boolean useHttpOnly = false;
721
723
* The domain to use for session cookies. <code>null</code> indicates that
722
724
* the domain is controlled by the application.
724
726
private String sessionCookieDomain;
728
730
* The path to use for session cookies. <code>null</code> indicates that
729
731
* the path is controlled by the application.
731
733
private String sessionCookiePath;
735
737
* The name to use for session cookies. <code>null</code> indicates that
736
738
* the name is controlled by the application.
738
740
private String sessionCookieName;
742
744
* Should Tomcat attempt to terminate threads that have been started by the
743
745
* web application? Stopping threads is performed via the deprecated (for
760
762
* If an HttpClient keep-alive timer thread has been started by this web
761
763
* application and is still running, should Tomcat change the context class
762
* loader from the current {@link WebappClassLoader} to
763
* {@link WebappClassLoader#parent} to prevent a memory leak? Note that the
764
* keep-alive timer thread will stop on its own once the keep-alives all
765
* expire however, on a busy system that might not happen for some time.
764
* loader from the current
765
* {@link org.apache.catalina.loader.WebappClassLoader} to
766
* {@link org.apache.catalina.loader.WebappClassLoader#parent} to prevent a
767
* memory leak? Note that the keep-alive timer thread will stop on its own
768
* once the keep-alives all expire however, on a busy system that might not
769
* happen for some time.
767
771
private boolean clearReferencesHttpClientKeepAliveThread = true;
770
774
* Should Tomcat attempt to clear any ThreadLocal objects that are instances
771
775
* of classes loaded by this class loader. Failure to remove any such
1214
1218
oldUseHttpOnly,
1215
1219
this.useHttpOnly);
1220
1224
* Gets the domain to use for session cookies.
1222
1226
* @return The value of the default session cookie domain or null if not
1225
1229
public String getSessionCookieDomain() {
1226
1230
return sessionCookieDomain;
1231
1235
* Sets the domain to use for session cookies.
1233
1237
* @param sessionCookieDomain The domain to use
1235
1239
public void setSessionCookieDomain(String sessionCookieDomain) {
1244
1248
* Gets the path to use for session cookies.
1246
1250
* @return The value of the default session cookie path or null if not
1249
1253
public String getSessionCookiePath() {
1250
1254
return sessionCookiePath;
1255
1259
* Sets the path to use for session cookies.
1257
1261
* @param sessionCookiePath The path to use
1259
1263
public void setSessionCookiePath(String sessionCookiePath) {
1263
1267
oldSessionCookiePath, sessionCookiePath);
1268
1272
* Gets the name to use for session cookies.
1270
1274
* @return The value of the default session cookie name or null if not
1273
1277
public String getSessionCookieName() {
1274
1278
return sessionCookieName;
1279
1283
* Sets the name to use for session cookies. Overrides any setting that
1280
1284
* may be specified by the application.
1282
1286
* @param sessionCookieName The name to use
1284
1288
public void setSessionCookieName(String sessionCookieName) {
1318
1322
return defaultContextXml;
1322
1326
* Set the location of the default context xml that will be used.
1323
1327
* If not absolute, it'll be made relative to the engine's base dir
1324
1328
* ( which defaults to catalina.base system property ).
1326
* @param defaultContextXml The default web xml
1330
* @param defaultContextXml The default web xml
1328
1332
public void setDefaultContextXml(String defaultContextXml) {
1329
1333
this.defaultContextXml = defaultContextXml;
1333
1337
return defaultWebXml;
1337
1341
* Set the location of the default web xml that will be used.
1338
1342
* If not absolute, it'll be made relative to the engine's base dir
1339
1343
* ( which defaults to catalina.base system property ).
1341
* @param defaultWebXml The default web xml
1345
* @param defaultWebXml The default web xml
1343
1347
public void setDefaultWebXml(String defaultWebXml) {
1344
1348
this.defaultWebXml = defaultWebXml;
1478
1482
this.docBase = docBase;
1483
1487
* Is URL rewriting disabled?
1484
1488
* URL rewriting is an optional component of the servlet 2.5 specification.
1485
1489
* However if set to true this will be non-compliant with the specification
1486
1490
* as the specification requires that there <b>must</b> be a way to retain
1487
1491
* sessions if the client doesn't allow session cookies.
1489
1493
* @return true If URL rewriting is disabled.
1491
1495
* @see <a href="http://jcp.org/aboutJava/communityprocess/mrel/jsr154/index2.html">Servlet
1492
1496
* 2.5 Specification. Sections SRV.7.1.3 and SRV.7.1.4</a>
1493
1497
* @see javax.servlet.http.HttpServletResponse#encodeURL(String) encodeURL
1575
1579
public boolean getIgnoreAnnotations() {
1576
1580
return this.ignoreAnnotations;
1581
* Set the boolean on the annotations parsing for this web
1585
* Set the boolean on the annotations parsing for this web
1584
1588
* @param ignoreAnnotations The boolean on the annotations parsing
1586
1590
public void setIgnoreAnnotations(boolean ignoreAnnotations) {
1975
1979
* Set the value of the unloadDelay flag, which represents the amount
1976
1980
* of ms that the container will wait when unloading servlets.
1977
* Setting this to a small value may cause more requests to fail
1981
* Setting this to a small value may cause more requests to fail
1978
1982
* to complete when stopping a web application.
1980
1984
* @param unloadDelay The new value
2034
2038
this.wrapperClassName = wrapperClassName;
2037
wrapperClass = Class.forName(wrapperClassName);
2041
wrapperClass = Class.forName(wrapperClassName);
2038
2042
if (!StandardWrapper.class.isAssignableFrom(wrapperClass)) {
2039
2043
throw new IllegalArgumentException(
2040
2044
sm.getString("standardContext.invalidWrapperClass",
2266
* Set the clearReferencesStopThreads feature for this Context.
2270
* Set the clearReferencesThreadLocals feature for this Context.
2268
* @param clearReferencesStopThreads The new flag value
2272
* @param clearReferencesThreadLocals The new flag value
2270
2274
public void setClearReferencesThreadLocals(
2271
2275
boolean clearReferencesThreadLocals) {
2371
2375
if ((jspFile != null) && !jspFile.startsWith("/")) {
2372
2376
if (isServlet22()) {
2373
2377
if(log.isDebugEnabled())
2374
log.debug(sm.getString("standardContext.wrapper.warning",
2378
log.debug(sm.getString("standardContext.wrapper.warning",
2376
2380
wrapper.setJspFile("/" + jspFile);
2509
2513
// if ((servletNames.length == 0) && (urlPatterns.length == 0))
2510
2514
// Servlet API 2.5 (FIX 43338)
2511
2515
// SRV 6.2.5 says supporting for '*' as the servlet-name in filter-mapping.
2512
if (!filterMap.getMatchAllServletNames() &&
2513
!filterMap.getMatchAllUrlPatterns() &&
2516
if (!filterMap.getMatchAllServletNames() &&
2517
!filterMap.getMatchAllUrlPatterns() &&
2514
2518
(servletNames.length == 0) && (urlPatterns.length == 0))
2515
2519
throw new IllegalArgumentException
2516
2520
(sm.getString("standardContext.filterMap.either"));
3083
3087
public Context findMappingObject() {
3084
3088
return (Context) getMappingObject();
3089
3093
* Return the message destination with the specified name, if any;
3090
3094
* otherwise, return <code>null</code>.
3374
* Return the set of watched resources for this Context. If none are
3378
* Return the set of watched resources for this Context. If none are
3375
3379
* defined, a zero length array will be returned.
3377
3381
public String[] findWatchedResources() {
3874
3878
* Remove the specified watched resource name from the list associated
3875
3879
* with this Context.
3877
3881
* @param name Name of the watched resource to be removed
3879
3883
public void removeWatchedResource(String name) {
3881
3885
synchronized (watchedResourcesLock) {
3883
3887
// Make sure this watched resource is currently present
4328
4332
// Register the cache in JMX
4329
4333
if (isCachingAllowed()) {
4330
ObjectName resourcesName =
4331
new ObjectName(this.getDomain() + ":type=Cache,host="
4332
+ getHostname() + ",path="
4334
ObjectName resourcesName =
4335
new ObjectName(this.getDomain() + ":type=Cache,host="
4336
+ getHostname() + ",path="
4333
4337
+ (("".equals(getPath()))?"/":getPath()));
4334
4338
Registry.getRegistry(null, null).registerComponent
4335
4339
(proxyDirContext.getCache(), resourcesName, null);
4363
4367
// Unregister the cache in JMX
4364
4368
if (isCachingAllowed()) {
4365
ObjectName resourcesName =
4369
ObjectName resourcesName =
4366
4370
new ObjectName(this.getDomain()
4367
+ ":type=Cache,host="
4368
+ getHostname() + ",path="
4371
+ ":type=Cache,host="
4372
+ getHostname() + ",path="
4369
4373
+ (("".equals(getPath()))?"/"
4371
4375
Registry.getRegistry(null, null)
4457
4461
// Set JMX object name for proper pipeline registration
4458
4462
preRegisterJMX();
4460
if ((oname != null) &&
4464
if ((oname != null) &&
4461
4465
(Registry.getRegistry(null, null).getMBeanServer().isRegistered(oname))) {
4462
4466
// As things depend on the JMX registration, the context
4463
4467
// must be reregistered again once properly initialized
4495
// Look for a realm - that may have been configured earlier.
4499
// Look for a realm - that may have been configured earlier.
4496
4500
// If the realm is added after context - it'll set itself.
4497
// TODO: what is the use case for this ?
4501
// TODO: what is the use case for this ?
4498
4502
if( realm == null && mserver != null ) {
4499
4503
ObjectName realmName=null;
4501
realmName=new ObjectName( getEngineName() + ":type=Realm,host=" +
4505
realmName=new ObjectName( getEngineName() + ":type=Realm,host=" +
4502
4506
getHostname() + ",path=" + getPath());
4503
4507
if( mserver.isRegistered(realmName ) ) {
4504
mserver.invoke(realmName, "init",
4508
mserver.invoke(realmName, "init",
4505
4509
new Object[] {},
4506
4510
new String[] {}
4509
4513
} catch( Throwable t ) {
4510
4514
if(log.isDebugEnabled())
4511
4515
log.debug("No realm for this host " + realmName);
4515
4519
if (getLoader() == null) {
4516
4520
WebappLoader webappLoader = new WebappLoader(getParentClassLoader());
4517
4521
webappLoader.setDelegate(getDelegate());
4553
4557
addLifecycleListener(namingContextListener);
4557
4561
// Standard container startup
4558
4562
if (log.isDebugEnabled())
4559
4563
log.debug("Processing standard container startup");
4562
4566
// Binding thread
4563
4567
ClassLoader oldCCL = bindThread();
4581
4585
unbindThread(oldCCL);
4582
4586
oldCCL = bindThread();
4584
// Initialize logger again. Other components might have used it too early,
4588
// Initialize logger again. Other components might have used it too early,
4585
4589
// so it should be reset.
4588
4592
if ((logger != null) && (logger instanceof Lifecycle))
4589
4593
((Lifecycle) logger).start();
4591
4595
if ((cluster != null) && (cluster instanceof Lifecycle))
4592
4596
((Lifecycle) cluster).start();
4593
4597
if ((realm != null) && (realm instanceof Lifecycle))
4607
4611
if (pipeline instanceof Lifecycle) {
4608
4612
((Lifecycle) pipeline).start();
4611
4615
// Notify our interested LifecycleListeners
4612
4616
lifecycle.fireLifecycleEvent(START_EVENT, null);
4614
4618
// Acquire clustered manager
4615
4619
Manager contextManager = null;
4616
4620
if (manager == null) {
4675
4679
if (ok && !getIgnoreAnnotations()) {
4676
4680
if (annotationProcessor == null) {
4677
4681
if (isUseNaming() && namingContextListener != null) {
4678
annotationProcessor =
4682
annotationProcessor =
4679
4683
new DefaultAnnotationProcessor(namingContextListener.getEnvContext());
4681
4685
annotationProcessor = new DefaultAnnotationProcessor(null);
4760
4764
startTime=System.currentTimeMillis();
4762
// Send j2ee.state.running notification
4766
// Send j2ee.state.running notification
4763
4767
if (ok && (this.getObjectName() != null)) {
4764
Notification notification =
4765
new Notification("j2ee.state.running", this.getObjectName(),
4768
Notification notification =
4769
new Notification("j2ee.state.running", this.getObjectName(),
4766
4770
sequenceNumber++);
4767
4771
broadcaster.sendNotification(notification);
4770
// Close all JARs right away to avoid always opening a peak number
4774
// Close all JARs right away to avoid always opening a peak number
4771
4775
// of files on startup
4772
4776
if (getLoader() instanceof WebappLoader) {
4773
4777
((WebappLoader) getLoader()).closeJARs(true);
4781
4785
//cacheContext();
4785
4789
private void cacheContext() {
4787
4791
File workDir=new File( getWorkPath() );
4789
4793
File ctxSer=new File( workDir, "_tomcat_context.ser");
4790
4794
FileOutputStream fos=new FileOutputStream( ctxSer );
4791
4795
ObjectOutputStream oos=new ObjectOutputStream( fos );
4808
4812
private void mergeParameters() {
4809
4813
Map<String,String> mergedParams = new HashMap<String,String>();
4811
4815
String names[] = findParameters();
4812
4816
for (int i = 0; i < names.length; i++) {
4813
4817
mergedParams.put(names[i], findParameter(names[i]));
4824
4828
mergedParams.put(params[i].getName(), params[i].getValue());
4828
4832
for (Map.Entry<String,String> entry : mergedParams.entrySet()) {
4829
4833
context.setInitParameter(entry.getKey(), entry.getValue());
4836
4840
* Stop this Context component.
4849
4853
// Notify our interested LifecycleListeners
4850
4854
lifecycle.fireLifecycleEvent(BEFORE_STOP_EVENT, null);
4852
// Send j2ee.state.stopping notification
4856
// Send j2ee.state.stopping notification
4853
4857
if (this.getObjectName() != null) {
4854
Notification notification =
4855
new Notification("j2ee.state.stopping", this.getObjectName(),
4858
Notification notification =
4859
new Notification("j2ee.state.stopping", this.getObjectName(),
4856
4860
sequenceNumber++);
4857
4861
broadcaster.sendNotification(notification);
4860
4864
// Mark this application as unavailable while we shut down
4861
4865
setAvailable(false);
4930
// Send j2ee.state.stopped notification
4934
// Send j2ee.state.stopped notification
4931
4935
if (this.getObjectName() != null) {
4932
Notification notification =
4933
new Notification("j2ee.state.stopped", this.getObjectName(),
4936
Notification notification =
4937
new Notification("j2ee.state.stopped", this.getObjectName(),
4934
4938
sequenceNumber++);
4935
4939
broadcaster.sendNotification(notification);
4938
4942
// Reset application context
4939
4943
context = null;
4941
// This object will no longer be visible or used.
4945
// This object will no longer be visible or used.
4943
4947
resetContext();
4944
4948
} catch( Exception ex ) {
4945
4949
log.error( "Error reseting context " + this + " " + ex, ex );
4948
4952
// Notify our interested LifecycleListeners
4949
4953
lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT, null);
4956
4960
/** Destroy needs to clean up the context completely.
4958
* The problem is that undoing all the config in start() and restoring
4962
* The problem is that undoing all the config in start() and restoring
4959
4963
* a 'fresh' state is impossible. After stop()/destroy()/init()/start()
4960
4964
* we should have the same state as if a fresh start was done - i.e
4961
* read modified web.xml, etc. This can only be done by completely
4965
* read modified web.xml, etc. This can only be done by completely
4962
4966
* removing the context object and remapping a new one, or by cleaning
4963
4967
* up everything.
4965
4969
* XXX Should this be done in stop() ?
4968
4972
public void destroy() throws Exception {
4969
if( oname != null ) {
4970
// Send j2ee.object.deleted notification
4971
Notification notification =
4972
new Notification("j2ee.object.deleted", this.getObjectName(),
4973
if( oname != null ) {
4974
// Send j2ee.object.deleted notification
4975
Notification notification =
4976
new Notification("j2ee.object.deleted", this.getObjectName(),
4973
4977
sequenceNumber++);
4974
4978
broadcaster.sendNotification(notification);
4976
4980
super.destroy();
4978
4982
// Notify our interested LifecycleListeners
4999
5003
applicationEventListenersObjects = new Object[0];
5000
5004
applicationLifecycleListenersObjects = new Object[0];
5001
5005
taglibs = new HashMap<String, String>();
5003
5007
annotationProcessor = null;
5005
5009
if(log.isDebugEnabled())
5055
5059
* Are we processing a version 2.2 deployment descriptor?
5057
5061
protected boolean isServlet22() {
5059
if (this.publicId == null)
5061
if (this.publicId.equals
5062
(org.apache.catalina.startup.Constants.WebDtdPublicId_22))
5062
return XmlIdentifiers.WEB_22_PUBLIC.equals(publicId);
5295
5291
return namingContextName;
5300
5296
* Naming context listener accessor.
5302
5298
public NamingContextListener getNamingContextListener() {
5303
5299
return namingContextListener;
5308
5304
* Naming context listener setter.
5487
5483
* JSR77 deploymentDescriptor attribute
5489
* @return string deployment descriptor
5485
* @return string deployment descriptor
5491
5487
public String getDeploymentDescriptor() {
5493
5489
InputStream stream = null;
5494
5490
ServletContext servletContext = getServletContext();
5495
5491
if (servletContext != null) {
5541
5537
public ObjectName createObjectName(String hostDomain, ObjectName parentName)
5542
5538
throws MalformedObjectNameException
5544
5540
String onameStr;
5545
5541
StandardHost hst=(StandardHost)getParent();
5547
5543
String pathName=getName();
5548
5544
String hostName=getParent().getName();
5549
5545
String name= "//" + ((hostName==null)? "DEFAULT" : hostName) +
5556
5552
onameStr="j2eeType=WebModule,name=" + name + suffix;
5557
5553
if( log.isDebugEnabled())
5558
5554
log.debug("Registering " + onameStr + " for " + oname);
5560
5556
// default case - no domain explictely set.
5561
5557
if( getDomain() == null ) domain=hst.getDomain();
5563
5559
ObjectName oname=new ObjectName(getDomain() + ":" + onameStr);
5567
5563
private void preRegisterJMX() {
5569
5565
StandardHost host = (StandardHost) getParent();
5571
5567
|| (oname.getKeyProperty("j2eeType") == null)) {
5572
5568
oname = createObjectName(host.getDomain(), host.getJmxName());
5573
5569
controller = oname;
5589
5585
controller = oname;
5590
5586
Registry.getRegistry(null, null)
5591
5587
.registerComponent(this, oname, null);
5593
// Send j2ee.object.created notification
5589
// Send j2ee.object.created notification
5594
5590
if (this.getObjectName() != null) {
5595
5591
Notification notification = new Notification(
5596
"j2ee.object.created",
5597
this.getObjectName(),
5592
"j2ee.object.created",
5593
this.getObjectName(),
5598
5594
sequenceNumber++);
5599
5595
broadcaster.sendNotification(notification);
5647
5643
if( this.getParent() == null ) {
5648
5644
ObjectName parentName=getParentName();
5650
5646
if( ! mserver.isRegistered(parentName)) {
5651
5647
if(log.isDebugEnabled())
5652
5648
log.debug("No host, creating one " + parentName);
5706
5702
// Notify our interested LifecycleListeners
5707
5703
lifecycle.fireLifecycleEvent(INIT_EVENT, null);
5709
// Send j2ee.state.starting notification
5705
// Send j2ee.state.starting notification
5710
5706
if (this.getObjectName() != null) {
5711
Notification notification = new Notification("j2ee.state.starting",
5712
this.getObjectName(),
5707
Notification notification = new Notification("j2ee.state.starting",
5708
this.getObjectName(),
5713
5709
sequenceNumber++);
5714
5710
broadcaster.sendNotification(notification);
5719
5715
public ObjectName getParentName() throws MalformedObjectNameException {
5749
5745
"type=Host,host=" + hostName);
5750
5746
return parentName;
5753
5749
public void create() throws Exception{
5757
/* Remove a JMX notficationListener
5753
/* Remove a JMX notficationListener
5758
5754
* @see javax.management.NotificationEmitter#removeNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
5760
public void removeNotificationListener(NotificationListener listener,
5756
public void removeNotificationListener(NotificationListener listener,
5761
5757
NotificationFilter filter, Object object) throws ListenerNotFoundException {
5762
5758
broadcaster.removeNotificationListener(listener,filter,object);
5766
5762
private MBeanNotificationInfo[] notificationInfo;
5768
5764
/* Get JMX Broadcaster Info
5769
5765
* @TODO use StringManager for international support!
5770
5766
* @TODO This two events we not send j2ee.state.failed and j2ee.attribute.changed!
5778
5774
"j2ee.object.created"},
5779
5775
Notification.class.getName(),
5780
5776
"web application is created"
5782
5778
new MBeanNotificationInfo(new String[] {
5783
5779
"j2ee.state.starting"},
5784
5780
Notification.class.getName(),
5805
5801
"web application is deleted"
5811
5807
return notificationInfo;
5815
5811
/* Add a JMX-NotificationListener
5816
5812
* @see javax.management.NotificationBroadcaster#addNotificationListener(javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object)
5818
public void addNotificationListener(NotificationListener listener,
5814
public void addNotificationListener(NotificationListener listener,
5819
5815
NotificationFilter filter, Object object) throws IllegalArgumentException {
5820
5816
broadcaster.addNotificationListener(listener,filter,object);
5826
* Remove a JMX-NotificationListener
5822
* Remove a JMX-NotificationListener
5827
5823
* @see javax.management.NotificationBroadcaster#removeNotificationListener(javax.management.NotificationListener)
5829
public void removeNotificationListener(NotificationListener listener)
5825
public void removeNotificationListener(NotificationListener listener)
5830
5826
throws ListenerNotFoundException {
5831
5827
broadcaster.removeNotificationListener(listener);
5836
5832
// ------------------------------------------------------------- Attributes
5870
* Set the validation feature of the XML parser used when
5871
* parsing xml instances.
5872
* @param webXmlValidation true to enable xml instance validation
5866
public boolean getXmlNamespaceAware(){
5867
return webXmlNamespaceAware;
5871
public void setXmlNamespaceAware(boolean webXmlNamespaceAware){
5872
this.webXmlNamespaceAware= webXmlNamespaceAware;
5874
5876
public void setXmlValidation(boolean webXmlValidation){
5876
5877
this.webXmlValidation = webXmlValidation;
5881
* Get the server.xml <context> attribute's xmlValidation.
5882
* @return true if validation is enabled.
5885
5881
public boolean getXmlValidation(){
5886
5882
return webXmlValidation;
5891
* Get the server.xml <context> attribute's xmlNamespaceAware.
5892
* @return true if namespace awarenes is enabled.
5894
public boolean getXmlNamespaceAware(){
5895
return webXmlNamespaceAware;
5900
* Set the namespace aware feature of the XML parser used when
5901
* parsing xml instances.
5902
* @param webXmlNamespaceAware true to enable namespace awareness
5904
public void setXmlNamespaceAware(boolean webXmlNamespaceAware){
5905
this.webXmlNamespaceAware= webXmlNamespaceAware;
5910
* Set the validation feature of the XML parser used when
5911
* parsing tlds files.
5912
* @param tldValidation true to enable xml instance validation
5886
public boolean getTldNamespaceAware(){
5891
public void setTldNamespaceAware(boolean tldNamespaceAware){
5896
public void setXmlBlockExternal(boolean xmlBlockExternal) {
5897
this.xmlBlockExternal = xmlBlockExternal;
5901
public boolean getXmlBlockExternal() {
5902
return xmlBlockExternal;
5914
5906
public void setTldValidation(boolean tldValidation){
5916
5907
this.tldValidation = tldValidation;
5921
* Get the server.xml <context> attribute's webXmlValidation.
5922
* @return true if validation is enabled.
5925
5911
public boolean getTldValidation(){
5926
5912
return tldValidation;
5930
5917
* Sets the process TLDs attribute.
5942
5929
return processTlds;
5946
* Get the server.xml <host> attribute's xmlNamespaceAware.
5947
* @return true if namespace awarenes is enabled.
5949
public boolean getTldNamespaceAware(){
5950
return tldNamespaceAware;
5955
* Set the namespace aware feature of the XML parser used when
5956
* parsing xml instances.
5957
* @param tldNamespaceAware true to enable namespace awareness
5959
public void setTldNamespaceAware(boolean tldNamespaceAware){
5960
this.tldNamespaceAware= tldNamespaceAware;
5965
* Support for "stateManageable" JSR77
5934
* Support for "stateManageable" JSR77
5967
5936
public boolean isStateManageable() {
5971
5940
public void startRecursive() throws LifecycleException {
5972
5941
// nothing to start recursive, the servlets will be started by load-on-startup
5976
5945
public int getState() {
5977
5946
if( started ) {
5978
5947
return 1; // RUNNING
5980
5949
if( initialized ) {
5981
return 0; // starting ?
5950
return 0; // starting ?
5984
5953
return 4; //FAILED
5986
5955
// 2 - STOPPING
5987
5956
return 3; // STOPPED
5990
5959
public String getStateName() {
5991
5960
return lifecycle.getState();
5995
5964
* The J2EE Server ObjectName this module is deployed on.
5997
5966
private String server = null;
6000
5969
* The Java virtual machines on which this module is running.
6002
5971
private String[] javaVMs = null;
6004
5973
public String getServer() {
6008
5977
public String setServer(String server) {
6009
5978
return this.server=server;
6012
5981
public String[] getJavaVMs() {
6013
5982
return javaVMs;
6016
5985
public String[] setJavaVMs(String[] javaVMs) {
6017
5986
return this.javaVMs = javaVMs;
6021
5990
* Gets the time this context was started.
6023
5992
* @return Time (in milliseconds since January 1, 1970, 00:00:00) when this
6024
* context was started
5993
* context was started
6026
5995
public long getStartTime() {
6027
5996
return startTime;
6030
5999
public boolean isEventProvider() {
6034
6003
public boolean isStatisticsProvider() {