1 package org.apache.beehive.controls.runtime.servlet; 2 19 20 import javax.servlet.ServletContext ; 21 22 import org.apache.beehive.controls.api.context.ControlContainerContext; 23 import org.apache.beehive.controls.api.context.ControlThreadContext; 24 25 32 class ServletContextService implements ServletContext 33 { 34 35 ServletContextService(ServletBeanContext beanContext) 36 { 37 _beanContext = beanContext; 38 } 39 40 45 final protected ServletBeanContext getServletBeanContext() 46 { 47 if (_beanContext == null) 48 { 49 ControlContainerContext ccc = ControlThreadContext.getContext(); 50 if (! (ccc instanceof ServletBeanContext)) 51 throw new IllegalStateException ("No ServletBeanContext available"); 52 53 _beanContext = (ServletBeanContext)ccc; 54 } 55 return _beanContext; 56 } 57 58 final protected ServletContext getServletContext() 59 { 60 ServletContext servletContext = getServletBeanContext().getServletContext(); 61 if (servletContext == null) 62 throw new IllegalStateException ("No access to ServletContext outside request processing"); 63 return servletContext; 64 } 65 66 public java.lang.Object getAttribute(java.lang.String name) 67 { 68 return getServletContext().getAttribute(name); 69 } 70 71 public java.util.Enumeration getAttributeNames() 72 { 73 return getServletContext().getAttributeNames(); 74 } 75 76 public ServletContext getContext(java.lang.String uripath) 77 { 78 return getServletContext().getContext(uripath); 79 } 80 81 public java.lang.String getInitParameter(java.lang.String name) 82 { 83 return getServletContext().getInitParameter(name); 84 } 85 86 public java.util.Enumeration getInitParameterNames() 87 { 88 return getServletContext().getInitParameterNames(); 89 } 90 91 public int getMajorVersion() 92 { 93 return getServletContext().getMajorVersion(); 94 } 95 96 public java.lang.String getMimeType(java.lang.String file) 97 { 98 return getServletContext().getMimeType(file); 99 } 100 101 public int getMinorVersion() 102 { 103 return getServletContext().getMinorVersion(); 104 } 105 106 public javax.servlet.RequestDispatcher getNamedDispatcher(java.lang.String name) 107 { 108 return getServletContext().getNamedDispatcher(name); 109 } 110 111 public java.lang.String getRealPath(java.lang.String path) 112 { 113 return getServletContext().getRealPath(path); 114 } 115 116 public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path) 117 { 118 return getServletContext().getRequestDispatcher(path); 119 } 120 121 public java.net.URL getResource(java.lang.String path) throws java.net.MalformedURLException 122 { 123 return getServletContext().getResource(path); 124 } 125 126 public java.io.InputStream getResourceAsStream(java.lang.String path) 127 { 128 return getServletContext().getResourceAsStream(path); 129 } 130 131 public java.util.Set getResourcePaths(java.lang.String path) 132 { 133 return getServletContext().getResourcePaths(path); 134 } 135 136 public java.lang.String getServerInfo() 137 { 138 return getServletContext().getServerInfo(); 139 } 140 141 public javax.servlet.Servlet getServlet(java.lang.String name) throws javax.servlet.ServletException 142 { 143 return getServletContext().getServlet(name); 144 } 145 146 public java.lang.String getServletContextName() 147 { 148 return getServletContext().getServletContextName(); 149 } 150 151 public java.util.Enumeration getServletNames() 152 { 153 return getServletContext().getServletNames(); 154 } 155 156 public java.util.Enumeration getServlets() 157 { 158 return getServletContext().getServlets(); 159 } 160 161 public void log(java.lang.String msg) 162 { 163 getServletContext().log(msg); 164 } 165 166 public void log(java.lang.Exception exception, java.lang.String msg) 167 { 168 getServletContext().log(exception, msg); 169 } 170 171 public void log(java.lang.String message, java.lang.Throwable throwable) 172 { 173 getServletContext().log(message, throwable); 174 } 175 176 public void removeAttribute(java.lang.String name) 177 { 178 getServletContext().removeAttribute(name); 179 } 180 181 public void setAttribute(java.lang.String name, java.lang.Object object) 182 { 183 getServletContext().setAttribute(name, object); 184 } 185 186 transient private ServletBeanContext _beanContext; } 188 | Popular Tags |