Class RequestRunPrefill
The contract (frozen for tests): the Request Run page <job>/batch-control/ accepts
query parameters "p."<parameter name>; each one the job defines becomes the
default shown for that parameter. Anything else is ignored. Pre-fill only changes what the form
shows: nothing is queued or stored until the requester submits the form, whose field names are
unchanged.
Only parameters whose value round-trips through a string are carried: those of a
SimpleParameterDefinition (string, text, boolean, choice, run and the like), as the
string form the definition's createValue(String) turns back into the same value
(the text of a string, boolean or number value; the job#build id
of a run value, T-06-103; any other value's own string form only when the definition rebuilds
an equal value from it). A value without such a form is not carried. Sensitive values
(password parameters, Secrets, anything ParameterValue.isSensitive()) are never
written into the URL nor taken from it (P-03), file parameters cannot be, and a value the
definition refuses (a choice outside its choices, a run that does not exist or the viewer cannot
see) is dropped and leaves the job's default. Core's view of a run parameter does not show its
default, so the form renders a carried run itself (selectedRunId(hudson.model.ParameterDefinition)).
Values longer than 2000 characters are left out so the redirect stays
within common URL limits, and a longer "p." query value is ignored; the user
re-enters them. The whole encoded query is capped at 4000 characters:
in definition order, a value that would take it past the cap is left out (S-33-03).
A crafted link can only pre-fill a form the viewer may already open: the viewer still reads and submits it, and every rendered value goes through the parameter definition's own view, which escapes it.
D-72: an incident rerun whose failed run has a value that cannot be recovered continues on
the same form (rerunQuery(hudson.model.Job<?, ?>, java.util.Map<java.lang.String, java.lang.String>, java.lang.String)): the recoverable non-sensitive values travel as
"p."<name> under the same caps, and "fromRerun"=<incident id>
tells the form to say which values must be provided again. File parameters are never carried
(isFileDefinition(hudson.model.ParameterDefinition)); carrying them from a refused build is issue #10.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic List<ParameterDefinition> apply(List<ParameterDefinition> definitions, org.kohsuke.stapler.StaplerRequest2 req) definitionswith each carriable one that has a "p."<name>query parameter inreqreplaced by a copy defaulting to that value.carriedValues(Job<?, ?> job, List<ParameterValue> submitted) The values ofsubmittedthat may be carried to the Request Run form ofjob, by parameter name, in the job's definition order.static booleanisFileDefinition(ParameterDefinition definition) Whetherdefinitiontakes a file: core'sFileParameterDefinitionor a definition of the optional file-parameters plugin (stashedFile, base64File; throughFileParametersSupport.isFileDefinition(hudson.model.ParameterDefinition)).static booleanisPrefilled(List<ParameterDefinition> definitions, org.kohsuke.stapler.StaplerRequest2 req) Whetherreqis a GET carrying a "p."<name>value for at least one ofdefinitions(the page then says where the values came from; constant text only).static StringrerunFromQuery(jakarta.servlet.http.HttpServletRequest req) D-72a: the raw "fromRerun" value ofreq's query string alone (never its body), URL-decoded, ornull.static StringD-72: the query of the Request Run form an incident rerun continues on when a value of the failed run could not be recovered (RerunNeedsFormException): theprefillvalues the job defines as carriable parameters, under the same caps ascarriedValues(hudson.model.Job<?, ?>, java.util.List<hudson.model.ParameterValue>)(2000 characters per value, 4000 for the encoded "p." part, definition order), then "fromRerun"=<incidentId>.static StringselectedRunId(ParameterDefinition definition) T-06-103: the run the Request Run form must show selected fordefinition, ornullwhen the definition's own view is right.static String?p.A=1&p.B=xfor the given values, or the empty string for none.
-
Field Details
-
PREFIX
Query parameter prefix of a pre-filled value (frozen name).- See Also:
-
FROM_RERUN
D-72: query parameter naming the incident whose rerun continues on the Request Run form because a value of the failed run could not be recovered.- See Also:
-
-
Method Details
-
carriedValues
public static Map<String,String> carriedValues(Job<?, ?> job, @CheckForNull List<ParameterValue> submitted) The values ofsubmittedthat may be carried to the Request Run form ofjob, by parameter name, in the job's definition order. Empty when nothing qualifies. -
rerunQuery
D-72: the query of the Request Run form an incident rerun continues on when a value of the failed run could not be recovered (RerunNeedsFormException): theprefillvalues the job defines as carriable parameters, under the same caps ascarriedValues(hudson.model.Job<?, ?>, java.util.List<hudson.model.ParameterValue>)(2000 characters per value, 4000 for the encoded "p." part, definition order), then "fromRerun"=<incidentId>. A password parameter is never carried, whateverprefillholds. -
isFileDefinition
Whetherdefinitiontakes a file: core'sFileParameterDefinitionor a definition of the optional file-parameters plugin (stashedFile, base64File; throughFileParametersSupport.isFileDefinition(hudson.model.ParameterDefinition)). A file is never carried into the form; the user selects it again. -
toQuery
?p.A=1&p.B=xfor the given values, or the empty string for none. -
apply
public static List<ParameterDefinition> apply(List<ParameterDefinition> definitions, @CheckForNull org.kohsuke.stapler.StaplerRequest2 req) definitionswith each carriable one that has a "p."<name>query parameter inreqreplaced by a copy defaulting to that value. Only GET requests are read: a POST is a submission, whose own values the form shows (e2e-03 DEF-09). -
isPrefilled
public static boolean isPrefilled(List<ParameterDefinition> definitions, @CheckForNull org.kohsuke.stapler.StaplerRequest2 req) Whetherreqis a GET carrying a "p."<name>value for at least one ofdefinitions(the page then says where the values came from; constant text only). -
rerunFromQuery
@CheckForNull public static String rerunFromQuery(@CheckForNull jakarta.servlet.http.HttpServletRequest req) D-72a: the raw "fromRerun" value ofreq's query string alone (never its body), URL-decoded, ornull. The Request Run form's action carries the validated incident reference there as well as in its hidden field, so that a submission refused before its body may be read (over the D-72 size cap) can still show the form linked to the incident. Unvalidated: the caller passes it toIncidentService#linkableIncidentand ignores what that check refuses, exactly like the hidden field. -
selectedRunId
T-06-103: the run the Request Run form must show selected fordefinition, ornullwhen the definition's own view is right. Core's view of a run parameter lists the project's builds, newest first, without marking the definition's default; so a copy defaulting to a carried run (apply(java.util.List<hudson.model.ParameterDefinition>, org.kohsuke.stapler.StaplerRequest2), or a refused submission's value) would show the newest build instead. Non-null only for core's ownRunParameterDefinition(a subclass may have its own view) whose default run is not the first one listed; the form then renders the same fields with that run selected.
-