70
70
import hudson .util .HttpResponses ;
71
71
import hudson .views .DefaultViewsTabBar ;
72
72
import hudson .views .ViewsTabBar ;
73
+ import io .jenkins .servlet .ServletExceptionWrapper ;
74
+ import jakarta .servlet .ServletException ;
75
+ import jakarta .servlet .http .HttpServletResponse ;
73
76
import java .io .File ;
74
77
import java .io .FileNotFoundException ;
75
78
import java .io .IOException ;
94
97
import java .util .logging .Logger ;
95
98
import edu .umd .cs .findbugs .annotations .CheckForNull ;
96
99
import edu .umd .cs .findbugs .annotations .NonNull ;
97
- import javax .servlet .ServletException ;
98
100
import jenkins .model .DirectlyModifiableTopLevelItemGroup ;
99
101
import jenkins .model .Jenkins ;
100
102
import jenkins .model .ModelObjectWithChildren ;
101
103
import jenkins .model .ProjectNamingStrategy ;
102
104
import jenkins .model .TransientActionFactory ;
105
+ import jenkins .security .stapler .StaplerNotDispatchable ;
103
106
import net .sf .json .JSONObject ;
104
107
import org .kohsuke .accmod .Restricted ;
105
108
import org .kohsuke .accmod .restrictions .Beta ;
110
113
import org .kohsuke .stapler .StaplerFallback ;
111
114
import org .kohsuke .stapler .StaplerOverridable ;
112
115
import org .kohsuke .stapler .StaplerRequest ;
116
+ import org .kohsuke .stapler .StaplerRequest2 ;
113
117
import org .kohsuke .stapler .StaplerResponse ;
118
+ import org .kohsuke .stapler .StaplerResponse2 ;
114
119
import org .kohsuke .stapler .export .Exported ;
115
120
import org .kohsuke .stapler .interceptor .RequirePOST ;
116
121
import org .kohsuke .stapler .verb .POST ;
@@ -723,7 +728,25 @@ private ItemGroup<?> grp() {
723
728
* {@inheritDoc}
724
729
*/
725
730
@ 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
726
745
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 ) {
727
750
ContextMenu menu = new ContextMenu ();
728
751
for (View view : getViews ()) {
729
752
menu .add (view .getAbsoluteUrl (),view .getDisplayName ());
@@ -732,7 +755,34 @@ public ContextMenu doChildrenContextMenu(StaplerRequest request, StaplerResponse
732
755
}
733
756
734
757
@ 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
735
776
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 )
736
786
throws IOException , ServletException , ParseException , Descriptor .FormException {
737
787
checkPermission (View .CREATE );
738
788
addView (View .create (req , rsp , this ));
@@ -860,7 +910,24 @@ public DescribableList<FolderHealthMetric, FolderHealthMetricDescriptor> getHeal
860
910
return healthMetrics ;
861
911
}
862
912
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
863
926
public HttpResponse doLastBuild (StaplerRequest req ) {
927
+ return doLastBuildImpl (req != null ? StaplerRequest .toStaplerRequest2 (req ) : null );
928
+ }
929
+
930
+ private HttpResponse doLastBuildImpl (StaplerRequest2 req ) {
864
931
return HttpResponses .redirectToDot ();
865
932
}
866
933
@@ -1092,13 +1159,39 @@ public void renameTo(String newName) throws IOException {
1092
1159
* {@inheritDoc}
1093
1160
*/
1094
1161
@ 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 {
1096
1189
getPrimaryView ().doSubmitDescription (req , rsp );
1097
1190
}
1098
1191
1099
1192
@ Restricted (NoExternalUse .class )
1100
1193
@ 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 {
1102
1195
checkPermission (CONFIGURE );
1103
1196
1104
1197
req .setCharacterEncoding ("UTF-8" );
@@ -1147,15 +1240,29 @@ public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOExc
1147
1240
*
1148
1241
* @return A string that represents the redirect location URL.
1149
1242
*
1150
- * @see javax.servlet.http. HttpServletResponse#sendRedirect(String)
1243
+ * @see HttpServletResponse#sendRedirect(String)
1151
1244
*/
1152
1245
@ Restricted (NoExternalUse .class )
1153
1246
@ NonNull
1154
1247
protected String getSuccessfulDestination () {
1155
1248
return "." ;
1156
1249
}
1157
1250
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 {}
1159
1266
1160
1267
/**
1161
1268
* {@inheritDoc}
0 commit comments