Class Export
java.lang.Object
io.jenkins.blueocean.commons.stapler.Export
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
doJson
(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, Object bean) static String
Serialize the supplied object to JSON and return as aString
.static String
Serialize the supplied object to JSON and return as aString
.static void
Serialize the supplied object to JSON and write to the suppliedWriter
.static void
Serialize the supplied object to JSON and write to the suppliedWriter
.
-
Method Details
-
toJson
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
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
-