KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > core > StandardContext


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18
19 package org.apache.catalina.core;
20
21 import java.io.BufferedReader JavaDoc;
22 import java.io.File JavaDoc;
23 import java.io.FileInputStream JavaDoc;
24 import java.io.FileOutputStream JavaDoc;
25 import java.io.IOException JavaDoc;
26 import java.io.InputStream JavaDoc;
27 import java.io.InputStreamReader JavaDoc;
28 import java.io.ObjectOutputStream JavaDoc;
29 import java.io.Serializable JavaDoc;
30 import java.util.ArrayList JavaDoc;
31 import java.util.HashMap JavaDoc;
32 import java.util.Hashtable JavaDoc;
33 import java.util.Iterator JavaDoc;
34 import java.util.Stack JavaDoc;
35 import java.util.TreeMap JavaDoc;
36
37 import javax.management.AttributeNotFoundException JavaDoc;
38 import javax.management.ListenerNotFoundException JavaDoc;
39 import javax.management.MBeanNotificationInfo JavaDoc;
40 import javax.management.MBeanRegistrationException JavaDoc;
41 import javax.management.MBeanServer JavaDoc;
42 import javax.management.MalformedObjectNameException JavaDoc;
43 import javax.management.Notification JavaDoc;
44 import javax.management.NotificationBroadcasterSupport JavaDoc;
45 import javax.management.NotificationEmitter JavaDoc;
46 import javax.management.NotificationFilter JavaDoc;
47 import javax.management.NotificationListener JavaDoc;
48 import javax.management.ObjectName JavaDoc;
49 import javax.naming.NamingException JavaDoc;
50 import javax.naming.directory.DirContext JavaDoc;
51 import javax.servlet.FilterConfig JavaDoc;
52 import javax.servlet.ServletContext JavaDoc;
53 import javax.servlet.ServletContextAttributeListener JavaDoc;
54 import javax.servlet.ServletContextEvent JavaDoc;
55 import javax.servlet.ServletContextListener JavaDoc;
56 import javax.servlet.ServletException JavaDoc;
57 import javax.servlet.ServletRequestAttributeListener JavaDoc;
58 import javax.servlet.ServletRequestListener JavaDoc;
59 import javax.servlet.http.HttpSessionAttributeListener JavaDoc;
60 import javax.servlet.http.HttpSessionListener JavaDoc;
61
62 import org.apache.AnnotationProcessor;
63 import org.apache.catalina.Container;
64 import org.apache.catalina.ContainerListener;
65 import org.apache.catalina.Context;
66 import org.apache.catalina.Engine;
67 import org.apache.catalina.Globals;
68 import org.apache.catalina.Host;
69 import org.apache.catalina.InstanceListener;
70 import org.apache.catalina.Lifecycle;
71 import org.apache.catalina.LifecycleException;
72 import org.apache.catalina.LifecycleListener;
73 import org.apache.catalina.Loader;
74 import org.apache.catalina.Manager;
75 import org.apache.catalina.Wrapper;
76 import org.apache.catalina.deploy.ApplicationParameter;
77 import org.apache.catalina.deploy.ErrorPage;
78 import org.apache.catalina.deploy.FilterDef;
79 import org.apache.catalina.deploy.FilterMap;
80 import org.apache.catalina.deploy.LoginConfig;
81 import org.apache.catalina.deploy.MessageDestination;
82 import org.apache.catalina.deploy.MessageDestinationRef;
83 import org.apache.catalina.deploy.NamingResources;
84 import org.apache.catalina.deploy.SecurityCollection;
85 import org.apache.catalina.deploy.SecurityConstraint;
86 import org.apache.catalina.loader.WebappLoader;
87 import org.apache.catalina.session.StandardManager;
88 import org.apache.catalina.startup.ContextConfig;
89 import org.apache.catalina.startup.TldConfig;
90 import org.apache.catalina.util.CharsetMapper;
91 import org.apache.catalina.util.DefaultAnnotationProcessor;
92 import org.apache.catalina.util.ExtensionValidator;
93 import org.apache.catalina.util.RequestUtil;
94 import org.apache.catalina.util.URLEncoder;
95 import org.apache.commons.logging.Log;
96 import org.apache.commons.logging.LogFactory;
97 import org.apache.naming.ContextBindings;
98 import org.apache.naming.resources.BaseDirContext;
99 import org.apache.naming.resources.DirContextURLStreamHandler;
100 import org.apache.naming.resources.FileDirContext;
101 import org.apache.naming.resources.ProxyDirContext;
102 import org.apache.naming.resources.WARDirContext;
103 import org.apache.tomcat.util.modeler.Registry;
104
105 /**
106  * Standard implementation of the <b>Context</b> interface. Each
107  * child container must be a Wrapper implementation to process the
108  * requests directed to a particular servlet.
109  *
110  * @author Craig R. McClanahan
111  * @author Remy Maucherat
112  * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
113  */

