Package hudson.util

Class HttpResponses

java.lang.Object
org.kohsuke.stapler.HttpResponses
hudson.util.HttpResponses

public class HttpResponses extends org.kohsuke.stapler.HttpResponses
Various HttpResponse implementations.

This class extends from Stapler so that we can move implementations from here to Stapler periodically.

Author:
Kohsuke Kawaguchi
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.kohsuke.stapler.HttpResponses

    org.kohsuke.stapler.HttpResponses.ErrorCustomizer, org.kohsuke.stapler.HttpResponses.HttpResponseException
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.kohsuke.stapler.HttpResponse
    errorJSON(String message)
    Set the response as an error response.
    static org.kohsuke.stapler.HttpResponse
    errorJSON(String message, Map<?,?> data)
    Set the response as an error response plus some data.
    static org.kohsuke.stapler.HttpResponse
    errorJSON(String message, net.sf.json.JSONArray data)
    Set the response as an error response plus some data.
    static org.kohsuke.stapler.HttpResponse
    errorJSON(String message, net.sf.json.JSONObject data)
    Set the response as an error response plus some data.
    static org.kohsuke.stapler.HttpResponse
    Create an empty "ok" response.
    static org.kohsuke.stapler.HttpResponse
    okJSON(Map<?,?> data)
    Create a response containing the supplied "data".
    static org.kohsuke.stapler.HttpResponse
    okJSON(net.sf.json.JSONArray data)
    Create a response containing the supplied "data".
    static org.kohsuke.stapler.HttpResponse
    okJSON(net.sf.json.JSONObject data)
    Create a response containing the supplied "data".
    static org.kohsuke.stapler.HttpResponse
     

    Methods inherited from class org.kohsuke.stapler.HttpResponses

    error, error, error, errorWithoutStack, forbidden, forwardToPreviousPage, forwardToView, forwardToView, html, literalHtml, notFound, ok, plainText, redirectTo, redirectTo, redirectToContextRoot, redirectToDot, redirectViaContextPath, redirectViaContextPath, staticResource, staticResource, status, text, wrap

    Methods inherited from class java.lang.Object

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

    • HttpResponses

      public HttpResponses()
  • Method Details

    • staticResource

      public static org.kohsuke.stapler.HttpResponse staticResource(File f) throws IOException
      Throws:
      IOException
    • okJSON

      public static org.kohsuke.stapler.HttpResponse okJSON()
      Create an empty "ok" response.
      Since:
      2.0
    • okJSON

      public static org.kohsuke.stapler.HttpResponse okJSON(@NonNull net.sf.json.JSONObject data)
      Create a response containing the supplied "data".
      Parameters:
      data - The data.
      Since:
      2.0
    • okJSON

      public static org.kohsuke.stapler.HttpResponse okJSON(@NonNull net.sf.json.JSONArray data)
      Create a response containing the supplied "data".
      Parameters:
      data - The data.
      Since:
      2.0
    • okJSON

      public static org.kohsuke.stapler.HttpResponse okJSON(@NonNull Map<?,?> data)
      Create a response containing the supplied "data".
      Parameters:
      data - The data.
      Since:
      2.0
    • errorJSON

      public static org.kohsuke.stapler.HttpResponse errorJSON(@NonNull String message)
      Set the response as an error response.
      Parameters:
      message - The error "message" set on the response.
      Returns:
      this object.
      Since:
      2.0
    • errorJSON

      public static org.kohsuke.stapler.HttpResponse errorJSON(@NonNull String message, @NonNull Map<?,?> data)
      Set the response as an error response plus some data.
      Parameters:
      message - The error "message" set on the response.
      data - The data.
      Returns:
      this object.
      Since:
      2.119
    • errorJSON

      public static org.kohsuke.stapler.HttpResponse errorJSON(@NonNull String message, @NonNull net.sf.json.JSONObject data)
      Set the response as an error response plus some data.
      Parameters:
      message - The error "message" set on the response.
      data - The data.
      Returns:
      this object.
      Since:
      2.115
    • errorJSON

      public static org.kohsuke.stapler.HttpResponse errorJSON(@NonNull String message, @NonNull net.sf.json.JSONArray data)
      Set the response as an error response plus some data.
      Parameters:
      message - The error "message" set on the response.
      data - The data.
      Returns:
      this object.
      Since:
      2.115