@@ -26,20 +26,46 @@ public class UiConfiguration {
2626 private final String docExpansion ;
2727 private final String apisSorter ;
2828 private final String defaultModelRendering ;
29+ private final Long requestTimeout ;
2930
3031 private final String [] supportedSubmitMethods ;
3132
3233 private final boolean jsonEditor ;
3334 private final boolean showRequestHeaders ;
3435
3536 public UiConfiguration (String validatorUrl ) {
36- this (validatorUrl , "none" , "alpha" , "schema" , Constants .DEFAULT_SUBMIT_METHODS , false , true );
37+ this (validatorUrl , "none" , "alpha" , "schema" , Constants .DEFAULT_SUBMIT_METHODS , false , true , null );
3738 }
3839
3940 public UiConfiguration (String validatorUrl , String [] supportedSubmitMethods ) {
40- this (validatorUrl , "none" , "alpha" , "schema" , supportedSubmitMethods , false , true );
41+ this (validatorUrl , "none" , "alpha" , "schema" , supportedSubmitMethods , false , true , null );
4142 }
4243
44+ /**
45+ * Use the default constructor instead (with requestTimeout)
46+ * {@link UiConfiguration#UiConfiguration(String, String, String, String, String[], boolean, boolean, Long)} )}
47+ *
48+ * @deprecated @since 2.6.1
49+ * @param validatorUrl - By default, Swagger-UI attempts to validate specs against swagger.io's online validator.
50+ * You can use this parameter to set a different validator URL, for example for locally
51+ * deployed validators (Validator Badge). Setting it to null will disable validation. This
52+ * parameter is relevant for Swagger 2.0 specs only.
53+ * @param docExpansion - Controls how the API listing is displayed. It can be set to 'none' (default), 'list'
54+ * (shows operations for each resource), or 'full' (fully expanded: shows operations and their
55+ * details).
56+ * @param apisSorter Apply a sort to the API/tags list. It can be 'alpha' (sort by name) or a function (see Array
57+ * .prototype.sort() to know how sort function works). Default is the order returned by the
58+ * server unchanged.
59+ * @param defaultModelRendering - Controls how models are shown when the API is first rendered. (The user can
60+ * always switch the rendering for a given model by clicking the 'Model' and 'Model
61+ * Schema' links.) It can be set to 'model' or 'schema', and the default is 'schema'.
62+ * @param supportedSubmitMethods - An array of of the HTTP operations that will have the 'Try it out!' option. An
63+ * empty array disables all operations. This does not filter the operations from the display.
64+ * @param jsonEditor - Enables a graphical view for editing complex bodies. Defaults to false.
65+ * @param showRequestHeaders - Whether or not to show the headers that were sent when making a request via the 'Try
66+ * it out!' option. Defaults to false.
67+ */
68+ @ Deprecated
4369 public UiConfiguration (
4470 String validatorUrl ,
4571 String docExpansion ,
@@ -48,10 +74,53 @@ public UiConfiguration(
4874 String [] supportedSubmitMethods ,
4975 boolean jsonEditor ,
5076 boolean showRequestHeaders ) {
77+ this (
78+ validatorUrl ,
79+ docExpansion ,
80+ apisSorter ,
81+ defaultModelRendering ,
82+ supportedSubmitMethods ,
83+ jsonEditor ,
84+ showRequestHeaders ,
85+ null );
86+ }
87+
88+ /**
89+ * Default constructor
90+ * @param validatorUrl - By default, Swagger-UI attempts to validate specs against swagger.io's online validator.
91+ * You can use this parameter to set a different validator URL, for example for locally
92+ * deployed validators (Validator Badge). Setting it to null will disable validation. This
93+ * parameter is relevant for Swagger 2.0 specs only.
94+ * @param docExpansion - Controls how the API listing is displayed. It can be set to 'none' (default), 'list'
95+ * (shows operations for each resource), or 'full' (fully expanded: shows operations and their
96+ * details).
97+ * @param apisSorter Apply a sort to the API/tags list. It can be 'alpha' (sort by name) or a function (see Array
98+ * .prototype.sort() to know how sort function works). Default is the order returned by the
99+ * server unchanged.
100+ * @param defaultModelRendering - Controls how models are shown when the API is first rendered. (The user can
101+ * always switch the rendering for a given model by clicking the 'Model' and 'Model
102+ * Schema' links.) It can be set to 'model' or 'schema', and the default is 'schema'.
103+ * @param supportedSubmitMethods - An array of of the HTTP operations that will have the 'Try it out!' option. An
104+ * empty array disables all operations. This does not filter the operations from the display.
105+ * @param jsonEditor - Enables a graphical view for editing complex bodies. Defaults to false.
106+ * @param showRequestHeaders - Whether or not to show the headers that were sent when making a request via the 'Try
107+ * it out!' option. Defaults to false.
108+ * @param requestTimeout - XHR timeout
109+ */
110+ public UiConfiguration (
111+ String validatorUrl ,
112+ String docExpansion ,
113+ String apisSorter ,
114+ String defaultModelRendering ,
115+ String [] supportedSubmitMethods ,
116+ boolean jsonEditor ,
117+ boolean showRequestHeaders ,
118+ Long requestTimeout ) {
51119 this .validatorUrl = validatorUrl ;
52120 this .docExpansion = docExpansion ;
53121 this .apisSorter = apisSorter ;
54122 this .defaultModelRendering = defaultModelRendering ;
123+ this .requestTimeout = requestTimeout ;
55124 this .jsonEditor = jsonEditor ;
56125 this .showRequestHeaders = showRequestHeaders ;
57126 this .supportedSubmitMethods = supportedSubmitMethods ;
@@ -92,6 +161,11 @@ public boolean isShowRequestHeaders() {
92161 return showRequestHeaders ;
93162 }
94163
164+ @ JsonProperty ("requestTimeout" )
165+ public Long getRequestTimeout () {
166+ return requestTimeout ;
167+ }
168+
95169 public static class Constants {
96170 public static final String [] DEFAULT_SUBMIT_METHODS = new String [] { "get" , "post" , "put" , "delete" , "patch" };
97171 public static final String [] NO_SUBMIT_METHODS = new String [] {};
0 commit comments