Example usage for org.apache.wicket.request.http WebResponse sendError

List of usage examples for org.apache.wicket.request.http WebResponse sendError

Introduction

In this page you can find the example usage for org.apache.wicket.request.http WebResponse sendError.

Prototype

public abstract void sendError(int sc, String msg);

Source Link

Document

Send error status code with optional message.

Usage

From source file:com.comcast.cdn.traffic_control.traffic_monitor.publish.JsonPage.java

License:Apache License

/**
 * Send out the json!!!!/*from  w  w  w  . j ava 2  s.c o m*/
 */
@Override
public final void renderPage() {
    final MonitorConfig config = ConfigHandler.getConfig();
    final WebResponse response = (WebResponse) super.getResponse();
    response.setHeader("Access-Control-Allow-Origin", config.getAccessControlAllowOrigin());
    try {
        final JSONObject jo = getJson(getPageParameters());
        if (jo == null) {
            response.sendError(503, "Not ready");
            return;
        }
        response.write(jo.toString(2));
    } catch (JSONException e) {
        LOGGER.warn(e, e);
    }
}