4040import org .apache .tomcat .util .buf .ByteChunk ;
4141import org .apache .tomcat .util .buf .MessageBytes ;
4242import org .apache .tomcat .util .descriptor .web .LoginConfig ;
43+ import org .apache .tomcat .util .http .Method ;
4344import org .apache .tomcat .util .http .MimeHeaders ;
4445
4546/**
@@ -301,7 +302,7 @@ protected boolean doAuthenticate(Request request, HttpServletResponse response)
301302 // the landing page
302303 String uri = request .getContextPath () + landingPage ;
303304 SavedRequest saved = new SavedRequest ();
304- saved .setMethod (" GET" );
305+ saved .setMethod (Method . GET );
305306 saved .setRequestURI (uri );
306307 saved .setDecodedRequestURI (uri );
307308 request .getSessionInternal (true ).setNote (Constants .FORM_REQUEST_NOTE , saved );
@@ -326,7 +327,7 @@ protected boolean doAuthenticate(Request request, HttpServletResponse response)
326327 // the landing page
327328 String uri = request .getContextPath () + landingPage ;
328329 SavedRequest saved = new SavedRequest ();
329- saved .setMethod (" GET" );
330+ saved .setMethod (Method . GET );
330331 saved .setRequestURI (uri );
331332 saved .setDecodedRequestURI (uri );
332333 session .setNote (Constants .FORM_REQUEST_NOTE , saved );
@@ -443,7 +444,7 @@ protected void forwardToLoginPage(Request request, HttpServletResponse response,
443444
444445 // Always use GET for the login page, regardless of the method used
445446 String oldMethod = request .getMethod ();
446- request .getCoyoteRequest ().method (). setString ( " GET" );
447+ request .getCoyoteRequest ().setMethod ( Method . GET );
447448
448449 RequestDispatcher disp = context .getServletContext ().getRequestDispatcher (loginPage );
449450 try {
@@ -459,7 +460,7 @@ protected void forwardToLoginPage(Request request, HttpServletResponse response,
459460 response .sendError (HttpServletResponse .SC_INTERNAL_SERVER_ERROR , msg );
460461 } finally {
461462 // Restore original method so that it is written into access log
462- request .getCoyoteRequest ().method (). setString (oldMethod );
463+ request .getCoyoteRequest ().setMethod (oldMethod );
463464 }
464465 }
465466
@@ -585,7 +586,7 @@ protected boolean restoreRequest(Request request, Session session) throws IOExce
585586 String method = saved .getMethod ();
586587 MimeHeaders rmh = request .getCoyoteRequest ().getMimeHeaders ();
587588 rmh .recycle ();
588- boolean cacheable = " GET" . equalsIgnoreCase (method ) || " HEAD" . equalsIgnoreCase (method );
589+ boolean cacheable = Method . GET . equals (method ) || Method . HEAD . equals (method );
589590 Iterator <String > names = saved .getHeaderNames ();
590591 while (names .hasNext ()) {
591592 String name = names .next ();
@@ -619,15 +620,15 @@ protected boolean restoreRequest(Request request, Session session) throws IOExce
619620
620621 // If no content type specified, use default for POST
621622 String savedContentType = saved .getContentType ();
622- if (savedContentType == null && " POST" . equalsIgnoreCase (method )) {
623+ if (savedContentType == null && Method . POST . equals (method )) {
623624 savedContentType = Globals .CONTENT_TYPE_FORM_URL_ENCODING ;
624625 }
625626
626627 contentType .setString (savedContentType );
627628 request .getCoyoteRequest ().setContentType (contentType );
628629 }
629630
630- request .getCoyoteRequest ().method (). setString (method );
631+ request .getCoyoteRequest ().setMethod (method );
631632 // The method, URI, queryString and protocol are normally stored as
632633 // bytes in the HttpInputBuffer and converted lazily to String. At this
633634 // point, the method has already been set as String in the line above
0 commit comments