| 26 | import javax.servlet.http.HttpServlet; |
| 27 | |
| 28 | public class ShellServlet extends HttpServlet |
| 29 | { |
| 30 | private static final String VERSION = "ver. 2.1"; |
| 31 | private static final String CPR = "© <a href=mailto:info@servletsuite.com>Coldbeans</a> "; |
| 32 | private static Object SessionIdLock; |
| 33 | private static final int HOW_LONG = 6; |
| 34 | private static final int MAX_WML = 900; |
| 35 | private static final String DEFBGCOLOR = "#000000"; |
| 36 | private static final String DEFBGCOLOR1 = "#D3D3D3"; |
| 37 | private static final String DEFFGCOLOR = "#008000"; |
| 38 | private static final String DEFFGCOLOR1 = "#000000"; |
| 39 | private static final String DEFFRAMES = "80%,20%"; |
| 40 | private static final String DEFTITLE = "Coldbeans Shell Servlet"; |
| 41 | private static final String DEFPREFIX = ""; |
| 42 | private static final String CONFIG = "config"; |
| 43 | private static final String FICT = "fct"; |
| 44 | private static final String CMD = "cmd"; |
| 45 | private static final String ACTION = "act"; |
| 46 | private static final String UPFRAME = "1"; |
| 47 | private static final String DOWNFRAME = "2"; |
| 48 | private static final String RUNCMD = "3"; |
| 49 | private static final String HISTORY = "4"; |
| 50 | private static final String TITLE = "title"; |
| 51 | private static final String PREFIX = "prefix"; |
| 52 | private static final String BGCOLOR = "bgcolor"; |
| 53 | private static final String BGCOLOR1 = "bgcolor1"; |
| 54 | private static final String FGCOLOR = "fgcolor"; |
| 55 | private static final String FGCOLOR1 = "fgcolor1"; |
| 56 | private static final String FACE = "face"; |
| 57 | private static final String SIZE = "size"; |
| 58 | private static final String FRAMES = "frames"; |
| 59 | private static String NEWLINE; |
| 60 | private static String separator; |
| 61 | private static String OS; |
| 62 | private ServletContext context; |
| 63 | private Hashtable cnf; |
| 64 | |
| 65 | public void init(final ServletConfig servletConfig) throws ServletException { |
| 66 | super.init(servletConfig); |
| 67 | this.context = servletConfig.getServletContext(); |
| 68 | ShellServlet.NEWLINE = System.getProperty("line.separator"); |
| 69 | ShellServlet.separator = System.getProperty("file.separator"); |
| 70 | this.cnf = new Hashtable(); |
| 71 | this.readConfig(this.getInitParameter("config"), this.cnf); |
| 72 | } |
| 73 | |
| 74 | public void doPost(final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws ServletException, IOException { |
| 75 | if (httpServletRequest.getContentLength() > 20480) { |
| 76 | httpServletResponse.setContentType("text/html"); |
| 77 | final ServletOutputStream outputStream = httpServletResponse.getOutputStream(); |
| 78 | outputStream.println("<html><head><title>Too big</title></head>"); |
| 79 | outputStream.println("<body><h1>Error - content length >20k not "); |
| 80 | outputStream.println("</h1></body></html>"); |
| 81 | } |
| 82 | else { |
| 83 | this.doGet(httpServletRequest, httpServletResponse); |
| 84 | } |
| 85 | } |
nothing calls this directly
no outgoing calls
no test coverage detected