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 ));
@@ -860,7 +910,24 @@ public DescribableList<FolderHealthMetric, FolderHealthMetricDescriptor> getHeal
860910 return healthMetrics ;
861911 }
862912
913+ public HttpResponse doLastBuild (StaplerRequest2 req ) {
914+ if (Util .isOverridden (AbstractFolder .class , getClass (), "doLastBuild" , StaplerRequest .class )) {
915+ return doLastBuild (req != null ? StaplerRequest .fromStaplerRequest2 (req ) : null );
916+ } else {
917+ return doLastBuildImpl (req );
918+ }
919+ }
920+
921+ /**
922+ * @deprecated use {@link #doLastBuild(StaplerRequest2)}
923+ */
924+ @ Deprecated
925+ @ StaplerNotDispatchable
863926 public HttpResponse doLastBuild (StaplerRequest req ) {
927+ return doLastBuildImpl (req != null ? StaplerRequest .toStaplerRequest2 (req ) : null );
928+ }
929+
930+ private HttpResponse doLastBuildImpl (StaplerRequest2 req ) {
864931 return HttpResponses .redirectToDot ();
865932 }
866933
@@ -1092,13 +1159,39 @@ public void renameTo(String newName) throws IOException {
10921159 * {@inheritDoc}
10931160 */
10941161 @ Override
1095- public synchronized void doSubmitDescription (StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException {
1162+ public synchronized void doSubmitDescription (StaplerRequest2 req , StaplerResponse2 rsp ) throws IOException , ServletException {
1163+ if (Util .isOverridden (AbstractFolder .class , getClass (), "doSubmitDescription" , StaplerRequest .class , StaplerResponse .class )) {
1164+ try {
1165+ doSubmitDescription (req != null ? StaplerRequest .fromStaplerRequest2 (req ) : null , rsp != null ? StaplerResponse .fromStaplerResponse2 (rsp ) : null );
1166+ } catch (javax .servlet .ServletException e ) {
1167+ throw ServletExceptionWrapper .toJakartaServletException (e );
1168+ }
1169+ } else {
1170+ doSubmitDescriptionImpl (req , rsp );
1171+ }
1172+ }
1173+
1174+ /**
1175+ * @deprecated use {@link #doSubmitDescription(StaplerRequest2, StaplerResponse2)}
1176+ */
1177+ @ Deprecated
1178+ @ Override
1179+ @ StaplerNotDispatchable
1180+ public synchronized void doSubmitDescription (StaplerRequest req , StaplerResponse rsp ) throws IOException , javax .servlet .ServletException {
1181+ try {
1182+ doSubmitDescriptionImpl (req != null ? StaplerRequest .toStaplerRequest2 (req ) : null , rsp != null ? StaplerResponse .toStaplerResponse2 (rsp ) : null );
1183+ } catch (ServletException e ) {
1184+ throw ServletExceptionWrapper .fromJakartaServletException (e );
1185+ }
1186+ }
1187+
1188+ private void doSubmitDescriptionImpl (StaplerRequest2 req , StaplerResponse2 rsp ) throws IOException , ServletException {
10961189 getPrimaryView ().doSubmitDescription (req , rsp );
10971190 }
10981191
10991192 @ Restricted (NoExternalUse .class )
11001193 @ RequirePOST
1101- public void doConfigSubmit (StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException , Descriptor .FormException {
1194+ public void doConfigSubmit (StaplerRequest2 req , StaplerResponse2 rsp ) throws IOException , ServletException , Descriptor .FormException {
11021195 checkPermission (CONFIGURE );
11031196
11041197 req .setCharacterEncoding ("UTF-8" );
@@ -1147,15 +1240,29 @@ public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOExc
11471240 *
11481241 * @return A string that represents the redirect location URL.
11491242 *
1150- * @see javax.servlet.http. HttpServletResponse#sendRedirect(String)
1243+ * @see HttpServletResponse#sendRedirect(String)
11511244 */
11521245 @ Restricted (NoExternalUse .class )
11531246 @ NonNull
11541247 protected String getSuccessfulDestination () {
11551248 return "." ;
11561249 }
11571250
1158- protected void submit (StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException , Descriptor .FormException {}
1251+ protected void submit (StaplerRequest2 req , StaplerResponse2 rsp ) throws IOException , ServletException , Descriptor .FormException {
1252+ if (Util .isOverridden (AbstractFolder .class , getClass (), "submit" , StaplerRequest .class , StaplerResponse .class )) {
1253+ try {
1254+ submit (req != null ? StaplerRequest .fromStaplerRequest2 (req ) : null , rsp != null ? StaplerResponse .fromStaplerResponse2 (rsp ) : null );
1255+ } catch (javax .servlet .ServletException e ) {
1256+ throw ServletExceptionWrapper .toJakartaServletException (e );
1257+ }
1258+ }
1259+ }
1260+
1261+ /**
1262+ * @deprecated use {@link #submit(StaplerRequest2, StaplerResponse2)}
1263+ */
1264+ @ Deprecated
1265+ protected void submit (StaplerRequest req , StaplerResponse rsp ) throws IOException , javax .servlet .ServletException , Descriptor .FormException {}
11591266
11601267 /**
11611268 * {@inheritDoc}
0 commit comments