1 28 29 package com.caucho.jsf.context; 30 31 import java.io.*; 32 import java.net.URL ; 33 import java.net.MalformedURLException ; 34 import java.util.*; 35 import java.security.*; 36 37 import javax.faces.*; 38 import javax.faces.context.*; 39 40 import javax.servlet.*; 41 import javax.servlet.http.*; 42 43 import com.caucho.server.connection.*; 44 45 public class ServletExternalContext extends ExternalContext { 46 private ServletContext _webApp; 47 private HttpServletRequest _request; 48 private HttpServletResponse _response; 49 50 ServletExternalContext(ServletContext webApp, 51 HttpServletRequest request, 52 HttpServletResponse response) 53 { 54 _webApp = webApp; 55 _request = request; 56 _response = response; 57 } 58 59 public void dispatch(String path) 60 throws IOException 61 { 62 try { 63 _request.getRequestDispatcher(path).include(_request, _response); 64 } catch (ServletException e) { 65 throw new FacesException(e); 66 } 67 } 68 69 public String encodeActionURL(String url) 70 { 71 throw new UnsupportedOperationException (); 72 } 73 74 public String encodeNamespace(String name) 75 { 76 throw new UnsupportedOperationException (); 77 } 78 79 public String encodeResourceURL(String url) 80 { 81 throw new UnsupportedOperationException (); 82 } 83 84 public Map<String ,Object > getApplicationMap() 85 { 86 throw new UnsupportedOperationException (); 87 } 88 89 public String getAuthType() 90 { 91 throw new UnsupportedOperationException (); 92 } 93 94 public Object getContext() 95 { 96 return _webApp; 97 } 98 99 public String getInitParameter(String name) 100 { 101 throw new UnsupportedOperationException (); 102 } 103 104 public Map getInitParameterMap() 105 { 106 throw new UnsupportedOperationException (); 107 } 108 109 public String getRemoteUser() 110 { 111 throw new UnsupportedOperationException (); 112 } 113 114 public Object getRequest() 115 { 116 return _request; 117 } 118 119 122 public void setRequest(Object request) 123 { 124 _request = (HttpServletRequest) request; 125 } 126 127 130 public void setRequestCharacterEncoding(String encoding) 131 throws UnsupportedEncodingException 132 { 133 _request.setCharacterEncoding(encoding); 134 } 135 136 public String getRequestContextPath() 137 { 138 return _request.getContextPath(); 139 } 140 141 public Map<String ,Object > getRequestCookieMap() 142 { 143 throw new UnsupportedOperationException (); 144 } 145 146 public Map<String ,String > getRequestHeaderMap() 147 { 148 throw new UnsupportedOperationException (); 149 } 150 151 public Map<String ,String []> getRequestHeaderValuesMap() 152 { 153 throw new UnsupportedOperationException (); 154 } 155 156 public Locale getRequestLocale() 157 { 158 throw new UnsupportedOperationException (); 159 } 160 161 public Iterator<Locale> getRequestLocales() 162 { 163 throw new UnsupportedOperationException (); 164 } 165 166 public Map<String ,Object > getRequestMap() 167 { 168 throw new UnsupportedOperationException (); 169 } 170 171 public Map<String ,String > getRequestParameterMap() 172 { 173 throw new UnsupportedOperationException (); 174 } 175 176 public Iterator<String > getRequestParameterNames() 177 { 178 throw new UnsupportedOperationException (); 179 } 180 181 public Map<String ,String []> getRequestParameterValuesMap() 182 { 183 throw new UnsupportedOperationException (); 184 } 185 186 public String getRequestPathInfo() 187 { 188 if (_request instanceof CauchoRequest) { 189 return ((CauchoRequest) _request).getPagePathInfo(); 190 } 191 else { 192 194 return _request.getPathInfo(); 195 } 196 } 197 198 public String getRequestServletPath() 199 { 200 if (_request instanceof CauchoRequest) { 201 return ((CauchoRequest) _request).getPageServletPath(); 202 } 203 else { 204 206 return _request.getServletPath(); 207 } 208 } 209 210 213 public String getRequestCharacterEncoding() 214 { 215 throw new UnsupportedOperationException (getClass().getName()); 216 } 217 218 221 public String getRequestContentType() 222 { 223 throw new UnsupportedOperationException (getClass().getName()); 224 } 225 226 229 public String getResponseCharacterEncoding() 230 { 231 throw new UnsupportedOperationException (getClass().getName()); 232 } 233 234 237 public String getResponseContentType() 238 { 239 return _response.getContentType(); 240 } 241 242 public URL getResource(String path) 243 throws MalformedURLException 244 { 245 return _webApp.getResource(path); 246 } 247 248 public InputStream getResourceAsStream(String path) 249 { 250 return _webApp.getResourceAsStream(path); 251 } 252 253 public Set<String > getResourcePath(String path) 254 { 255 throw new UnsupportedOperationException (); 256 } 257 258 public Object getResponse() 259 { 260 return _response; 261 } 262 263 266 public void setResponse(Object response) 267 { 268 throw new UnsupportedOperationException (getClass().getName()); 269 } 270 271 274 public void setResponseCharacterEncoding(String encoding) 275 { 276 throw new UnsupportedOperationException (getClass().getName()); 277 } 278 279 public Object getSession(boolean create) 280 { 281 throw new UnsupportedOperationException (); 282 } 283 284 public Map<String ,Object > getSessionMap() 285 { 286 throw new UnsupportedOperationException (); 287 } 288 289 public Principal getUserPrincipal() 290 { 291 throw new UnsupportedOperationException (); 292 } 293 294 public boolean isUserInRole(String role) 295 { 296 throw new UnsupportedOperationException (); 297 } 298 299 public void log(String message) 300 { 301 throw new UnsupportedOperationException (); 302 } 303 304 public void log(String message, Throwable exn) 305 { 306 throw new UnsupportedOperationException (); 307 } 308 309 public void redirect(String url) 310 throws IOException 311 { 312 throw new UnsupportedOperationException (); 313 } 314 } 315 316 | Popular Tags |