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

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

Introduction

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

Prototype

public String getDataType() 

Source Link

Document

Returns the type of the data in the Ajax response.

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 . ja v a 2  s .  c  o  m
    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);
    }
}