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

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

Introduction

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

Prototype

public AjaxChannel getChannel() 

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);
    }/*from   www .  j  a v  a2s .co  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);
    }
}