Process our request and locate right SSI command. @param req a value of type 'HttpServletRequest' @param res a value of type 'HttpServletResponse' @throws IOException an IO error occurred
(HttpServletRequest req, HttpServletResponse res)
| 145 | * @throws IOException an IO error occurred |
| 146 | */ |
| 147 | protected void requestHandler(HttpServletRequest req, HttpServletResponse res) throws IOException { |
| 148 | ServletContext servletContext = getServletContext(); |
| 149 | String path = SSIServletRequestUtil.getRelativePath(req); |
| 150 | if (debug > 0) { |
| 151 | log("SSIServlet.requestHandler()\n" + "Serving " + (buffered ? "buffered " : "unbuffered ") + "resource '" + |
| 152 | path + "'"); |
| 153 | } |
| 154 | // Exclude any resource in the /WEB-INF and /META-INF subdirectories |
| 155 | // (the "toUpperCase()" avoids problems on Windows systems) |
| 156 | if (path == null || path.toUpperCase(Locale.ENGLISH).startsWith("/WEB-INF") || |
| 157 | path.toUpperCase(Locale.ENGLISH).startsWith("/META-INF")) { |
| 158 | res.sendError(HttpServletResponse.SC_NOT_FOUND); |
| 159 | return; |
| 160 | } |
| 161 | URL resource = servletContext.getResource(path); |
| 162 | if (resource == null) { |
| 163 | res.sendError(HttpServletResponse.SC_NOT_FOUND); |
| 164 | return; |
| 165 | } |
| 166 | String resourceMimeType = servletContext.getMimeType(path); |
| 167 | if (resourceMimeType == null) { |
| 168 | resourceMimeType = "text/html"; |
| 169 | } |
| 170 | res.setContentType(resourceMimeType + ";charset=" + outputEncoding); |
| 171 | if (expires != null) { |
| 172 | res.setDateHeader("Expires", (new java.util.Date()).getTime() + expires.longValue() * 1000); |
| 173 | } |
| 174 | processSSI(req, res, resource); |
| 175 | } |
| 176 | |
| 177 | |
| 178 | /** |
no test coverage detected