Package hudson.util

Class FormFillFailure

All Implemented Interfaces:
Serializable, org.kohsuke.stapler.HttpResponse

public abstract class FormFillFailure extends IOException implements org.kohsuke.stapler.HttpResponse
Represents a failure in a form field doFillXYZ method.

Use one of the factory methods to create an instance, then throw it from your doFillXyz method.

Since:
2.50
See Also:
  • Method Details

    • error

      public static FormFillFailure error(@NonNull String message)
      Sends out a string error message that indicates an error.
      Parameters:
      message - Human readable message to be sent.
    • warning

      public static FormFillFailure warning(@NonNull String message)
    • error

      public static FormFillFailure error(String format, Object... args)
      Sends out a string error message that indicates an error, by formatting it with String.format(String, Object[])
    • warning

      public static FormFillFailure warning(String format, Object... args)
    • error

      public static FormFillFailure error(Throwable e, String message)
      Sends out a string error message, with optional "show details" link that expands to the full stack trace.

      Use this with caution, so that anonymous users do not gain too much insights into the state of the system, as error stack trace often reveals a lot of information. Consider if an error needs to be exposed to everyone or just those who have higher access to job/hudson/etc.

    • warning

      public static FormFillFailure warning(Throwable e, String message)
    • error

      public static FormFillFailure error(Throwable e, String format, Object... args)
    • warning

      public static FormFillFailure warning(Throwable e, String format, Object... args)
    • errorWithMarkup

      public static FormFillFailure errorWithMarkup(String message)
      Sends out an HTML fragment that indicates an error.

      This method must be used with care to avoid cross-site scripting attack.

      Parameters:
      message - Human readable message to be sent. error(null) can be used as ok().
    • warningWithMarkup

      public static FormFillFailure warningWithMarkup(String message)
    • respond

      public static FormFillFailure respond(FormValidation.Kind kind, String html)
      Sends out an arbitrary HTML fragment as the output.
    • generateResponse

      public void generateResponse(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, Object node) throws IOException, jakarta.servlet.ServletException
      Specified by:
      generateResponse in interface org.kohsuke.stapler.HttpResponse
      Throws:
      IOException
      jakarta.servlet.ServletException
    • getKind

      public FormValidation.Kind getKind()
    • isSelectionCleared

      public boolean isSelectionCleared()
    • withSelectionCleared

      public FormFillFailure withSelectionCleared()
      Flags this failure as requiring that the select options should be cleared out.
      Returns:
      this for method chaining.
    • renderHtml

      public abstract String renderHtml()