01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.desktop;
06:
07: import javax.servlet.ServletConfig;
08:
09: public class ServletConfigThreadLocalizer {
10: private static ThreadLocal servletConfigThreadLocal = new ThreadLocal();
11:
12: private ServletConfigThreadLocalizer() {
13: // nothing, cannot be called
14: }
15:
16: public static ServletConfig get() {
17: ServletConfig sc = (ServletConfig) servletConfigThreadLocal
18: .get();
19: return sc;
20: }
21:
22: public static void set(ServletConfig sc) {
23: servletConfigThreadLocal.set(sc);
24: }
25:
26: public static synchronized boolean exists() {
27: ServletConfig sc = (ServletConfig) servletConfigThreadLocal
28: .get();
29: if (sc != null)
30: return true;
31: else
32: return false;
33: }
34: }
|