Class Export


  • public class Export
    extends Object
    • Method Detail

      • toJson

        @NonNull
        public static String toJson​(@NonNull
                                    Object object)
                             throws IOException
        Serialize the supplied object to JSON and return as a String.
        Parameters:
        object - The object to serialize.
        Returns:
        The JSON as a String.
        Throws:
        IOException - Error serializing model object.
      • toJson

        @NonNull
        public static String toJson​(@NonNull
                                    Object object,
                                    boolean htmlEncoded)
                             throws IOException
        Serialize the supplied object to JSON and return as a String.
        Parameters:
        object - The object to serialize.
        htmlEncoded - enable html encoding so its safe to output to html
        Returns:
        The JSON as a String.
        Throws:
        IOException - Error serializing model object.
      • toJson

        public static void toJson​(@NonNull
                                  Object object,
                                  @NonNull
                                  Writer writer)
                           throws IOException
        Serialize the supplied object to JSON and write to the supplied Writer.
        Parameters:
        object - The object to serialize.
        writer - The writer to output to.
        Throws:
        IOException - Error serializing model object.
      • toJson

        public static void toJson​(@NonNull
                                  Object object,
                                  @NonNull
                                  Writer writer,
                                  boolean htmlEncoded)
                           throws IOException
        Serialize the supplied object to JSON and write to the supplied Writer.
        Parameters:
        object - The object to serialize.
        writer - The writer to output to.
        htmlEncoded - enable html encoding so its safe to output to html
        Throws:
        IOException - Error serializing model object.
      • doJson

        public static void doJson​(org.kohsuke.stapler.StaplerRequest req,
                                  org.kohsuke.stapler.StaplerResponse rsp,
                                  Object bean)
                           throws IOException,
                                  javax.servlet.ServletException
        Parameters:
        req - request
        rsp - response
        bean - to serve
        Throws:
        IOException - if cannot be written
        javax.servlet.ServletException - if something goes wrong processing the request