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:
    Serialized Form
    • Method Detail

      • 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.
      • 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.

      • 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().
      • generateResponse

        public void generateResponse​(org.kohsuke.stapler.StaplerRequest req,
                                     org.kohsuke.stapler.StaplerResponse rsp,
                                     Object node)
                              throws IOException,
                                     javax.servlet.ServletException
        Specified by:
        generateResponse in interface org.kohsuke.stapler.HttpResponse
        Throws:
        IOException
        javax.servlet.ServletException
      • 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()