7070import hudson .util .HttpResponses ;
7171import hudson .views .DefaultViewsTabBar ;
7272import hudson .views .ViewsTabBar ;
73+ import io .jenkins .servlet .ServletExceptionWrapper ;
74+ import jakarta .servlet .ServletException ;
75+ import jakarta .servlet .http .HttpServletResponse ;
7376import java .io .File ;
7477import java .io .FileNotFoundException ;
7578import java .io .IOException ;
9497import java .util .logging .Logger ;
9598import edu .umd .cs .findbugs .annotations .CheckForNull ;
9699import edu .umd .cs .findbugs .annotations .NonNull ;
97- import javax .servlet .ServletException ;
98100import jenkins .model .DirectlyModifiableTopLevelItemGroup ;
99101import jenkins .model .Jenkins ;
100102import jenkins .model .ModelObjectWithChildren ;
101103import jenkins .model .ProjectNamingStrategy ;
102104import jenkins .model .TransientActionFactory ;
105+ import jenkins .security .stapler .StaplerNotDispatchable ;
103106import net .sf .json .JSONObject ;
104107import org .kohsuke .accmod .Restricted ;
105108import org .kohsuke .accmod .restrictions .Beta ;
110113import org .kohsuke .stapler .StaplerFallback ;
111114import org .kohsuke .stapler .StaplerOverridable ;
112115import org .kohsuke .stapler .StaplerRequest ;
116+ import org .kohsuke .stapler .StaplerRequest2 ;
113117import org .kohsuke .stapler .StaplerResponse ;
118+ import org .kohsuke .stapler .StaplerResponse2 ;
114119import org .kohsuke .stapler .export .Exported ;
115120import org .kohsuke .stapler .interceptor .RequirePOST ;
116121import org .kohsuke .stapler .verb .POST ;
@@ -723,7 +728,25 @@ private ItemGroup<?> grp() {
723728 * {@inheritDoc}
724729 */
725730 @ Override
731+ public ContextMenu doChildrenContextMenu (StaplerRequest2 request , StaplerResponse2 response ) {
732+ if (Util .isOverridden (AbstractFolder .class , getClass (), "doChildrenContextMenu" , StaplerRequest .class , StaplerResponse .class )) {
733+ return doChildrenContextMenu (request != null ? StaplerRequest .fromStaplerRequest2 (request ) : null , response != null ? StaplerResponse .fromStaplerResponse2 (response ) : null );
734+ } else {
735+ return doChildrenContextMenuImpl (request , response );
736+ }
737+ }
738+
739+ /**
740+ * @deprecated use {@link #doChildrenContextMenu(StaplerRequest2, StaplerResponse2)}
741+ */
742+ @ Deprecated
743+ @ Override
744+ @ StaplerNotDispatchable
726745 public ContextMenu doChildrenContextMenu (StaplerRequest request , StaplerResponse response ) {
746+ return doChildrenContextMenuImpl (request != null ? StaplerRequest .toStaplerRequest2 (request ) : null , response != null ? StaplerResponse .toStaplerResponse2 (response ) : null );
747+ }
748+
749+ private ContextMenu doChildrenContextMenuImpl (StaplerRequest2 request , StaplerResponse2 response ) {
727750 ContextMenu menu = new ContextMenu ();
728751 for (View view : getViews ()) {
729752 menu .add (view .getAbsoluteUrl (),view .getDisplayName ());
@@ -732,7 +755,34 @@ public ContextMenu doChildrenContextMenu(StaplerRequest request, StaplerResponse
732755 }
733756
734757 @ POST
758+ public synchronized void doCreateView (StaplerRequest2 req , StaplerResponse2 rsp )
759+ throws IOException , ServletException , ParseException , Descriptor .FormException {
760+ if (Util .isOverridden (AbstractFolder .class , getClass (), "doCreateView" , StaplerRequest .class , StaplerResponse .class )) {
761+ try {
762+ doCreateView (req != null ? StaplerRequest .fromStaplerRequest2 (req ) : null , rsp != null ? StaplerResponse .fromStaplerResponse2 (rsp ) : null );
763+ } catch (javax .servlet .ServletException e ) {
764+ throw ServletExceptionWrapper .toJakartaServletException (e );
765+ }
766+ } else {
767+ doCreateViewImpl (req , rsp );
768+ }
769+ }
770+
771+ /**
772+ * @deprecated use {@link #doCreateView(StaplerRequest2, StaplerResponse2)}
773+ */
774+ @ Deprecated
775+ @ StaplerNotDispatchable
735776 public synchronized void doCreateView (StaplerRequest req , StaplerResponse rsp )
777+ throws IOException , javax .servlet .ServletException , ParseException , Descriptor .FormException {
778+ try {
779+ doCreateViewImpl (req != null ? StaplerRequest .toStaplerRequest2 (req ) : null , rsp != null ? StaplerResponse .toStaplerResponse2 (rsp ) : null );
780+ } catch (ServletException e ) {
781+ throw ServletExceptionWrapper .fromJakartaServletException (e );
782+ }
783+ }
784+
785+ private void doCreateViewImpl (StaplerRequest2 req , StaplerResponse2 rsp )
736786 throws IOException , ServletException , ParseException , Descriptor .FormException {
737787 checkPermission (View .CREATE );
738788 addView (View .create (req , rsp , this ));
@@ -854,7 +904,24 @@ public DescribableList<FolderHealthMetric, FolderHealthMetricDescriptor> getHeal
854904 return healthMetrics ;
855905 }
856906
907+ public HttpResponse doLastBuild (StaplerRequest2 req ) {
908+ if (Util .isOverridden (AbstractFolder .class , getClass (), "doLastBuild" , StaplerRequest .class )) {
909+ return doLastBuild (req != null ? StaplerRequest .fromStaplerRequest2 (req ) : null );
910+ } else {
911+ return doLastBuildImpl (req );
912+ }
913+ }
914+
915+ /**
916+ * @deprecated use {@link #doLastBuild(StaplerRequest2)}
917+ */
918+ @ Deprecated
919+ @ StaplerNotDispatchable
857920 public HttpResponse doLastBuild (StaplerRequest req ) {
921+ return doLastBuildImpl (req != null ? StaplerRequest .toStaplerRequest2 (req ) : null );
922+ }
923+
924+ private HttpResponse doLastBuildImpl (StaplerRequest2 req ) {
858925 return HttpResponses .redirectToDot ();
859926 }
860927
@@ -1086,13 +1153,39 @@ public void renameTo(String newName) throws IOException {
10861153 * {@inheritDoc}
10871154 */
10881155 @ Override
1089- public synchronized void doSubmitDescription (StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException {
1156+ public synchronized void doSubmitDescription (StaplerRequest2 req , StaplerResponse2 rsp ) throws IOException , ServletException {
1157+ if (Util .isOverridden (AbstractFolder .class , getClass (), "doSubmitDescription" , StaplerRequest .class , StaplerResponse .class )) {
1158+ try {
1159+ doSubmitDescription (req != null ? StaplerRequest .fromStaplerRequest2 (req ) : null , rsp != null ? StaplerResponse .fromStaplerResponse2 (rsp ) : null );
1160+ } catch (javax .servlet .ServletException e ) {
1161+ throw ServletExceptionWrapper .toJakartaServletException (e );
1162+ }
1163+ } else {
1164+ doSubmitDescriptionImpl (req , rsp );
1165+ }
1166+ }
1167+
1168+ /**
1169+ * @deprecated use {@link #doSubmitDescription(StaplerRequest2, StaplerResponse2)}
1170+ */
1171+ @ Deprecated
1172+ @ Override
1173+ @ StaplerNotDispatchable
1174+ public synchronized void doSubmitDescription (StaplerRequest req , StaplerResponse rsp ) throws IOException , javax .servlet .ServletException {
1175+ try {
1176+ doSubmitDescriptionImpl (req != null ? StaplerRequest .toStaplerRequest2 (req ) : null , rsp != null ? StaplerResponse .toStaplerResponse2 (rsp ) : null );
1177+ } catch (ServletException e ) {
1178+ throw ServletExceptionWrapper .fromJakartaServletException (e );
1179+ }
1180+ }
1181+
1182+ private void doSubmitDescriptionImpl (StaplerRequest2 req , StaplerResponse2 rsp ) throws IOException , ServletException {
10901183 getPrimaryView ().doSubmitDescription (req , rsp );
10911184 }
10921185
10931186 @ Restricted (NoExternalUse .class )
10941187 @ RequirePOST
1095- public void doConfigSubmit (StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException , Descriptor .FormException {
1188+ public void doConfigSubmit (StaplerRequest2 req , StaplerResponse2 rsp ) throws IOException , ServletException , Descriptor .FormException {
10961189 checkPermission (CONFIGURE );
10971190
10981191 req .setCharacterEncoding ("UTF-8" );
@@ -1141,15 +1234,29 @@ public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOExc
11411234 *
11421235 * @return A string that represents the redirect location URL.
11431236 *
1144- * @see javax.servlet.http. HttpServletResponse#sendRedirect(String)
1237+ * @see HttpServletResponse#sendRedirect(String)
11451238 */
11461239 @ Restricted (NoExternalUse .class )
11471240 @ NonNull
11481241 protected String getSuccessfulDestination () {
11491242 return "." ;
11501243 }
11511244
1152- protected void submit (StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException , Descriptor .FormException {}
1245+ protected void submit (StaplerRequest2 req , StaplerResponse2 rsp ) throws IOException , ServletException , Descriptor .FormException {
1246+ if (Util .isOverridden (AbstractFolder .class , getClass (), "submit" , StaplerRequest .class , StaplerResponse .class )) {
1247+ try {
1248+ submit (req != null ? StaplerRequest .fromStaplerRequest2 (req ) : null , rsp != null ? StaplerResponse .fromStaplerResponse2 (rsp ) : null );
1249+ } catch (javax .servlet .ServletException e ) {
1250+ throw ServletExceptionWrapper .toJakartaServletException (e );
1251+ }
1252+ }
1253+ }
1254+
1255+ /**
1256+ * @deprecated use {@link #submit(StaplerRequest2, StaplerResponse2)}
1257+ */
1258+ @ Deprecated
1259+ protected void submit (StaplerRequest req , StaplerResponse rsp ) throws IOException , javax .servlet .ServletException , Descriptor .FormException {}
11531260
11541261 /**
11551262 * {@inheritDoc}
0 commit comments