Package jenkins.util

Record Class ClientHttpRedirect

java.lang.Object
java.lang.Record
jenkins.util.ClientHttpRedirect
All Implemented Interfaces:
org.kohsuke.stapler.HttpResponse

public record ClientHttpRedirect(String redirectUrl) extends Record implements org.kohsuke.stapler.HttpResponse
An HTTP response that redirects the client to the given URL. Unlike HttpRedirect, this implements a client-side redirect (using meta tag and/or JavaScript). This allows the redirect to work even when Content Security Policy is enforced in Chrome (which applies form-action to redirects after form submission).
Since:
TODO
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of a ClientHttpRedirect record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    void
    generateResponse(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, Object o)
     
    final int
    Returns a hash code value for this object.
    Returns the value of the redirectUrl record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.kohsuke.stapler.HttpResponse

    generateResponse
  • Constructor Details

    • ClientHttpRedirect

      public ClientHttpRedirect(String redirectUrl)
      Creates an instance of a ClientHttpRedirect record class.
      Parameters:
      redirectUrl - the value for the redirectUrl record component
  • Method Details

    • generateResponse

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

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • redirectUrl

      public String redirectUrl()
      Returns the value of the redirectUrl record component.
      Returns:
      the value of the redirectUrl record component