114
115 public class StandardContext
116     extends ContainerBase
117     implements Context JavaDoc, Serializable JavaDoc, NotificationEmitter JavaDoc
118 {
119     private static transient Log log = LogFactory.getLog(StandardContext.class);
120
121
122     // ----------------------------------------------------------- Constructors
123

124
125     /**
126      * Create a new StandardContext component with the default basic Valve.
127      */

128     public StandardContext() {
129
130         super();
131         pipeline.setBasic(new StandardContextValve());
132         broadcaster = new NotificationBroadcasterSupport JavaDoc();
133
134     }
135
136
137     // ----------------------------------------------------- Class Variables
138

139
140     /**
141      * The descriptive information string for this implementation.
142      */

143     private static final String JavaDoc info =
144         "org.apache.catalina.core.StandardContext/1.0";
145
146
147     /**
148      * Array containing the safe characters set.
149      */

150     protected static URLEncoder urlEncoder;
151
152
153     /**
154      * GMT timezone - all HTTP dates are on GMT
155      */

156     static {
157         urlEncoder = new URLEncoder();
158         urlEncoder.addSafeCharacter('~');
159         urlEncoder.addSafeCharacter('-');
160         urlEncoder.addSafeCharacter('_');
161         urlEncoder.addSafeCharacter('.');
162         urlEncoder.addSafeCharacter('*');
163         urlEncoder.addSafeCharacter('/');
164     }
165
166
167     // ----------------------------------------------------- Instance Variables
168

169
170     /**
171      * The alternate deployment descriptor name.
172      */

173     private String JavaDoc altDDName = null;
174
175
176     /**
177      * Annotation processor.
178      */

179     private AnnotationProcessor annotationProcessor = null;
180
181
182    /**
183      * Associated host name.
184      */

185     private String JavaDoc hostName;
186
187
188     /**
189      * The antiJARLocking flag for this Context.
190      */

191     private boolean antiJARLocking = false;
192
193     
194     /**
195      * The antiResourceLocking flag for this Context.
196      */

197     private boolean antiResourceLocking = false;
198
199     
200     /**
201      * The set of application listener class names configured for this
202      * application, in the order they were encountered in the web.xml file.
203      */

204     private String JavaDoc applicationListeners[] = new String JavaDoc[0];
205
206
207     /**
208      * The set of instantiated application event listener objects</code>.
209      */

210     private transient Object JavaDoc applicationEventListenersObjects[] =
211         new Object JavaDoc[0];
212
213
214     /**
215      * The set of instantiated application lifecycle listener objects</code>.
216      */

217     private transient Object JavaDoc applicationLifecycleListenersObjects[] =
218         new Object JavaDoc[0];
219
220
221     /**
222      * The set of application parameters defined for this application.
223      */

224     private ApplicationParameter applicationParameters[] =
225         new ApplicationParameter[0];
226
227
228     /**
229      * The application available flag for this Context.
230      */

231     private boolean available = false;
232     
233     /**
234      * The broadcaster that sends j2ee notifications.
235      */

236     private NotificationBroadcasterSupport JavaDoc broadcaster = null;
237     
238     /**
239      * The Locale to character set mapper for this application.
240      */

241     private transient CharsetMapper charsetMapper = null;
242
243
244     /**
245      * The Java class name of the CharsetMapper class to be created.
246      */

247     private String JavaDoc charsetMapperClass =
248       "org.apache.catalina.util.CharsetMapper";
249
250
251     /**
252      * The path to a file to save this Context information.
253      */

254     private String JavaDoc configFile = null;
255
256
257     /**
258      * The "correctly configured" flag for this Context.
259      */

260     private boolean configured = false;
261
262
263     /**
264      * The security constraints for this web application.
265      */

266     private SecurityConstraint constraints[] = new SecurityConstraint[0];
267
268
269     /**
270      * The ServletContext implementation associated with this Context.
271      */

272     protected transient ApplicationContext context = null;
273
274
275     /**
276      * Compiler classpath to use.
277      */

278     private String JavaDoc compilerClasspath = null;
279
280
281     /**
282      * Should we attempt to use cookies for session id communication?
283      */

284     private boolean cookies = true;
285
286
287     /**
288      * Should we allow the <code>ServletContext.getContext()</code> method
289      * to access the context of other web applications in this server?
290      */

291     private boolean crossContext = false;
292
293     
294     /**
295      * Encoded path.
296      */

297     private String JavaDoc encodedPath = null;
298     
299
300     /**
301      * The "follow standard delegation model" flag that will be used to
302      * configure our ClassLoader.
303      */

304     private boolean delegate = false;
305
306
307     /**
308      * The display name of this web application.
309      */

310     private String JavaDoc displayName = null;
311
312
313     /**
314      * Override the default context xml location.
315      */

316     private String JavaDoc defaultContextXml;
317
318
319     /**
320      * Override the default web xml location.
321      */

322     private String JavaDoc defaultWebXml;
323
324
325     /**
326      * The distributable flag for this web application.
327      */

328     private boolean distributable = false;
329
330
331     /**
332      * The document root for this web application.
333      */

334     private String JavaDoc docBase = null;
335
336
337     /**
338      * The exception pages for this web application, keyed by fully qualified
339      * class name of the Java exception.
340      */

341     private HashMap JavaDoc exceptionPages = new HashMap JavaDoc();
342
343
344     /**
345      * The set of filter configurations (and associated filter instances) we
346      * have initialized, keyed by filter name.
347      */

348     private HashMap JavaDoc filterConfigs = new HashMap JavaDoc();
349
350
351     /**
352      * The set of filter definitions for this application, keyed by
353      * filter name.
354      */

355     private HashMap JavaDoc filterDefs = new HashMap JavaDoc();
356
357
358     /**
359      * The set of filter mappings for this application, in the order
360      * they were defined in the deployment descriptor.
361      */

362     private FilterMap filterMaps[] = new FilterMap[0];
363
364
365     /**
366      * Ignore annotations.
367      */

368     private boolean ignoreAnnotations = false;
369
370
371     /**
372      * The set of classnames of InstanceListeners that will be added
373      * to each newly created Wrapper by <code>createWrapper()</code>.
374      */

375     private String JavaDoc instanceListeners[] = new String JavaDoc[0];
376
377
378     /**
379      * The login configuration descriptor for this web application.
380      */

381     private LoginConfig loginConfig = null;
382
383
384     /**
385      * The mapper associated with this context.
386      */

387     private org.apache.tomcat.util.http.mapper.Mapper mapper =
388         new org.apache.tomcat.util.http.mapper.Mapper();
389
390
391     /**
392      * The naming context listener for this web application.
393      */

394     private transient NamingContextListener namingContextListener = null;
395
396
397     /**
398      * The naming resources for this web application.
399      */

400     private NamingResources namingResources = null;
401
402
403     /**
404      * The message destinations for this web application.
405      */

406     private HashMap JavaDoc messageDestinations = new HashMap JavaDoc();
407
408
409     /**
410      * The MIME mappings for this web application, keyed by extension.
411      */

412     private HashMap JavaDoc mimeMappings = new HashMap JavaDoc();
413
414
415      /**
416       * Special case: error page for status 200.
417       */

418      private ErrorPage okErrorPage = null;
419
420
421     /**
422      * The context initialization parameters for this web application,
423      * keyed by name.
424      */

425     private HashMap JavaDoc parameters = new HashMap JavaDoc();
426
427
428     /**
429      * The request processing pause flag (while reloading occurs)
430      */

431     private boolean paused = false;
432
433
434     /**
435      * The public identifier of the DTD for the web application deployment
436      * descriptor version we are currently parsing. This is used to support
437      * relaxed validation rules when processing version 2.2 web.xml files.
438      */

439     private String JavaDoc publicId = null;
440
441
442     /**
443      * The reloadable flag for this web application.
444      */

445     private boolean reloadable = false;
446
447
448     /**
449      * Unpack WAR property.
450      */

451     private boolean unpackWAR = true;
452
453
454     /**
455      * The DefaultContext override flag for this web application.
456      */

457     private boolean override = false;
458
459
460     /**
461      * The original document root for this web application.
462      */

463     private String JavaDoc originalDocBase = null;
464     
465     
466     /**
467      * The privileged flag for this web application.
468      */

469     private boolean privileged = false;
470
471
472     /**
473      * Should the next call to <code>addWelcomeFile()</code> cause replacement
474      * of any existing welcome files? This will be set before processing the
475      * web application's deployment descriptor, so that application specified
476      * choices <strong>replace</strong>, rather than append to, those defined
477      * in the global descriptor.
478      */

479     private boolean replaceWelcomeFiles = false;
480
481
482     /**
483      * The security role mappings for this application, keyed by role
484      * name (as used within the application).
485      */

486     private HashMap JavaDoc roleMappings = new HashMap JavaDoc();
487
488
489     /**
490      * The security roles for this application, keyed by role name.
491      */

492     private String JavaDoc securityRoles[] = new String JavaDoc[0];
493
494
495     /**
496      * The servlet mappings for this web application, keyed by
497      * matching pattern.
498      */

499     private HashMap JavaDoc servletMappings = new HashMap JavaDoc();
500
501
502     /**
503      * The session timeout (in minutes) for this web application.
504      */

505     private int sessionTimeout = 30;
506
507     /**
508      * The notification sequence number.
509      */

510     private long sequenceNumber = 0;
511     
512     /**
513      * The status code error pages for this web application, keyed by
514      * HTTP status code (as an Integer).
515      */

516     private HashMap JavaDoc statusPages = new HashMap JavaDoc();
517
518
519     /**
520      * Set flag to true to cause the system.out and system.err to be redirected
521      * to the logger when executing a servlet.
522      */

523     private boolean swallowOutput = false;
524
525
526     /**
527      * The JSP tag libraries for this web application, keyed by URI
528      */

529     private HashMap JavaDoc taglibs = new HashMap JavaDoc();
530
531
532     /**
533      * Amount of ms that the container will wait for servlets to unload.
534      */

535     private long unloadDelay = 2000;
536
537
538     /**
539      * The watched resources for this application.
540      */

541     private String JavaDoc watchedResources[] = new String JavaDoc[0];
542
543
544     /**
545      * The welcome files for this application.
546      */

547     private String JavaDoc welcomeFiles[] = new String JavaDoc[0];
548
549
550     /**
551      * The set of classnames of LifecycleListeners that will be added
552      * to each newly created Wrapper by <code>createWrapper()</code>.
553      */

554     private String JavaDoc wrapperLifecycles[] = new String JavaDoc[0];
555
556
557     /**
558      * The set of classnames of ContainerListeners that will be added
559      * to each newly created Wrapper by <code>createWrapper()</code>.
560      */

561     private String JavaDoc wrapperListeners[] = new String JavaDoc[0];
562
563
564     /**
565      * The pathname to the work directory for this context (relative to
566      * the server's home if not absolute).
567      */

568     private String JavaDoc workDir = null;
569
570
571     /**
572      * Java class name of the Wrapper class implementation we use.
573      */

574     private String JavaDoc wrapperClassName = StandardWrapper.class.getName();
575     private Class JavaDoc wrapperClass = null;
576
577
578     /**
579      * JNDI use flag.
580      */

581     private boolean useNaming = true;
582
583
584     /**
585      * Filesystem based flag.
586      */

587     private boolean filesystemBased = false;
588
589
590     /**
591      * Name of the associated naming context.
592      */

593     private String JavaDoc namingContextName = null;
594
595
596     /**
597      * Caching allowed flag.
598      */

599     private boolean cachingAllowed = true;
600
601
602     /**
603      * Case sensitivity.
604      */

605     protected boolean caseSensitive = true;
606
607
608     /**
609      * Allow linking.
610      */

611     protected boolean allowLinking = false;
612
613
614     /**
615      * Cache max size in KB.
616      */

617     protected int cacheMaxSize = 10240; // 10 MB
618

619
620     /**
621      * Cache TTL in ms.
622      */

623     protected int cacheTTL = 5000;
624
625
626     private boolean lazy=true;
627
628     /**
629      * Non proxied resources.
630      */

631     private transient DirContext JavaDoc webappResources = null;
632
633     private long startupTime;
634     private long startTime;
635     private long tldScanTime;
636
637     /**
638      * Name of the engine. If null, the domain is used.
639      */

640     private String JavaDoc engineName = null;
641     private String JavaDoc j2EEApplication="none";
642     private String JavaDoc j2EEServer="none";
643
644
645     /**
646      * Attribute value used to turn on/off XML validation
647      */

648      private boolean webXmlValidation = false;
649
650
651     /**
652      * Attribute value used to turn on/off XML namespace validation
653      */

654      private boolean webXmlNamespaceAware = false;
655
656     /**
657      * Attribute value used to turn on/off TLD processing
658      */

659     private boolean processTlds = true;
660
661     /**
662      * Attribute value used to turn on/off XML validation
663      */

664      private boolean tldValidation = false;
665
666
667     /**
668      * Attribute value used to turn on/off TLD XML namespace validation
669      */

670      private boolean tldNamespaceAware = false;
671
672
673     /**
674      * Should we save the configuration.
675      */

676     private boolean saveConfig = true;
677
678
679     // ----------------------------------------------------- Context Properties
680

681
682     public AnnotationProcessor getAnnotationProcessor() {
683        return annotationProcessor;
684     }
685
686
687     public void setAnnotationProcessor(AnnotationProcessor annotationProcessor) {
688        this.annotationProcessor = annotationProcessor;
689     }
690
691     
692     public String JavaDoc getEncodedPath() {
693         return encodedPath;
694     }
695
696
697     public void setName( String JavaDoc name ) {
698         super.setName( name );
699         encodedPath = urlEncoder.encode(name);
700     }
701
702
703     /**
704      * Is caching allowed ?
705      */

706     public boolean isCachingAllowed() {
707         return cachingAllowed;
708     }
709
710
711     /**
712      * Set caching allowed flag.
713      */

714     public void setCachingAllowed(boolean cachingAllowed) {
715         this.cachingAllowed = cachingAllowed;
716     }
717
718
719     /**
720      * Set case sensitivity.
721      */

722     public void setCaseSensitive(boolean caseSensitive) {
723         this.caseSensitive = caseSensitive;
724     }
725
726
727     /**
728      * Is case sensitive ?
729      */

730     public boolean isCaseSensitive() {
731         return caseSensitive;
732     }
733
734
735     /**
736      * Set allow linking.
737      */

738     public void setAllowLinking(boolean allowLinking) {
739         this.allowLinking = allowLinking;
740     }
741
742
743     /**
744      * Is linking allowed.
745      */

746     public boolean isAllowLinking() {
747         return allowLinking;
748     }
749
750
751     /**
752      * Set cache TTL.
753      */

754     public void setCacheTTL(int cacheTTL) {
755         this.cacheTTL = cacheTTL;
756     }
757
758
759     /**
760      * Get cache TTL.
761      */

762     public int getCacheTTL() {
763         return cacheTTL;
764     }
765
766
767     /**
768      * Return the maximum size of the cache in KB.
769      */

770     public int getCacheMaxSize() {
771         return cacheMaxSize;
772     }
773
774
775     /**
776      * Set the maximum size of the cache in KB.
777      */

778     public void setCacheMaxSize(int cacheMaxSize) {
779         this.cacheMaxSize = cacheMaxSize;
780     }
781
782
783     /**
784      * Return the "follow standard delegation model" flag used to configure
785      * our ClassLoader.
786      */

787     public boolean getDelegate() {
788
789         return (this.delegate);
790
791     }
792
793
794     /**
795      * Set the "follow standard delegation model" flag used to configure
796      * our ClassLoader.
797      *
798      * @param delegate The new flag
799      */

800     public void setDelegate(boolean delegate) {
801
802         boolean oldDelegate = this.delegate;
803         this.delegate = delegate;
804         support.firePropertyChange("delegate", new Boolean JavaDoc(oldDelegate),
805                                    new Boolean JavaDoc(this.delegate));
806
807     }
808
809
810     /**
811      * Returns true if the internal naming support is used.
812      */

813     public boolean isUseNaming() {
814
815         return (useNaming);
816
817     }
818
819
820     /**
821      * Enables or disables naming.
822      */

823     public void setUseNaming(boolean useNaming) {
824         this.useNaming = useNaming;
825     }
826
827
828     /**
829      * Returns true if the resources associated with this context are
830      * filesystem based.
831      */

832     public boolean isFilesystemBased() {
833
834         return (filesystemBased);
835
836     }
837
838
839     /**
840      * Return the set of initialized application event listener objects,
841      * in the order they were specified in the web application deployment
842      * descriptor, for this application.
843      *
844      * @exception IllegalStateException if this method is called before
845      * this application has started, or after it has been stopped
846      */

847     public Object JavaDoc[] getApplicationEventListeners() {
848         return (applicationEventListenersObjects);
849     }
850
851
852     /**
853      * Store the set of initialized application event listener objects,
854      * in the order they were specified in the web application deployment
855      * descriptor, for this application.
856      *
857      * @param listeners The set of instantiated listener objects.
858      */

859     public void setApplicationEventListeners(Object JavaDoc listeners[]) {
860         applicationEventListenersObjects = listeners;
861     }
862
863
864     /**
865      * Return the set of initialized application lifecycle listener objects,
866      * in the order they were specified in the web application deployment
867      * descriptor, for this application.
868      *
869      * @exception IllegalStateException if this method is called before
870      * this application has started, or after it has been stopped
871      */

872     public Object JavaDoc[] getApplicationLifecycleListeners() {
873         return (applicationLifecycleListenersObjects);
874     }
875
876
877     /**
878      * Store the set of initialized application lifecycle listener objects,
879      * in the order they were specified in the web application deployment
880      * descriptor, for this application.
881      *
882      * @param listeners The set of instantiated listener objects.
883      */

884     public void setApplicationLifecycleListeners(Object JavaDoc listeners[]) {
885         applicationLifecycleListenersObjects = listeners;
886     }
887
888
889     /**
890      * Return the antiJARLocking flag for this Context.
891      */

892     public boolean getAntiJARLocking() {
893
894         return (this.antiJARLocking);
895
896     }
897
898
899     /**
900      * Return the antiResourceLocking flag for this Context.
901      */

902     public boolean getAntiResourceLocking() {
903
904         return (this.antiResourceLocking);
905
906     }
907
908
909     /**
910      * Set the antiJARLocking feature for this Context.
911      *
912      * @param antiJARLocking The new flag value
913      */

914     public void setAntiJARLocking(boolean antiJARLocking) {
915
916         boolean oldAntiJARLocking = this.antiJARLocking;
917         this.antiJARLocking = antiJARLocking;
918         support.firePropertyChange("antiJARLocking",
919                                    new Boolean JavaDoc(oldAntiJARLocking),
920                                    new Boolean JavaDoc(this.antiJARLocking));
921
922     }
923
924
925     /**
926      * Set the antiResourceLocking feature for this Context.
927      *
928      * @param antiResourceLocking The new flag value
929      */

930     public void setAntiResourceLocking(boolean antiResourceLocking) {
931
932         boolean oldAntiResourceLocking = this.antiResourceLocking;
933         this.antiResourceLocking = antiResourceLocking;
934         support.firePropertyChange("antiResourceLocking",
935                                    new Boolean JavaDoc(oldAntiResourceLocking),
936                                    new Boolean JavaDoc(this.antiResourceLocking));
937
938     }
939
940
941     /**
942      * Return the application available flag for this Context.
943      */

944     public boolean getAvailable() {
945
946         return (this.available);
947
948     }
949
950
951     /**
952      * Set the application available flag for this Context.
953      *
954      * @param available The new application available flag
955      */

956     public void setAvailable(boolean available) {
957
958         boolean oldAvailable = this.available;
959         this.available = available;
960         support.firePropertyChange("available",
961                                    new Boolean JavaDoc(oldAvailable),
962                                    new Boolean JavaDoc(this.available));
963
964     }
965
966
967     /**
968      * Return the Locale to character set mapper for this Context.
969      */

970     public CharsetMapper getCharsetMapper() {
971
972         // Create a mapper the first time it is requested
973
if (this.charsetMapper == null) {
974             try {
975                 Class JavaDoc clazz = Class.forName(charsetMapperClass);
976                 this.charsetMapper =
977                   (CharsetMapper) clazz.newInstance();
978             } catch (Throwable JavaDoc t) {
979                 this.charsetMapper = new CharsetMapper();
980             }
981         }
982
983         return (this.charsetMapper);
984
985     }
986
987
988     /**
989      * Set the Locale to character set mapper for this Context.
990      *
991      * @param mapper The new mapper
992      */

993     public void setCharsetMapper(CharsetMapper mapper) {
994
995         CharsetMapper oldCharsetMapper = this.charsetMapper;
996         this.charsetMapper = mapper;
997 <