Class Export
- java.lang.Object
-
- io.jenkins.blueocean.commons.stapler.Export
-
public class Export extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
doJson(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, Object bean)
static String
toJson(Object object)
Serialize the supplied object to JSON and return as aString
.static String
toJson(Object object, boolean htmlEncoded)
Serialize the supplied object to JSON and return as aString
.static void
toJson(Object object, Writer writer)
Serialize the supplied object to JSON and write to the suppliedWriter
.static void
toJson(Object object, Writer writer, boolean htmlEncoded)
Serialize the supplied object to JSON and write to the suppliedWriter
.
-
-
-
Method Detail
-
toJson
@NonNull public static String toJson(@NonNull Object object) throws IOException
Serialize the supplied object to JSON and return as aString
.- 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 aString
.- 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 suppliedWriter
.- 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 suppliedWriter
.- 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
- requestrsp
- responsebean
- to serve- Throws:
IOException
- if cannot be writtenjavax.servlet.ServletException
- if something goes wrong processing the request
-
-