Example usage for org.apache.wicket.ajax.attributes AjaxRequestAttributes XML_DATA_TYPE

List of usage examples for org.apache.wicket.ajax.attributes AjaxRequestAttributes XML_DATA_TYPE

Introduction

In this page you can find the example usage for org.apache.wicket.ajax.attributes AjaxRequestAttributes XML_DATA_TYPE.

Prototype

String XML_DATA_TYPE

To view the source code for org.apache.wicket.ajax.attributes AjaxRequestAttributes XML_DATA_TYPE.

Click Source Link

Usage

From source file:com.comcast.cdn.traffic_control.traffic_monitor.wicket.behaviors.AbstractMultiAjaxBehavior.java

License:Apache License

private void appendSpecial(final JSONObject attributesJson, final AjaxRequestAttributes attributes)
        throws JSONException {
    final Method method = attributes.getMethod();
    if (Method.POST == method) {
        attributesJson.put("m", method);
    }// ww w. j  av  a  2 s  .  c  om
    if (component instanceof Page == false) {
        final String componentId = component.getMarkupId();
        attributesJson.put("c", componentId);
    }
    final JSONArray extraParameters = JsonUtils.asArray(attributes.getExtraParameters());
    if (extraParameters.length() > 0) {
        attributesJson.put("ep", extraParameters);
    }

    final String[] eventNames = attributes.getEventNames();
    if (eventNames.length == 1) {
        attributesJson.put("e", eventNames[0]);
    } else {
        for (String eventName : eventNames) {
            attributesJson.append("e", eventName);
        }
    }
    final AjaxChannel channel = attributes.getChannel();
    if (channel != null) {
        attributesJson.put("ch", channel);
    }
    final Duration requestTimeout = attributes.getRequestTimeout();
    if (requestTimeout != null) {
        attributesJson.put("rt", requestTimeout.getMilliseconds());
    }
    final String dataType = attributes.getDataType();
    if (AjaxRequestAttributes.XML_DATA_TYPE.equals(dataType) == false) {
        attributesJson.put("dt", dataType);
    }
}