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

Method doPost

java/org/apache/catalina/servlets/DefaultServlet.java:632–661  ·  view source on GitHub ↗
(HttpServletRequest request, HttpServletResponse response)

Source from the content-addressed store, hash-verified

630
631
632 @Override
633 protected void doPost(HttpServletRequest request, HttpServletResponse response)
634 throws IOException, ServletException {
635 if (allowPostAsGet) {
636 doGet(request, response);
637 } else {
638 // Use a switch without a default to ensure all possibilities are explicitly handled
639 switch (request.getDispatcherType()) {
640 case ASYNC:
641 case REQUEST: {
642 // Direct POST requests may not be processed as GET
643 sendNotAllowed(request, response);
644 break;
645 }
646 case ERROR:
647 case FORWARD:
648 case INCLUDE: {
649 /*
650 * Forward and Include are processed as GET as it is possible that a POST to a servlet may use a
651 * forward or an include as part of generating the response.
652 *
653 * Error should have already been converted to GET but convert here anyway as that is better than
654 * failing the request.
655 */
656 doGet(request, response);
657 break;
658 }
659 }
660 }
661 }
662
663
664 @Override

Callers

nothing calls this directly

Calls 3

doGetMethod · 0.95
sendNotAllowedMethod · 0.95
getDispatcherTypeMethod · 0.65

Tested by

no test coverage detected