1 4 package gnu.kawa.servlet; 5 import javax.servlet.*; 6 import javax.servlet.http.*; 7 import gnu.mapping.*; 8 9 public class ServletCallContext extends CallContext 10 { 11 public HttpServletRequest request; 12 public HttpServletResponse response; 13 public HttpServlet servlet; 14 15 static ServletCallContext getServletCallContext () 16 { 17 return (ServletCallContext) CallContext.getOnlyInstance(); 18 } 19 20 public static HttpServletRequest getRequest () 21 { 22 return getServletCallContext().request; 23 } 24 25 public static HttpServletResponse getResponse () 26 { 27 return getServletCallContext().response; 28 } 29 30 public static HttpServlet getServlet () 31 { 32 return getServletCallContext().servlet; 33 } 34 35 public static ServletConfig getServletConfig () 36 { 37 return getServletCallContext().servlet.getServletConfig(); 38 } 39 40 public static ServletContext getServletContext () 41 { 42 return getServletCallContext().servlet.getServletConfig().getServletContext(); 43 } 44 45 public String getBaseUri () 46 { 47 if (baseUri == null) 48 baseUri = request.getRequestURL().toString(); 49 return baseUri; 50 } 51 52 } 53 | Popular Tags |