1 5 package com.opensymphony.webwork.views.jsp; 6 7 import javax.servlet.RequestDispatcher ; 8 import javax.servlet.Servlet ; 9 import javax.servlet.ServletContext ; 10 import javax.servlet.ServletException ; 11 import java.io.InputStream ; 12 import java.net.MalformedURLException ; 13 import java.net.URL ; 14 import java.util.*; 15 16 17 23 public class WebWorkMockServletContext implements ServletContext { 24 25 String realPath; 26 String servletInfo; 27 Map initParams = new HashMap(); 28 Map attributes = new HashMap(); 29 30 public void setInitParameter(String name, String value) { 31 initParams.put(name, value); 32 } 33 34 public void setRealPath(String value) { 35 realPath = value; 36 } 37 38 public String getRealPath(String string) { 39 return realPath; 40 } 41 42 public ServletContext getContext(String s) { 43 return null; 44 } 45 46 public int getMajorVersion() { 47 return 0; 48 } 49 50 public int getMinorVersion() { 51 return 0; 52 } 53 54 public String getMimeType(String s) { 55 return null; 56 } 57 58 public Set getResourcePaths(String s) { 59 return null; 60 } 61 62 public URL getResource(String s) throws MalformedURLException { 63 return null; 64 } 65 66 public InputStream getResourceAsStream(String s) { 67 return null; 68 } 69 70 public RequestDispatcher getRequestDispatcher(String s) { 71 return null; 72 } 73 74 public RequestDispatcher getNamedDispatcher(String s) { 75 return null; 76 } 77 78 public Servlet getServlet(String s) throws ServletException { 79 return null; 80 } 81 82 public Enumeration getServlets() { 83 return null; 84 } 85 86 public Enumeration getServletNames() { 87 return null; 88 } 89 90 public void log(String s) { 91 } 92 93 public void log(Exception e, String s) { 94 } 95 96 public void log(String s, Throwable throwable) { 97 } 98 99 public String getServerInfo() { 100 return servletInfo; 101 } 102 103 public String getInitParameter(String s) { 104 return (String ) initParams.get(s); 105 } 106 107 public Enumeration getInitParameterNames() { 108 return Collections.enumeration(initParams.keySet()); 109 } 110 111 public Object getAttribute(String s) { 112 return attributes.get(s); 113 } 114 115 public Enumeration getAttributeNames() { 116 return Collections.enumeration(attributes.keySet()); 117 } 118 119 public void setAttribute(String s, Object o) { 120 attributes.put(s, o); 121 } 122 123 public void removeAttribute(String s) { 124 attributes.remove(s); 125 } 126 127 public String getServletContextName() { 128 return null; 129 } 130 131 public void setServletInfo(String servletInfo) { 132 this.servletInfo = servletInfo; 133 } 134 } 135 | Popular Tags |