1 5 package com.opensymphony.webwork; 6 7 import com.opensymphony.xwork.ActionContext; 8 9 import javax.servlet.ServletContext ; 10 import javax.servlet.http.HttpServletRequest ; 11 import javax.servlet.http.HttpServletResponse ; 12 import javax.servlet.jsp.PageContext ; 13 import java.util.Map ; 14 15 16 24 public class ServletActionContext extends ActionContext implements WebWorkStatics { 25 public static final String WEBWORK_VALUESTACK_KEY = "webwork.valueStack"; 26 28 private ServletActionContext(Map context) { 29 super(context); 30 } 31 32 34 39 public static PageContext getPageContext() { 40 return (PageContext ) ActionContext.getContext().get(PAGE_CONTEXT); 41 } 42 43 48 public static void setRequest(HttpServletRequest request) { 49 ActionContext.getContext().put(HTTP_REQUEST, request); 50 } 51 52 57 public static HttpServletRequest getRequest() { 58 return (HttpServletRequest ) ActionContext.getContext().get(HTTP_REQUEST); 59 } 60 61 66 public static void setResponse(HttpServletResponse response) { 67 ActionContext.getContext().put(HTTP_RESPONSE, response); 68 } 69 70 75 public static HttpServletResponse getResponse() { 76 return (HttpServletResponse ) ActionContext.getContext().get(HTTP_RESPONSE); 77 } 78 79 84 public static ServletContext getServletContext() { 85 return (ServletContext ) ActionContext.getContext().get(SERVLET_CONTEXT); 86 } 87 88 public static void setServletContext(ServletContext servletContext) { 89 ActionContext.getContext().put(SERVLET_CONTEXT, servletContext); 90 } 91 } 92 | Popular Tags |