Class Dialogs

java.lang.Object
io.jenkins.plugins.batchcontrol.ui.Dialogs

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public final class Dialogs extends Object
D-66: request forms opened in core's dialog (data-type="dialog-opener" with data-dialog-url, the mechanism of core's "Create User" and build-parameters dialogs).

Core's dialog loads the URL, shows the first <form> of the answer and submits it with the crumb header; a redirect answer is followed by the whole page (to the new request), any other answer that holds a form replaces the dialog's form. A dialog form therefore carries the hidden field "dialog", and a refused submission is answered with the dialog view, not the full page. The field only selects which view shows the refusal: every check is the same.

D-72: a dialog form may also carry the marker in its action's query string (?dialog=true), so that a submission refused before its body is read (over the body size cap) can still be answered with the dialog view: fromDialogQuery(jakarta.servlet.http.HttpServletRequest) reads the query string alone and never the body.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    View name of the dialog form of a screen.
    static final String
    Hidden form field marking a submission made from a dialog.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    fromDialog(org.kohsuke.stapler.StaplerRequest2 req)
    Whether req was submitted from a dialog form.
    static boolean
    fromDialogQuery(jakarta.servlet.http.HttpServletRequest req)
    Whether the query string of req (never its body) marks a dialog submission (dialog=true).
    static String
    refusalView(org.kohsuke.stapler.StaplerRequest2 req, String pageView)
    The view that shows a refusal of req: the dialog's, else pageView.
    static String
    toRoot(String itemUrl)
    ../ once per path segment of an item URL (job/a/job/b/), the way from the item's page back to the Jenkins root (which carries the context path, if any).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • fromDialog

      public static boolean fromDialog(@CheckForNull org.kohsuke.stapler.StaplerRequest2 req)
      Whether req was submitted from a dialog form.
    • fromDialogQuery

      public static boolean fromDialogQuery(@CheckForNull jakarta.servlet.http.HttpServletRequest req)
      Whether the query string of req (never its body) marks a dialog submission (dialog=true). For a refusal made before the body may be read (D-72 size cap): getParameter would parse a multipart body.
    • refusalView

      public static String refusalView(@CheckForNull org.kohsuke.stapler.StaplerRequest2 req, String pageView)
      The view that shows a refusal of req: the dialog's, else pageView.
    • toRoot

      public static String toRoot(String itemUrl)
      ../ once per path segment of an item URL (job/a/job/b/), the way from the item's page back to the Jenkins root (which carries the context path, if any).