001    package railo.runtime.engine;
002    
003    import railo.runtime.config.Config;
004    
005    /**
006     * class to handle thread local PageContext, 
007     * do use pagecontext in classes that have no method argument pagecontext
008     */
009    public final class ThreadLocalConfig {
010    
011            private static ThreadLocal cThreadLocal=new ThreadLocal();
012    
013            /**
014             * register a Config for he current thread
015             * @param config Config to register
016             */
017            public static void register(Config config) {
018                    cThreadLocal.set(config);
019            }
020    
021            /**
022             * returns Config registered for the current thread
023             * @return Config for the current thread or null 
024             */
025            static Config get() {
026                    return (Config) cThreadLocal.get();
027            }
028            
029            /**
030             * release the pagecontext for the current thread
031             */
032            public static void release() {
033                    cThreadLocal.set(null);
034            }
035    }