MCPcopy Create free account
hub / github.com/apache/tomcat / service

Method service

java/org/apache/jasper/servlet/JspServlet.java:246–298  ·  view source on GitHub ↗
(HttpServletRequest request, HttpServletResponse response)

Source from the content-addressed store, hash-verified

244
245
246 @Override
247 public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
248
249 // jspFile may be configured as an init-param for this servlet instance
250 String jspUri = jspFile;
251
252 if (jspUri == null) {
253 /*
254 * Check to see if the requested JSP has been the target of a RequestDispatcher.include()
255 */
256 jspUri = (String) request.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
257 if (jspUri != null) {
258 /*
259 * Requested JSP has been target of RequestDispatcher.include(). Its path is assembled from the relevant
260 * jakarta.servlet.include.* request attributes
261 */
262 String pathInfo = (String) request.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
263 if (pathInfo != null) {
264 jspUri += pathInfo;
265 }
266 } else {
267 /*
268 * Requested JSP has not been the target of a RequestDispatcher.include(). Reconstruct its path from the
269 * request's getServletPath() and getPathInfo()
270 */
271 jspUri = request.getServletPath();
272 String pathInfo = request.getPathInfo();
273 if (pathInfo != null) {
274 jspUri += pathInfo;
275 }
276 }
277 }
278
279 if (log.isTraceEnabled()) {
280 log.trace("JspEngine --> " + jspUri);
281 log.trace("\t ServletPath: " + request.getServletPath());
282 log.trace("\t PathInfo: " + request.getPathInfo());
283 log.trace("\t RealPath: " + context.getRealPath(jspUri));
284 log.trace("\t RequestURI: " + request.getRequestURI());
285 log.trace("\t QueryString: " + request.getQueryString());
286 }
287
288 try {
289 boolean precompile = preCompile(request);
290 serviceJspFile(request, response, jspUri, precompile);
291 } catch (RuntimeException | IOException | ServletException e) {
292 throw e;
293 } catch (Throwable t) {
294 ExceptionUtils.handleThrowable(t);
295 throw new ServletException(t);
296 }
297
298 }
299
300 @Override
301 public void destroy() {

Callers

nothing calls this directly

Calls 11

preCompileMethod · 0.95
serviceJspFileMethod · 0.95
handleThrowableMethod · 0.95
getAttributeMethod · 0.65
getServletPathMethod · 0.65
getPathInfoMethod · 0.65
isTraceEnabledMethod · 0.65
traceMethod · 0.65
getRealPathMethod · 0.65
getRequestURIMethod · 0.65
getQueryStringMethod · 0.65

Tested by

no test coverage detected