APISonar


io.jenkins.blueocean.commons.stapler.export.Flavor.JSON

> io > jenkins > blueocean > commons > stapler > export > Flavor > JSON
io APIs jenkins APIs blueocean APIs commons APIs stapler APIs export APIs Flavor APIs JSON APIs

Example 1
public static void doJson(StaplerRequest req, StaplerResponse rsp, Object bean) throws IOException, ServletException {
        if (req.getParameter("jsonp") == null || permit(req, bean)) {
            rsp.setHeader("X-Jenkins", Jenkins.VERSION);
            rsp.setHeader("X-Jenkins-Session", Jenkins.SESSION_HASH);
            ExportConfig exportConfig = createExportConfig()
                    .withFlavor(req.getParameter("jsonp") == null ? Flavor.JSON : Flavor.JSONP)
                    .withPrettyPrint(req.hasParameter("pretty")).withSkipIfFail(true);
            serveExposedBean(req, rsp, bean, exportConfig);
        } else {
            rsp.sendError(HttpURLConnection.HTTP_FORBIDDEN, "jsonp forbidden; implement jenkins.security.SecureRequester");
        }
    }